Mathematicians find a peculiar pattern in primes

Final digit in consecutive numbers is not as random as expected

prime numbers

PRIME TIME  Prime numbers are loathe to repeat the final digit of the prime that precedes them, a bias that has mathematicians scratching their heads.

Chris/Flickr (CC BY-NC-SA 2.0

Prime numbers, divisible only by 1 and themselves, hate to repeat themselves. They prefer not to mimic the final digit of the preceding prime, mathematicians have discovered.

“It is really, really bizarre,” says Stanford University postdoctoral researcher Robert Lemke Oliver, who, with Stanford number theorist Kannan Soundararajan, discovered this unusual prime predilection. “We are still trying to understand what is at the heart of this,” Lemke Oliver says.

Generally speaking, primes are thought to behave much like random numbers. So whenever some kind of order is revealed, it gives mathematicians pause.

“Any regularity you can show about primes is beguiling, because there may lurk there some new structure,” says number theorist Barry Mazur of Harvard University. “Revealing some bit of architecture where we thought there was none may lead to inroads into the structure of the mathematics.”

Once primes get into the double digits, they must end in either a 1, 3, 7 or 9. Mathematicians have long known that there are roughly the same number of primes ending with each digit; each appears as the final number about 25 percent of the time. The prime number theorem in arithmetic progressions proved this distribution about 100 years ago, and the still unsolved Riemann hypothesis predicts that the rates rapidly approach 25 percent. This property has been tested for many millions of primes, says Soundararajan.

And without any reason to think otherwise, mathematicians just assumed that the distribution of those final digits was basically random. So given a prime that ends in 1, the odds that the next prime ends in 1, 3, 7 or 9 should be roughly equal.

“If there’s no interaction between primes, that’s what you would expect,” says Soundararajan. “But in fact, something funny happens.”  

Despite each final digit appearing roughly the same amount of the time, there’s a bias in the order in which these final digits appear. A prime that ends in 7, for example, is far less likely to be followed by a prime that also ends in 7 than a prime that ends in 9, 3 or 1.  

The discovery of the final digit bias has “no conceivable practical use,” says Andrew Granville, a number theorist at the University of Montreal and University College London. “The point is the wonder of the discovery.”

The peculiar pattern had been noted previously by two separate teams of researchers, but the Stanford duo is the first to articulate a mathematical explanation for the pattern, which they posted online March 11 at arXiv.org. When the researchers crunched the numbers, their predictions based on the hypotheses fit the results remarkably, says Granville, who calls the work “rigorous, refined and delicate.”

You might think this “anti-sameness” bias follows naturally from the order of numbers. After all, 67 is followed by 71, which is followed by 73. But this explanation doesn’t fit the data, says Lemke Oliver, who ran computer calculations out to 400 billion primes.“The bias is way too large,” he says. What’s more, the bias isn’t equal for the nonrepeating final digits. So among the first hundred million primes, for example, a prime that ends in 3 is followed by a prime that ends in 9 about 7.5 million times, whereas it is followed by a prime that ends in 1 about 6 million times. A final 3 is followed by a final 3 a mere 4.4 million times.

Yet as the number of primes approaches infinity, the bias slowly disappears. This restoration of seeming randomness makes sense mathematically, but the slow rate at which the bias disappears is notable.   

“It would almost be perverse if it didn’t even out,” says Lemke Oliver. “It would bother me a little.”