Problems & Puzzles: Puzzles

 

 

Problems & Puzzles: Puzzles

 
Puzzle 1287 Ties Between the Final Digits of Primes

On Oct 14, 2026, G. L. Honaker, Jr., sent me some lines for a possible puzzle about ties among the final digits of primes. He gave me an example:

digits    prime   discoverer
[1,9] ->  2341    Eldar, Aug 2026

Following his idea, I extended it to all combinations of two, three and four final digits (1, 3, 7, 9), and used a Python program to record, for each combination, the largest tie and the number of ties up to a given limit.

Note: A tie for the digits [a,b] occurs at a prime p ending in a or b when, counting all primes ≤ p, as many end in a as in b (for [1,9] see OEIS A399129). For three or four digits, all the counts must be equal at the same time.

Here are my results for all primes below 10^13:

digits prime at largest tie # ties
Pairs
[1,9] 9,999,980,034,511 5,481,292
[7,9] 9,999,032,171,987 543,069
[1,7] 9,949,311,529,961 965,185
[3,7] 9,522,271,290,377 3,755,428
[1,3] 9,004,483,237,181 890,554
[3,9] 8,884,100,818,763 689,198
Triples
[1,3,9] 8,874,131,773,081 86
[1,3,7] 597,189,590,237 52
[3,7,9] 322,970,147 15
[1,7,9] 18,565,889 61
Quadruple
[1,3,7,9] none 0

Counts of primes below 10^13 ending in 1, 3, 7 and 9:
1: 86,516,370,000, 3: 86,516,427,946, 7: 86,516,367,790, 9: 86,516,371,101
Last prime checked: 9,999,999,999,971

Q1. Can you verify my results?
Q2. Can you extend my results?

Some theory behind the table:

1) Why the race is fair, yet biased. By Dirichlet’s theorem (1837) and the prime number theorem for arithmetic progressions, each of the final digits 1, 3, 7 and 9 eventually takes one quarter of the primes, so every race is “fair” in the long run. Yet in 1853 Chebyshev noticed that primes in non-square classes tend to lead: modulo 10, the squares of the digits 1, 3, 7, 9 end in 1 or 9, so the digits 3 and 7 tend to stay slightly ahead of 1 and 9 most of the time. This is the so-called Chebyshev bias. It is only a tendency, not a rule: at 10^13 the digit 3 leads, but the digit 7 is behind both 1 and 9. Littlewood (1914) proved that such leads change infinitely often (for the classical race mod 4), and Rubinstein and Sarnak (1994), assuming the Generalized Riemann Hypothesis and a linear-independence hypothesis on the zeros, showed that each order of the racers occurs for a positive proportion of the time (in logarithmic measure), with a typical gap of order √x / ln x. Since in a two-digit race the difference changes by exactly one at each prime of the race, every change of leader forces a tie. This is why pairs like [1,9] and [3,7] (both “square” or both “non-square” digits) tie so often, while the “mixed” pairs, which have to overcome the bias, tie less often.

2) Why triples are rare and a quadruple tie may never happen. A heuristic comes from random walks. A tie among k digits requires k − 1 differences to vanish simultaneously, which resembles a random walk in k − 1 dimensions returning to the origin. By Pólya’s theorem (1921), a random walk returns to the origin infinitely often in dimensions 1 and 2, but in dimension 3 it is transient: it returns only finitely many times, possibly never. This matches the table: hundreds of thousands to millions of ties for pairs (dimension 1), only between 15 and 86 for triples (dimension 2), and no quadruple tie (dimension 3) below 10^13. The Chebyshev bias, which tends to push 3 and 7 away from 1 and 9, makes a four-digit tie even less likely. Of course primes are not a random walk, and as far as I know nobody has proved or disproved the existence of a quadruple tie.

References:
A. Granville & G. Martin, “Prime Number Races”, Amer. Math. Monthly 113 (2006).
M. Rubinstein & P. Sarnak, “Chebyshev’s Bias”, Experimental Mathematics 3 (1994).





 








Records   |  Conjectures  |  Problems  |  Puzzles