Mathematicians are pretty obsessed with prime numbers – those elusive integers that can only be divided by one and themselves. If they’re not creating cool artworks with them or finding them in nature, they’re using computers to discover increasingly larger primes. But now a group of researchers has found a strange property of primes that’s never been seen before, and it violates one of the fundamental assumptions about how they behave – the idea that, for the most part, they occur totally randomly across integers.

The pattern isn’t actually found within the primes themselves, but rather the final digit of the prime number that comes directly after them – which the mathematicians have shown isn’t as random as you’d expect, and that’s a pretty big deal for mathematicians.

“We’ve been studying primes for a long time, and no one spotted this before,” Andrew Granville, a number theorist at the University of Montreal who wasn’t involved in the study, told Quanta magazine. “It’s crazy.”So what are we talking about here? Our current understanding of primes suggests that, over a big enough sample, they should occur randomly, and shouldn’t be influenced by the prime number that comes before or after them.

But that’s not what Kannan Soundararajan and Robert Lemke Oliver from Stanford University in California found. They performed a randomness check on the first 100 million primes and found that a prime ending in 1 was followed by another prime ending in 1 only 18.5 percent of the time – a far cry from the 25 percent you’d expect given that primes greater than five can only end in one of four digits: 1, 3, 7, or 9.Furthermore, the chance of a prime ending in 1 being followed by a prime ending in 3 or 7 was roughly 30 percent, but for 9 it was only 22 percent.In other words, the primes “really hate to repeat themselves”, said Lemke Oliver.

The obvious explanation for this is the fact that numbers have to cycle through all the other digits before they get back to the same ending. “For example, 43 is followed by 47, 49, and 51 before it hits 53, and one of those numbers, 47, is prime,” writes Jacob Aron for New Scientist. More here: *Mathematicians have discovered a strange pattern hiding in prime numbers*