3 ms·
Wrote some code to compare random numbers to the primes for this property. To generate the random numbers, I apply the Prime Number theorem as a probability to
by personjerry 11y ago
Wrote some code to compare random numbers to the primes for this property. To generate the random numbers, I apply the Prime Number theorem as a probability to determine if we want to select it, and then compare the stats to that of the actual primes. https://gist.github.com/personjerry/c58483daaf372acbe1fa https://gist.github.com/personjerry/c58483daaf372acbe1fa
cumulative:
1 to 1: 30768 rand, 28289 prime
1 to 3: 53573 rand, 51569 prime
1 to 7: 44306 rand, 53263 prime
1 to 9: 36968 rand, 32816 prime
ratios:
1 to 1: 0.18578027352594872 rand, 0.17048036302934247 prime
1 to 3: 0.323479153458322 rand, 0.3107745710721539 prime
1 to 7: 0.26752407692539926 rand, 0.3209832647330011 prime
1 to 9: 0.22321649609032998 rand, 0.19776180116550257 prime
cumulative:
3 to 1: 37015 rand, 38455 prime
3 to 3: 31015 rand, 25900 prime
3 to 7: 53377 rand, 48596 prime
3 to 9: 44594 rand, 53082 prime
ratios:
3 to 1: 0.22298058445431052 rand, 0.23161058343823215 prime
3 to 3: 0.18683622387816942 rand, 0.15599308571187656 prime
3 to 7: 0.3215462557454473 rand, 0.2926888028283534 prime
3 to 9: 0.2686369359220728 rand, 0.3197075280215379 prime
cumulative:
7 to 1: 44412 rand, 42590 prime
7 to 3: 36923 rand, 45728 prime
7 to 7: 30588 rand, 25886 prime
7 to 9: 53404 rand, 51800 prime
ratios:
7 to 1: 0.26863125805222376 rand, 0.25656008288956894 prime
7 to 3: 0.2233331518747694 rand, 0.275463241849594 prime
7 to 7: 0.18501515179008873 rand, 0.15593600154213152 prime
7 to 9: 0.3230204382829181 rand, 0.3120406737187056 prime
cumulative:
9 to 1: 53453 rand, 56602 prime
9 to 3: 44489 rand, 42837 prime
9 to 7: 37022 rand, 38259 prime
9 to 9: 30902 rand, 28144 prime
ratios:
9 to 1: 0.322266166664657 rand, 0.3413007561413876 prime
9 to 3: 0.2682225410873838 rand, 0.2583000687401261 prime
9 to 7: 0.22320427332907286 rand, 0.23069548124118136 prime
9 to 9: 0.18630701891888632 rand, 0.1697036938773049 prime
Unless I'm doing something wrong, it honestly it doesn't seem like the actual prime numbers have a statistic that deviates from random numbers with a prime distribution. Hence it looks like to me just the result of a) specifying the "next" number which naturally favors the digit after it and b) probability of a given number being prime (prime number theorem).