Forget the Superbowl – here comes a giant Mersenne prime, all 17,425,170 digits of it!

If you’re a sports fan, you might have watched the Superbowl or the Stanley Cup with avidity. You might like other sporting codes, too.

For example, I’ve heard that there’s not much to beat the edge-of-the-seat excitement of a baseball fixture in which the pitcher shuts out the opposition and keeps them despondently hitless all night long, or the athletically coiffured thrill of a soccer match that ends in a nil-nil draw…

Unless you’re an armchair mathematics enthusiast.

It’s not always exciting, of course, following the cut-and-thrust of numeric calculation.

Often, there’s not much more to entertain you than a 16-clue sudoku, or one of those puzzles where John’s aunt is five years younger than half the age his great-grandmother was in the year of the Queen’s silver jubilee, and then take away the number you first thought of.

But once in a while, a really big prime number comes along – a prime number just crying out for a concession-stand hotdog with the works, washed down with a lukewarm beer in a plastic cup.

And recently, serial prime number finder Curtis Cooper, from the University of Central Missouri, came up with a cracker.

It’s not only the biggest prime number ever found, but it’s the biggest prime of a form that’s particularly dear to any computer geek’s heart: a Mersenne prime.

A Mersenne prime can be written in the form 2p−1, meaning that it’s a power of two, minus one. That’s the binary number consisting of 1 followed by p zeros, with one subtracted.

That, in turn, means it’s the binary number that consists of the bit 1 repeated p times.

Mersennes are denoted by M(p), where p is the power of 2 they’re one less than, or just as Mn, where n indicates the prime’s position in the pecking order.

The first Mersenne prime, M1, is pretty easy. M(2) = 22−1 = 3, which is indeed a prime number. (It must be the smallest Mersenne because the only prime smaller than 3 is 2, which can’t be a Mersenne because it’s even.)

Then you get 7 (1+2+4), 31 (1+2+4+8+16) and 127 (1+2+4+8+16+32+64).

M8, the eighth Mersenne, is M(31), or 231−1, which programmers will recognise as a friend, albeit a friend who lives life on the edge.

That’s the largest number you can represent in a signed 32-bit integer. Increment M8 on an x86 CPU and you may end up adding your way in to all sorts of trouble.

But Cooper’s latest Mersenne, M48, is in a league of its own, at 257885161−1.

Remember, that’s 57885161 binary digits long, which converts into a decimal number with 17,425,170 digits. (You can fit 3.3219 binary digits, near enough, into a decimal digit. That’s log210, in case you’re wondering.)

In its decimal expansion, the digit 3 is the most common, and 5 the least.

There’s no statistically significant bias, though, which is intriguing when you think that in binary, this number has no zero bits. Only 1s.

A count of decimal digit frequencies in the 48th known Mersenne Prime. Because we can.

Why Mersenne, you ask?

Mathematical nomenclature is steeped in irony (Fermat never proved his Last Theorem; Vigenere’s cipher was someone else’s; and Arabic numerals came from India, and that’s only a start).

Mersenne primes are no exception.

Marin Mersenne was a seventeenth-century French polymath: a monk, philosopher, theologian, music theorist, scientist and mathematician who speculated that 2p−1 was prime for p = 2, 3, 5, 7, 13, 17, 19, 31, 67, 127 and 257.

Indeed, he confidently (and imprudently, as it turned out) claimed that this list was exhaustive, at least for p ≤ 257.

And so they became known as Mersenne primes, even though it later transpired that M(67) and M(257) aren’t prime at all.

Worse still, Mersenne had missed M(61), M(89) and M(107), which are.

But Mersenne can be excused. There’s no way he could have checked the primality of 2257−1 by hand, so he had to go on intuition.

Even today, all we can say is that Curtis Cooper has found the 48th known Mersenne.

I referred to it casually above as M48. But is it really? Or could there be another Mersenne prime lurking between this one and M47, which is a mere 243112609−1?

In fact, according to the Great Internet Mersenne Prime Search (GIMPS), only the first 41 Mersennes truly qualify to be called M1..M41. From M42 to M48, we’re still unsure.

There may be others lurking in there that we simply haven’t found yet, just as Mersenne himself missed M(61), M(89) and M(107).

And that’s the sort of rollercoaster excitement you’re never going to reach by following sport.

Imagine if Superbowl XLVII turned out not to have been S47! Maybe the Minnesota Vikings really have won the championship after all, but we just don’t know it yet?

(Only kidding.)