Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Anti-primes/AppleScript/anti-primes-1.applescript
Normal file
33
Task/Anti-primes/AppleScript/anti-primes-1.applescript
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
on factorCount(n)
|
||||
set counter to 0
|
||||
set sqrt to n ^ 0.5
|
||||
set limit to sqrt div 1
|
||||
if (limit = sqrt) then
|
||||
set counter to counter + 1
|
||||
set limit to limit - 1
|
||||
end if
|
||||
repeat with i from limit to 1 by -1
|
||||
if (n mod i is 0) then set counter to counter + 2
|
||||
end repeat
|
||||
|
||||
return counter
|
||||
end factorCount
|
||||
|
||||
on antiprimes(howMany)
|
||||
set output to {}
|
||||
set mostFactorsSoFar to 0
|
||||
set n to 0
|
||||
repeat until ((count output) = howMany)
|
||||
set n to n + 1
|
||||
tell (factorCount(n))
|
||||
if (it > mostFactorsSoFar) then
|
||||
set end of output to n
|
||||
set mostFactorsSoFar to it
|
||||
end if
|
||||
end tell
|
||||
end repeat
|
||||
|
||||
return output
|
||||
end antiprimes
|
||||
|
||||
antiprimes(20)
|
||||
1
Task/Anti-primes/AppleScript/anti-primes-2.applescript
Normal file
1
Task/Anti-primes/AppleScript/anti-primes-2.applescript
Normal file
|
|
@ -0,0 +1 @@
|
|||
{1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560}
|
||||
Loading…
Add table
Add a link
Reference in a new issue