Two academics have shocked themselves and the world of mathematics by discovering a pattern in prime numbers.

Primes - numbers greater than 1 that are divisible only by themselves and 1 – are considered the ‘building blocks’ of mathematics, because every number is either a prime or can be built by multiplying primes together - (84, for example, is 2x2x3x7).

Their properties have baffled number theorists for centuries, but mathematicians have usually felt safe working on the assumption they could treat primes as if they occur randomly.

We’ll tell you what’s true. You can form your own view. From 15p €0.18 $0.18 $0.27 a day, more exclusives, analysis and extras.

Now, however, Kannan Soundararajan and Robert Lemke Oliver of Stanford University in the US have discovered that when it comes to the last digit of prime numbers, there is a kind of pattern.

Apart from 2 and 5, all prime numbers have to end in 1, 3, 7 or 9 so that they can’t be divided by 2 or 5. So if the numbers occurred randomly as expected, it wouldn’t matter what the last digit of the previous prime was. Each of the four possibilities – 1, 3, 7, or 9 – should have an equal 25 per cent (one in four) chance of appearing at the end of the next prime number.

But after devising a computer programme to search for the first 400 billion primes, the two mathematicians found prime numbers tend to avoid having the same last digit as their immediate predecessor – as if, in the words of Dr Lemke Oliver they “really hate to repeat themselves.”

Shape Created with Sketch. 8 of the very hardest maths puzzles Show all 8 left Created with Sketch. right Created with Sketch. Shape Created with Sketch. 8 of the very hardest maths puzzles 1/8 Crossing the bridge Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 minute, 2 minutes, 7 minutes, and 10 minutes. What is the shortest time needed for all four of them to cross the bridge? Claire Backhouse/flickr/Creative Commons 2/8 Number magic If you multiply me by 2, subtract 1, and read the reverse the result you’ll find me. Which numbers can I be? Dustin Liebenow/flickr/Creative Commons 3/8 One thousand monkeys A very big building in which one thousand monkeys are living is lighted by one thousand lamps. Every lamp is connected to a unique on/off switch, which are numbered from 1 to 1000. At some moment, all lamps are switched off. But because it is becoming darker, the monkeys would like to switch on the lights. They will do this in the following way: Monkey 1 presses all switches that are a multiple of 1 Monkey 2 presses all switches that are a multiple of 2 Monkey 3 presses all switches that are a multiple of 3 Monkey 4 presses all switches that are a multiple of 4 Etc., etc. How many lamps are switched on after monkey 1000 pressed his switches? And which lamps are switched on? Buddhika Weerasinghe/Getty Images 4/8 School lockers A high school has a strange principal. On the first day, he has his students perform an odd opening day ceremony: There are one thousand lockers and one thousand students in the school. The principal asks the first student to go to every locker and open it. Then he has the second student go to every second locker and close it. The third goes to every third locker and, if it is closed, he opens it, and if it is open, he closes it. The fourth student does this to every fourth locker, and so on. After the process is completed with the thousandth student, how many lockers are open? Brett Levin/flickr/Creative Commons 5/8 One bulb, three switches You have three switches in a room. One of them is for a bulb in next room. You cannot see whether the bulb is on or off until you enter the room. What is the minimum number of times you need to go in to the room to determine which switch corresponds to the bulb in next room? JOEL SAGET/AFP/Getty Images 6/8 Cheryl's birthday Albert and Bernard just become friends with Cheryl, and they want to know when her birthday is. Cheryl gives them a list of 10 possible dates: May 15, May 16, May 19, June 17, June 18, July 14, July 16, August 14, August 15, and August 17 Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively. Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard does not know too. Bernard: At first I don’t know when Cheryl’s birthday is, but I know now. Albert: Then I also know when Cheryl's birthday is. So when is Cheryl’s birthday? Jessica Diamond/flickr/Creative Commons 7/8 Sunday's child Recently, somebody said: “My grandfather was born on the first Sunday of the year. His seventh birthday was also on a Sunday.” In which year was said grandfather born? Will Clayton/flickr/Creative Commons 8/8 Probability of having boy In a country where everyone wants a boy, each family continues having babies until they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same). WALTRAUD GRUBITZSCH/AFP/Getty Images 1/8 Crossing the bridge Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 minute, 2 minutes, 7 minutes, and 10 minutes. What is the shortest time needed for all four of them to cross the bridge? Claire Backhouse/flickr/Creative Commons 2/8 Number magic If you multiply me by 2, subtract 1, and read the reverse the result you’ll find me. Which numbers can I be? Dustin Liebenow/flickr/Creative Commons 3/8 One thousand monkeys A very big building in which one thousand monkeys are living is lighted by one thousand lamps. Every lamp is connected to a unique on/off switch, which are numbered from 1 to 1000. At some moment, all lamps are switched off. But because it is becoming darker, the monkeys would like to switch on the lights. They will do this in the following way: Monkey 1 presses all switches that are a multiple of 1 Monkey 2 presses all switches that are a multiple of 2 Monkey 3 presses all switches that are a multiple of 3 Monkey 4 presses all switches that are a multiple of 4 Etc., etc. How many lamps are switched on after monkey 1000 pressed his switches? And which lamps are switched on? Buddhika Weerasinghe/Getty Images 4/8 School lockers A high school has a strange principal. On the first day, he has his students perform an odd opening day ceremony: There are one thousand lockers and one thousand students in the school. The principal asks the first student to go to every locker and open it. Then he has the second student go to every second locker and close it. The third goes to every third locker and, if it is closed, he opens it, and if it is open, he closes it. The fourth student does this to every fourth locker, and so on. After the process is completed with the thousandth student, how many lockers are open? Brett Levin/flickr/Creative Commons 5/8 One bulb, three switches You have three switches in a room. One of them is for a bulb in next room. You cannot see whether the bulb is on or off until you enter the room. What is the minimum number of times you need to go in to the room to determine which switch corresponds to the bulb in next room? JOEL SAGET/AFP/Getty Images 6/8 Cheryl's birthday Albert and Bernard just become friends with Cheryl, and they want to know when her birthday is. Cheryl gives them a list of 10 possible dates: May 15, May 16, May 19, June 17, June 18, July 14, July 16, August 14, August 15, and August 17 Cheryl then tells Albert and Bernard separately the month and the day of her birthday respectively. Albert: I don’t know when Cheryl’s birthday is, but I know that Bernard does not know too. Bernard: At first I don’t know when Cheryl’s birthday is, but I know now. Albert: Then I also know when Cheryl's birthday is. So when is Cheryl’s birthday? Jessica Diamond/flickr/Creative Commons 7/8 Sunday's child Recently, somebody said: “My grandfather was born on the first Sunday of the year. His seventh birthday was also on a Sunday.” In which year was said grandfather born? Will Clayton/flickr/Creative Commons 8/8 Probability of having boy In a country where everyone wants a boy, each family continues having babies until they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same). WALTRAUD GRUBITZSCH/AFP/Getty Images

A prime ending in 1 was followed by a prime ending in 1 only 18.5 per cent of the time, significantly less often than the expected 25 per cent. And, the pair found, primes ending in 3 tended be followed by primes ending in 9 more often than in 1 or 7.

The pattern - already being referred to as ‘the conspiracy among primes’ - has left mathematicians amazed that it could have remained undiscovered for so long. “I was floored,” Ken Ono, a number theorist at Emory University in Atlanta, told Quanta Magazine. “I have to rethink how I teach my class in analytic number theory now.”

Professor Soundararajan himself admitted to New Scientist: “It was very weird. It’s like some painting you are very familiar with, and then suddenly you realise there is a figure in the painting you’ve never seen before.”

Professor Soundararajan’s friend Professor Andrew Granville, of University College, London, told The Independent that the Stanford man’s surprise was such that he initially doubted his own discovery. “He asked me to ‘look over’ his paper four weeks ago, which is code for ‘Am I kidding myself, or have I discovered something?’” Professor Granville added: “He did ask me in November whether I would believe anything like this. Apparently, I looked at him as if he was crazy.”

The two US-based academics argue that the last-digit pattern they have discovered could be explained by the k-tuple conjecture, devised in the early 20th Century to predict how groupings of primes will appear. They also point out that as primes stretch to infinity, they eventually lose the last-digit pattern and start to appear in a random manner.

We’ll tell you what’s true. You can form your own view.

At The Independent, no one tells us what to write. That’s why, in an era of political lies and Brexit bias, more readers are turning to an independent source. Subscribe from just 15p a day for extra exclusives, events and ebooks – all with no ads.

Subscribe now