ҹ1000

Inside the race to find the first billion-digit prime number

Discovering giant prime numbers involves laborious trial and error, and they are of little use when they are found. For certain devotees, that's beside the point

numbers artwork

JON PACE had spent 14 years searching for a monster. A finance manager at FedEx in Memphis, Tennessee, he was more comfortable trawling through spreadsheets than hunting exotic beasts. He also happened to be one of the least well-equipped in the game, so he knew the odds were stacked against him. “I probably had a better chance of being struck by lightning,” he says.

But on 26 December 2017, Pace finally laid eyes on the object of his desire: the largest prime number then known, running to a whopping 23 million digits. It was so long that, printed out in two-point font, it could have easily filled a book.

In some ways, he needn’t have bothered. His discovery has virtually no practical value. So what has inspired Pace and hundreds of others to devote themselves to the (GIMPS), in which people scour the furthest reaches of the number line in search of enormous primes?

There is no one single answer. Not all the volunteers are numberphiles. Some get into it for the prize money offered for innovations in computing: $150,000 for the first 100-million digit prime. Others join the hunt to put their latest souped-up computer through its paces. For the most devoted, though, it is above all about the thrill of discovering something rare and beautiful, something nobody has ever seen before.

Primes, for those in need of a quick primer, are the numbers greater than 1 that are divisible only by 1 and themselves. The sequence begins 2, 3, 5, 7, 11, 13, 17 and goes on infinitely, as ancient Greek mathematician Euclid showed in a beautiful proof in around 300 BC. They are cherished as the fundamental building blocks from which all numbers are made, because any number that isn’t prime can be made by multiplying primes together.

What Pace found is not just any prime. It is in a special class known as the Mersenne primes, named after Marin Mersenne, a 17th-century French friar. Mersenne numbers are 1 less than a power of 2. They can be written in the form of 2n-1, which means the number is equal to n 2s multiplied together (where n can be any whole number), minus 1. Mersenne primes are Mersenne numbers that are also prime. So, for example, the number 3 is a Mersenne prime because it is 1 less than 22, which is 4. Seven is another because it is 1 less than 23.

The next few are 31, 127, 8191 and 131071, but they quickly get much rarer. We had found only 49 Mersenne primes before Pace snared the 50th, most succinctly written as 277232917-1. People call it M77232917 for short.

“When I first found out, I thought it was a joke,” says Pace. The computer that discovered it isn’t a powerful one. Pace built it himself for his local church, primarily for word processing, using a mid-market processor. But once the discovery was announced, even Pace’s children were impressed. “At first my kids were like ‘OK, dad’,” says Pace. “But when my son found out National Public Radio wanted to interview me, he suddenly thought it was cool.”

Part of the reason Mersenne primes are considered sufficiently beguiling to pique media interest is that they are closely related to perfect numbers: those numbers that are equal to the sum of all the positive numbers you can multiply together to produce them (excluding the number itself). The number 6, for example, is a perfect number because it is a product of 1 × 6 and 2 × 3, and 1 + 2 + 3 = 6. So is 28, because 1 + 2 + 4 + 7 + 14 = 28. Because every even perfect number can be generated from a Mersenne prime, the two sets of numbers are intimately connected.

There is also prize money at stake. Pace received $3000 for his discovery, which he gave to his church. But future prime hunters could earn a lot more. The Electronic Frontier Foundation, a technology-focused non-profit, is behind the $150,000 prize for anyone who discovers a prime with at least 100 million digits. It has also pledged $250,000 for a prime with over a billion digits.

The main reason Mersenne primes are attractive, however, is that they tend to be the largest primes we can find. That is because there is a particularly efficient way to test if a Mersenne number is prime. It was devised by French mathematician édouard Lucas, who in 1857, at the age of 15, used it to test whether the Mersenne number 2127-1 was prime.

M77232917 number
M77232917 is only the 50th Mersenne prime ever found
SPL

If you have a number like 7, the obvious way to check if it is prime is to look at whether it can be divided by the numbers below it. With huge numbers, however, that is a ridiculously laborious process. Lucas flipped it on its head. He identified a sequence of numbers with a remarkable property: if a Mersenne number can divide into another, larger number in that sequence, then the Mersenne is prime. This means you have one long calculation to make, instead of lots and lots of them.

Even so, the task was far from trivial. Lucas pulled it off by representing the Mersenne number in binary form on a 127 by 127 chessboard, with pawns for the 1s and empty squares for the 0s. By moving the pawns around, he could painstakingly carry out the division. It took him 19 years, presumably not full time. But eventually, Lucas had his result: M127 is indeed prime.

No one ever reproduced Lucas’s efforts. Indeed, he himself only performed the entire operation once. But US mathematician Derrick Henry Lehmer refined the method in the 1930s to create the Lucas-Lehmer test. It remains the simplest way to test if a Mersenne number is prime, and it formed the basis of the algorithms that brought the search for primes into the computer age. As computers grew faster and more powerful, the primes we discovered grew longer (see “Prime targets“). It wasn’t until George Woltman launched the collaborative GIMPS project in 1996 that the general public could get involved.

A programmer and prime lover, Woltman wanted everyone to have a chance at discovering giant primes. He rendered the algorithm so fast and efficient that it can run in the background on any relatively modern household computer with an internet connection. Then he worked with others to automate the selection and allocation of numbers to test, and the checking and reporting of results.

The fruit of this is a program so easy to use that hundreds of people have signed up for a stab at finding a record-breaking prime (see “How to become a number hunter“). “From the 1950s through to ’96, you had to own a supercomputer to have a chance to play the game,” says Woltman. “Not anymore.” The only thing you need, beyond a computer, is patience. The software will run on most machines, but on a typical home computer it takes roughly 14 days to test a potential Mersenne prime.

Number crunchers

Among the first to sign up to GIMPS was , a mathematician at the University of Central Missouri, who has been fascinated by primes since childhood. He wasn’t messing about. While many volunteers donate the spare processing power of their own computer, as the administrator for a whole campus, Cooper was able to recruit some 600 machines. That gave him a better chance than most. Sure enough, in 2005, after eight years of number crunching, Cooper’s army of machines discovered the 43rd Mersenne prime.

How to become a number hunter

To join the hunt for Mersenne primes, go to and set up an account. There, you can download a program called Prime95. It has versions for most types of computer. Once installed, it will run in the background, using any spare processing power. You won’t notice it. If your computer finds anything, you will get an email letting you know — and asking you to keep it under your hat until it is publicly announced.

Cooper has since found another three of them, the latest confirmed in 2016. The last of these had been calculated in 2013, but the automated system used by GIMPs to alert its volunteers failed so the discovery only came to light three years later, when the server’s administrator came across it during routine maintenance. “It was almost the lost prime,” says Cooper.

For him, each discovery is a moment to savour his place in the long tradition of prime hunters, from Euclid and Euler through to Lucas, whom he regards as an idol. “The fact that we do it on computers rather than by hand, as Lucas did, does sort of take the romance out of it,” he says. “But I figure there is a romance in the fact that pretty much anybody can do this now.”

Pace, who took the record for the largest prime from Cooper in 2018, echoes the sentiment. “I don’t have a huge amount of computing power,” he says. “Most of the computers I’ve volunteered are just ordinary desktop PCs. My mother is running this program on hers. She has no idea.”

It seems a good way to use otherwise wasted computing power. Considering that RSA encryption – one of the standard ways to keep your data safe online – requires your bank to come up with two big primes and multiply them together, finding new numbers for this might appear useful. Especially because it is the difficulty of factoring the resulting product that keeps hackers at bay. But the primes we already know are plenty big enough for the job, so the ones GIMPS is finding aren’t needed.

You might also think that identifying new, giant Mersenne primes could help us solve some perplexing mathematical riddles. But here too, a new prime is no help. It won’t weigh in on the twin primes conjecture, for example, which ventures that there are an infinite number of primes separated by 2, like 11 and 13. Nor will it prove the most famous conjecture associated with Mersenne primes, namely that there are infinitely many of them too. “It doesn’t answer the question ‘but is there another, even larger, Mersenne prime?’,” says Vicky Neale, a mathematician at the University of Oxford. In maths, proof comes not from observations but self-contained explanations based on mathematical logic, like the one Euclid devised for infinite primes.

GIMPS has thrown up one curiosity, though. The formula used to work out the distribution of primes along the number line predicted that there would be fewer than four between 220,000,000 and 285,000,000. But GIMPS has turned up 12. “Theoretically, life can be different the further out you go,” says Chris Caldwell, a mathematician at the University of Tennessee and long-time GIMPS volunteer. The implication is that we might find new mathematical patterns.

And the GIMPS software itself also happens to have its uses for people with no interest in numbers. It is sufficiently demanding that many volunteers use it to stress test their custom-built computers. Indeed, that is exactly what Patrick Laroche of Ocala, Florida, was doing late last year when one of his souped-up machines discovered the 51st Mersenne prime – the biggest yet. Laroche didn’t want to generate interest in the search for primes, preferring to keep a low profile. However, Woltman says Laroche had tested just four numbers before he struck gold.

But when it comes to the allure of giant primes, practical value is beside the point. Mathematicians treasure them because they are exquisite. Caldwell likes to compare Mersenne primes to giant diamonds. “Probably the most practical use for diamonds is diamond dust on blades and drills,” he says. “The same is true of primes. The small ones are used everywhere in encryption. But the really big ones, they’re museum pieces.”

“It took me 14 years and he found one in just four months. Can you believe it!”

The most devoted prime hunters see themselves as part of a collective enterprise, pushing out to the furthest reaches of the number line in search of these rare gems. Which probably explains why Pace is anything but exasperated by Laroche’s lucky break. “I was happy for him,” he says. “OK, it took me 14 years and he found one in just four months. Can you believe that! But I have tested thousands of candidates over the years, so every time a new prime is discovered I always feel I had a hand in it.”

Constant cravings

In November 2016, after 105 days of furious computation, Peter Trueb’s machine spat out a gigantic number. It was pi, the famous mathematical constant that roughly equals 3.14, but here it had been calculated to record-breaking precision: some 22.4 trillion digits after the decimal point.

A software developer in Zurich, Switzerland, Trueb is one of hundreds of people across the world who use a freely available computer program called y-cruncher to find record numbers of digits for various mathematical constants, from pi and Euler’s number to the golden ratio.

This form of number exploration relies heavily on computer power. Trueb, a lifelong pi enthusiast who is also , used his company’s resources to build a computer with 24 hard drives. Each contained 6 terabytes of memory, to store the whopping quantity of data generated by the calculations.

He was always likely to be outgunned eventually, however. Sure enough, his record was smashed this year by a Google developer from Japan, Emma Haruka Iwao, who used the tech giant’s cloud computing services to .

There is more serendipity involved in other forms of number exploration. Rather than pinning down the digits of a special number to extreme precision, these involve interrogating figures lurking in the furthest reaches of the number line to find those that are the rarest and most beautiful (see main story).

Article amended on 15 August 2019

We corrected the description of the predicted number of primes

Topics: algorithms / Mathematics / prime numbers