Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
on isPrime(n)
|
||||
if (n < 4) then return (n > 1)
|
||||
if ((n mod 2 is 0) or (n mod 3 is 0)) then return false
|
||||
repeat with i from 5 to (n ^ 0.5) div 1 by 6
|
||||
if ((n mod i is 0) or (n mod (i + 2) is 0)) then return false
|
||||
end repeat
|
||||
|
||||
return true
|
||||
end isPrime
|
||||
|
||||
on primeFactorCount(n)
|
||||
set x to n
|
||||
set counter to 0
|
||||
if (n > 1) then
|
||||
repeat while (n mod 2 = 0)
|
||||
set counter to counter + 1
|
||||
set n to n div 2
|
||||
end repeat
|
||||
repeat while (n mod 3 = 0)
|
||||
set counter to counter + 1
|
||||
set n to n div 3
|
||||
end repeat
|
||||
set i to 5
|
||||
set limit to (n ^ 0.5) div 1
|
||||
repeat until (i > limit)
|
||||
repeat while (n mod i = 0)
|
||||
set counter to counter + 1
|
||||
set n to n div i
|
||||
end repeat
|
||||
tell (i + 2) to repeat while (n mod it = 0)
|
||||
set counter to counter + 1
|
||||
set n to n div it
|
||||
end repeat
|
||||
set i to i + 6
|
||||
set limit to (n ^ 0.5) div 1
|
||||
end repeat
|
||||
if (n > 1) then set counter to counter + 1
|
||||
end if
|
||||
|
||||
return counter
|
||||
end primeFactorCount
|
||||
|
||||
-- Task code:
|
||||
local output, n
|
||||
set output to {}
|
||||
repeat with n from 1 to 120
|
||||
if (isPrime(primeFactorCount(n))) then set end of output to n
|
||||
end repeat
|
||||
return output
|
||||
|
|
@ -0,0 +1 @@
|
|||
{4, 6, 8, 9, 10, 12, 14, 15, 18, 20, 21, 22, 25, 26, 27, 28, 30, 32, 33, 34, 35, 38, 39, 42, 44, 45, 46, 48, 49, 50, 51, 52, 55, 57, 58, 62, 63, 65, 66, 68, 69, 70, 72, 74, 75, 76, 77, 78, 80, 82, 85, 86, 87, 91, 92, 93, 94, 95, 98, 99, 102, 105, 106, 108, 110, 111, 112, 114, 115, 116, 117, 118, 119, 120}
|
||||
Loading…
Add table
Add a link
Reference in a new issue