Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
|||
on sieveOfEratosthenes(limit)
|
||||
script o
|
||||
property numberList : {missing value}
|
||||
end script
|
||||
|
||||
repeat with n from 2 to limit
|
||||
set end of o's numberList to n
|
||||
end repeat
|
||||
|
||||
repeat with n from 2 to (limit ^ 0.5) div 1
|
||||
if (item n of o's numberList is n) then
|
||||
repeat with multiple from n * n to limit by n
|
||||
set item multiple of o's numberList to missing value
|
||||
end repeat
|
||||
end if
|
||||
end repeat
|
||||
|
||||
return o's numberList's numbers
|
||||
end sieveOfEratosthenes
|
||||
|
||||
on sumOfDigits(n) -- n assumed to be a positive decimal integer.
|
||||
set sum to n mod 10
|
||||
set n to n div 10
|
||||
repeat until (n = 0)
|
||||
set sum to sum + n mod 10
|
||||
set n to n div 10
|
||||
end repeat
|
||||
|
||||
return sum
|
||||
end sumOfDigits
|
||||
|
||||
on additivePrimes(limit)
|
||||
script o
|
||||
property primes : sieveOfEratosthenes(limit)
|
||||
property additives : {}
|
||||
end script
|
||||
|
||||
repeat with p in o's primes
|
||||
if (sumOfDigits(p) is in o's primes) then set end of o's additives to p's contents
|
||||
end repeat
|
||||
|
||||
return o's additives
|
||||
end additivePrimes
|
||||
|
||||
-- Task code:
|
||||
tell additivePrimes(499) to return {|additivePrimes<500|:it, numberThereof:count}
|
||||
|
|
@ -0,0 +1 @@
|
|||
{|additivePrimes<500|:{2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 113, 131, 137, 139, 151, 157, 173, 179, 191, 193, 197, 199, 223, 227, 229, 241, 263, 269, 281, 283, 311, 313, 317, 331, 337, 353, 359, 373, 379, 397, 401, 409, 421, 443, 449, 461, 463, 467, 487}, numberThereof:54}
|
||||
Loading…
Add table
Add a link
Reference in a new issue