Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,60 @@
|
|||
on isPrime(n)
|
||||
if ((n < 4) or (n is 5)) then return (n > 1)
|
||||
if ((n mod 2 = 0) or (n mod 3 = 0) or (n mod 5 = 0)) then return false
|
||||
repeat with i from 7 to (n ^ 0.5) div 1 by 30
|
||||
if ((n mod i = 0) or (n mod (i + 4) = 0) or (n mod (i + 6) = 0) or ¬
|
||||
(n mod (i + 10) = 0) or (n mod (i + 12) = 0) or (n mod (i + 16) = 0) or ¬
|
||||
(n mod (i + 22) = 0) or (n mod (i + 24) = 0)) then return false
|
||||
end repeat
|
||||
|
||||
return true
|
||||
end isPrime
|
||||
|
||||
on conspiracy(limit)
|
||||
script o
|
||||
property counters : {{0, 0, 0, 0, 0, 0, 0, 0, 0}}
|
||||
end script
|
||||
repeat 8 times
|
||||
copy beginning of o's counters to end of o's counters
|
||||
end repeat
|
||||
|
||||
if (limit > 1) then
|
||||
set primeCount to 1
|
||||
set i to 2 -- First prime.
|
||||
set n to 3 -- First number to test for primality.
|
||||
repeat until (primeCount = limit)
|
||||
if (isPrime(n)) then
|
||||
set primeCount to primeCount + 1
|
||||
set j to n mod 10
|
||||
set item j of item i of o's counters to (item j of item i of o's counters) + 1
|
||||
set i to j
|
||||
end if
|
||||
set n to n + 2
|
||||
end repeat
|
||||
end if
|
||||
|
||||
set output to {"First " & limit & " primes: transitions between end digits of consecutive primes."}
|
||||
set totalTransitions to limit - 1
|
||||
repeat with i in {1, 2, 3, 5, 7, 9}
|
||||
set iTransitions to 0
|
||||
repeat with j from 1 to 9 by 2
|
||||
set iTransitions to iTransitions + (item j of item i of o's counters)
|
||||
end repeat
|
||||
repeat with j from 1 to 9 by 2
|
||||
set ijCount to item j of item i of o's counters
|
||||
if (ijCount > 0) then ¬
|
||||
set end of output to ¬
|
||||
(i as text) & " → " & j & ¬
|
||||
(" count: " & ijCount) & ¬
|
||||
(" preference for " & j & ": " & (ijCount * 10000 / iTransitions as integer) / 100) & ¬
|
||||
("% overall occurrence: " & (ijCount * 10000 / totalTransitions as integer) / 100 & "%")
|
||||
end repeat
|
||||
end repeat
|
||||
set astid to AppleScript's text item delimiters
|
||||
set AppleScript's text item delimiters to linefeed
|
||||
set output to output as text
|
||||
set AppleScript's text item delimiters to astid
|
||||
return output
|
||||
end conspiracy
|
||||
|
||||
conspiracy(1000000)
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
"First 1000000 primes: transitions between end digits of consecutive primes.
|
||||
1 → 1 count: 42853 preference for 1: 17.15% overall occurrence: 4.29%
|
||||
1 → 3 count: 77475 preference for 3: 31.0% overall occurrence: 7.75%
|
||||
1 → 7 count: 79453 preference for 7: 31.79% overall occurrence: 7.95%
|
||||
1 → 9 count: 50153 preference for 9: 20.07% overall occurrence: 5.02%
|
||||
2 → 3 count: 1 preference for 3: 100.0% overall occurrence: 0.0%
|
||||
3 → 1 count: 58255 preference for 1: 23.29% overall occurrence: 5.83%
|
||||
3 → 3 count: 39668 preference for 3: 15.86% overall occurrence: 3.97%
|
||||
3 → 5 count: 1 preference for 5: 0.0% overall occurrence: 0.0%
|
||||
3 → 7 count: 72827 preference for 7: 29.12% overall occurrence: 7.28%
|
||||
3 → 9 count: 79358 preference for 9: 31.73% overall occurrence: 7.94%
|
||||
5 → 7 count: 1 preference for 7: 100.0% overall occurrence: 0.0%
|
||||
7 → 1 count: 64230 preference for 1: 25.69% overall occurrence: 6.42%
|
||||
7 → 3 count: 68595 preference for 3: 27.44% overall occurrence: 6.86%
|
||||
7 → 7 count: 39603 preference for 7: 15.84% overall occurrence: 3.96%
|
||||
7 → 9 count: 77586 preference for 9: 31.03% overall occurrence: 7.76%
|
||||
9 → 1 count: 84596 preference for 1: 33.85% overall occurrence: 8.46%
|
||||
9 → 3 count: 64371 preference for 3: 25.75% overall occurrence: 6.44%
|
||||
9 → 7 count: 58130 preference for 7: 23.26% overall occurrence: 5.81%
|
||||
9 → 9 count: 42843 preference for 9: 17.14% overall occurrence: 4.28%"
|
||||
Loading…
Add table
Add a link
Reference in a new issue