Fake primes
by John from John D. Cook on (#6E1A6)
Someone asked on Math Overflow about the distribution of digits in primes. It seems 0 is the least common digit and 1 the most common digit.
Dan Piponi replies this is probably just a combination of general properties of sets of numbers with a density similar to the primes and the fact that primes end in 1, 3, 7 or 9" and supports this by showing that fake primes" have very similar digit distributions as actual primes. He generates the nth fake prime by starting with n log n and generating a nearby random integer ending in 1, 3, 7, or 9.
It seems like this fake prime function could be useful for studying more questions. Here is Dan Piponi's Mathematica implementation:
fakePrime[n_] := With[ {m = n Log[n]}, 10 RandomInteger[{Floor[0.09 m], Floor[0.11 m]}] + RandomChoice[{1, 3, 7, 9}] ]The post Fake primes first appeared on John D. Cook.