Puzzled By T-SQL Blog

# Largest Known Prime and the Great Internet Mersenne Prime Search

Prime numbers fascinated people for centuries and still do. This basic concept of an integer greater than 1 and divisible only by 1 and itself is so intriguing that some spent a big part of their career studying primes. Thanks to Euclid we know that there’s an infinite number of prime numbers, but we still don’t have any formula to produce the nth prime. So every time a new largest known prime is discovered it’s an exciting event in the scientific community. Now, I’m neither a scientist nor a mathematician—I’m just a guy who likes writing SQL queries—still, I’m fascinated with primes, as a hobby out of curiosity.

So how big is the largest known prime? At the date of this writing, the largest known prime is the Mersenne prime (meaning, it can be expressed in the form of 2^n - 1): 2^43112609 - 1, discovered Aug 23rd, 2008. That’s a truly extraordinarily large number. Expressed in decimal base, it has 12,978,189 digits. To get a perspective, let’s calculate how long the number would be if written in one line with an average font size. Say we can fit about 5 digits per centimeter (about 15 digits per inch). This would make the length of our number about 26 kilometers (about 16 miles)!

You probably wonder how such a large prime number was discovered. The discovery of this as well as several other Mersenne primes was made by the Great Internet Mersenne Prime Search (GIMPS) program. It’s a cooperative effort of a network of computers, each having an application installed locally, crunching prime numbers, and communicating with a central server that assigns the tasks. Anyone with a computer can join the effort; details in the GIMPS website.

I should add a disclaimer—as you can imagine, crunching potential prime numbers will fully utilize your CPUs. This program is configured to run by default with the lowest worker priority possible, meaning that if you run other tasks on the computer, they will get higher priority. Still, when crunching those potential primes your CPUs will be at full utilization. This means that you will probably be able to use your computer as an alternative to a small heater in the room, and it will be noticeable in your electricity bill. Also, if you’re energy green, and it’s more important for you to save the world than finding the next largest known prime, you would probably rather not run this program. ;)

I’m running this program on my home laptop. It’s an Alienware M15x with a Core i7 processor (Quad with Hyperthreading). So I have 8 logical CPUs, crunching 8 potentials for record breaking primes. Here’s a picture of my laptop at work (left of screen shows Task Manager with the 8 logical CPUs at 100 percent utilization, and right of screen is the Primes95 application at work on 8 potentials):

Hard to see, but the top right window says that the estimated finish time to check the 8 primes is Oct 14, 2010. Fingers crossed; hope to have good news to report in three months.

Cheers,

BG