Researchers at Stanford University have made a breakthrough discovery on the behaviour of prime numbers, and it's shaking up the world of mathematics.

The mathematicians found that prime numbers aren't completely random as has been thought.

Instead, neighbouring prime numbers were found to avoid repeating their last digits.

Prime numbers can only end in one of four digits (apart from 2 and 5), and researchers have thought that these should each have an equal chance of appearing next in a given set.

Researchers at Stanford University have made a breakthrough discovery on the behaviour of prime numbers, and it's shaking up the world of mathematics. The mathematicians found that prime numbers aren't completely random as has been thought. Instead, neighbouring prime numbers were found to avoid repeating last digits

WHAT IS A PRIME NUMBER A prime number is a whole number that can only be divided by 1 and itself. Other than 2 and 5, prime numbers can only end in 1, 3, 7, or 9 Prime numbers stretch on infinitely, beginning 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 , 97 and so on. It's long been thought that the last digits in these numbers occur randomly, but a new study reveals this may not be the case. Advertisement

Now, researchers have found this is not the case.

Robert Lemke Oliver and Kannan Soundararajan describe their findings in a paper titled Unexpected Biases in the Distribution of Consecutive Primes.

As the name suggests, researchers were surprised to find somewhat of a pattern in the infinite expanse of prime numbers, which were long thought to be random.

A prime number is a whole number that can only be divided by 1 and itself. Other than 2 and 5, prime numbers can only end in 1, 3, 7, or 9.

So, if a given prime number ends in a '1,' there should be a 25 percent chance that the next prime number also ends in '1.'

But, the researchers examined several trillion prime numbers, and found the distribution of these last digits is not as expected.

In the first several million prime numbers, those ending in '1' were followed by another prime number ending in '1' just 18.5 percent of the time.

A prime number is a whole number that can only be divided by 1 and itself. Other than 2 and 5, prime numbers can only end in 1, 3, 7, or 9. But, the researchers examined several trillion prime numbers, and found the distribution of these last digits is not as expected

Prime numbers ending in '3' or '7,' however, were followed by a '1' 30 percent of the time, and those ending in '9' were followed by '1' 22 percent of the time.

As numbers became further apart, the last digits occurred with a more random distribution.

The researchers aren't quite sure why this happens, but they've based their explanation on something known as the Hardy-Littlewood prime k-tuples conjecture.

By this conjecture predicts the frequency in which pairs of primes, triples, and larger groups of prime numbers appear – but, it hasn't yet been proven.