16
$\begingroup$

In order to write the first 25 primes (2 to 97), 46 digits are necessary, nine of each of the digits 2, 3, and 7, fewer of all the others. Thereafter, at least for a while, the digit 1 is used more times than anyother digit, while the digit 0 fewer times than any other.

Does this phenomenon persist forever thereafter?

This question arose during discussions at the 2023 Soacha, Colombia Math Circle.

A related question is here: https://puzzling.stackexchange.com/questions/122129/number-of-1s-needed-to-write-all-primes-up-to-p

$\endgroup$
8
  • 2
    $\begingroup$ This holds for primes up to $10^4.$ $\endgroup$
    – kodlu
    Commented Aug 16, 2023 at 20:15
  • 2
    $\begingroup$ Your title asked the opposite question from your body, so I edited it to match. I hope that was correct. $\endgroup$
    – LSpice
    Commented Aug 16, 2023 at 20:22
  • 6
    $\begingroup$ Maybe this imbalance just comes from Benford's law, combined with the fact that the last digits of primes >5 can only be 1,3,7.9? If so, the imbalance should become less prominent as the numbers increase: even if there are regularities in the first and last digit, eventually they are just a negligible percentage of all the digits. $\endgroup$ Commented Aug 16, 2023 at 20:37
  • 13
    $\begingroup$ The asymptotic distribution of all digits within primes is the same - this follows from normality of the Erdos-Copeland constant (this argument is of course kind of backwards, but this is convenient to point to references). This still leaves the question of statements analogous to Chebyshev bias but I wouldn't have any idea how one would prove that. $\endgroup$
    – Wojowu
    Commented Aug 16, 2023 at 20:43
  • 7
    $\begingroup$ While Benfords law gives bias in the first $O(1)$ digits and divisibility criteria give bias in the last $O(1)$, the Cramer model suggests random fluctuations in most of the last $O(\log\log n)$ digits. So the bias should disappear asymptotically, though this may be challenging to discern numerically. $\endgroup$
    – Terry Tao
    Commented Aug 17, 2023 at 5:50

3 Answers 3

24
$\begingroup$

I guess it's OK to reply to a question about an empirical observation with more empirical observations.

Here's a Mathematica histogram of the digits of the first million primes: enter image description here

Now I make a "fakePrime" function that instead of giving the $n$th prime gives a random number ending in 1, 3, 7, or 9 of size around $n\log{n}$: Histogram of the digits of the first million fake primes

Pretty close.

As partly mentioned in the comments, 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.

$\endgroup$
4
  • 11
    $\begingroup$ The millionth prime is $p=15,485,863$, so the primes between $10,000,000$ and $p$ are contributing a lot of ones. I'd be more impressed by a study of primes up to $9,999,999$. There might still be a slight bias in favor of $1$, since there are more primes between $1,000,000$ and $1,999,999$ than between, say, $9,000,000$ and $9,999,999$, but I don't think this counts as an instance of Benford. $\endgroup$ Commented Aug 16, 2023 at 23:51
  • $\begingroup$ @GerryMyerson Agreed. Mentioning Benford's law was a bit of a red herring but I do expect to see more 1s at the start for the reason you mention. $\endgroup$
    – Dan Piponi
    Commented Aug 17, 2023 at 1:16
  • 6
    $\begingroup$ How about making charts like this where you do not count the first and last digits? $\endgroup$ Commented Aug 18, 2023 at 1:10
  • $\begingroup$ There's already work like arxiv.org/abs/1603.03720 $\endgroup$
    – Dan Piponi
    Commented Aug 18, 2023 at 22:54
8
$\begingroup$

More data addressing some of the comments to Dan Piponi's empirical observations.

Gerry Myerson wanted a range of primes just up to a power of 10. The 664,579th prime is 9,999,991. I'm going to be dropping digits so I'll start with 101, the 26th prime. The conjecture holds for the 26th to 664,579th primes with 324,133 digits 0 and 570,148 digits 1:

distribution of digits

Note that the 0 count is the same for all four histograms. Dropping the first digit still puts 1 on top with 490,132 but now last place is the 323,065 digits 5:

distribution of digits except first

Dropping the last digit still has 1 on top with 404,049 and 0 last, but the nonzero digits are almost uniform:

distribution of digits except last

Finally, for Gerald Edgar's idea of dropping the first and last digits, i.e., looking at just internal digits, the results are almost uniform for all digits. Here 0 is actually first (still 324,133) and 9 last with 322,604:

distribution of internal digits

$\endgroup$
1
$\begingroup$

Certain it is that $1$ will be the most common initial digit. Consider the relation

$f(n,d)=\int_{d×10^n}^{(d+1)×10^n}\dfrac{dt}{\ln t}$

in which the integrand reflects tge asymptotic density of primes. The asymptotic density is monotonically decreasing, so for any value of $n$ sufficiently large for the asymptotic relation to hold accurately the count of primes will be greater for $d=1$ than for any of $d=2,d=3,$ etc.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .