In mathematics, a Mersenne number, named after Marin Mersenne, is a positive integer that is one less than a power of two:
Some definitions of Mersenne numbers require that the exponent p be prime.
A Mersenne prime is a Mersenne number that is prime. It is known that if 2^{p} − 1 is prime then p is prime so it makes no difference which Mersenne number definition is used. As of October 2009, only 47 Mersenne primes are known; the largest known prime number (2^{43,112,609} − 1) is a Mersenne prime.^{[1]} In modern times, the largest known prime has almost always been a Mersenne prime.^{[2]} Like several previouslydiscovered Mersenne primes, it was discovered by a distributed computing project on the Internet, known as the Great Internet Mersenne Prime Search (GIMPS). It was the first known prime number with more than 10 million base10 digits.
Contents 
Are there infinitely many Mersenne primes? 
Many fundamental questions about Mersenne primes remain unresolved. It is not even known whether the set of Mersenne primes is finite. The Lenstra–Pomerance–Wagstaff conjecture asserts that, on the contrary, there are infinitely many Mersenne primes and predicts their order of growth. It is also not known whether infinitely many Mersenne numbers with prime exponents are composite, although this would follow from widely believed conjectures about prime numbers, for example, the infinitude of Sophie Germain primes.
A basic theorem about Mersenne numbers states that in order for M_{p} to be a Mersenne prime, the exponent p itself must be a prime number. This rules out primality for numbers such as M_{4} = 2^{4} − 1 = 15: since the exponent 4 = 2×2 is composite, the theorem predicts that 15 is also composite; indeed, 15 = 3×5. The three smallest Mersenne primes are
While it is true that only Mersenne numbers M_{p}, where p = 2, 3, 5, … could be prime, often M_{p} is not prime even for a prime exponent p. The smallest counterexample is the Mersenne number
which is not prime, even though 11 is a prime number. The lack of an obvious rule to determine whether a given Mersenne number is prime makes the search for Mersenne primes an interesting task, which becomes difficult very quickly, since Mersenne numbers grow very rapidly. The Lucas–Lehmer primality test is an efficient primality test that greatly aids this task. The search for the largest known prime has somewhat of a cult following. Consequently, a lot of computer power has been expended searching for new Mersenne primes, much of which is now done using distributed computing.
Mersenne primes are used in pseudorandom number generators such as the Mersenne twister, Park–Miller random number generator, Generalized Shift Register and Fibonacci RNG.
The identity
shows that M_{p} can be prime only if p itself is prime—that is, the primality of p is necessary but not sufficient for M_{p} to be prime—which simplifies the search for Mersenne primes considerably. The converse statement, namely that M_{p} is necessarily prime if p is prime, is false. The smallest counterexample is 2^{11} − 1 = 2,047 = 23 × 89, a composite number.
Fast algorithms for finding Mersenne primes are available, and the largest known prime numbers as of 2009 are Mersenne primes.
The first four Mersenne primes M_{2} = 3, M_{3} = 7, M_{5} = 31 and M_{7} = 127 were known in antiquity. The fifth, M_{13} = 8191, was discovered anonymously before 1461; the next two (M_{17} and M_{19}) were found by Cataldi in 1588. After nearly two centuries, M_{31} was verified to be prime by Euler in 1772. The next (in historical, not numerical order) was M_{127}, found by Lucas in 1876, then M_{61} by Pervushin in 1883. Two more (M_{89} and M_{107}) were found early in the 20th century, by Powers in 1911 and 1914, respectively.
The best method presently known for testing the primality of Mersenne numbers is based on the computation of a recurring sequence, as developed originally by Lucas in 1856^{[3]}^{[4]} and improved by Lehmer in the 1930s, now known as the Lucas–Lehmer primality test. Specifically, it can be shown that (for p > 2) M_{p} = 2^{p} − 1 is prime if and only if M_{p} divides S_{p}_{−2}, where S_{0} = 4 and, for k > 0,
The search for Mersenne primes was revolutionized by the introduction of the electronic digital computer. Alan Turing searched for them on the Manchester Mark 1 in 1949.^{[5]} But the first successful identification of a Mersenne prime, M_{521}, by this means was achieved at 10:00 P.M. on January 30, 1952 using the U.S. National Bureau of Standards Western Automatic Computer (SWAC) at the Institute for Numerical Analysis at the University of California, Los Angeles, under the direction of Lehmer, with a computer search program written and run by Prof. R.M. Robinson. It was the first Mersenne prime to be identified in thirtyeight years; the next one, M_{607}, was found by the computer a little less than two hours later. Three more — M_{1279}, M_{2203}, M_{2281} — were found by the same program in the next several months. M_{4253} is the first Mersenne prime that is titanic, M_{44497} is the first gigantic, and M_{6,972,593} was the first megaprime to be discovered, being a prime with at least 1,000,000 digits.^{[6]} All three were the first known prime of any kind of that size.
In September 2008, mathematicians at UCLA participating in GIMPS won part of a $100,000 prize from the Electronic Frontier Foundation for their discovery of a very nearly 13milliondigit Mersenne prime. The prize, finally confirmed in October 2009, is for the first known prime with at least 10 million digits. The prime was found on a Dell OptiPlex 745 on August 23, 2008. This is the eighth Mersenne prime discovered at UCLA.^{[7]}
On April 12, 2009, a GIMPS server log reported that a 47th Mersenne prime had possibly been found. This report was apparently overlooked until June 4, 2009. The find was verified on June 12, 2009. The prime is 2^{42,643,801} − 1. Although it is chronologically the 47th Mersenne prime to be discovered, it is less than the largest known which was the 45th to be discovered.
Mersenne primes were considered already by Euclid, who found a connection with the perfect numbers. They are named after 17thcentury French scholar Marin Mersenne, who compiled a list of Mersenne primes with exponents up to 257. His list was only partially correct, as Mersenne mistakenly included M_{67} and M_{257} (which are composite), and omitted M_{61}, M_{89}, and M_{107} (which are prime). Mersenne gave little indication how he came up with his list,^{[8]} and its rigorous verification was completed more than two centuries later.
The table below lists all known Mersenne primes (sequence A000668 in OEIS):
#  p  M_{p}  Digits in M_{p}  Date of discovery  Discoverer 

1  2  3  1  5th century BC^{[9]}  Ancient Greek mathematicians 
2  3  7  1  5th century BC^{[9]}  Ancient Greek mathematicians 
3  5  31  2  3rd century BC^{[9]}  Ancient Greek mathematicians 
4  7  127  3  3rd century BC^{[9]}  Ancient Greek mathematicians 
5  13  8191  4  1456  anonymous ^{[10]} 
6  17  131071  6  1588  Cataldi 
7  19  524287  6  1588  Cataldi 
8  31  2147483647  10  1772  Euler 
9  61  2305843009213693951  19  1883  Pervushin 
10  89  618970019…449562111  27  1911  Powers 
11  107  162259276…010288127  33  1914  Powers^{[11]} 
12  127  170141183…884105727  39  1876  Lucas 
13  521  686479766…115057151  157  January 30, 1952  Robinson, using SWAC (computer) 
14  607  531137992…031728127  183  January 30, 1952  Robinson 
15  1,279  104079321…168729087  386  June 25, 1952  Robinson 
16  2,203  147597991…697771007  664  October 7, 1952  Robinson 
17  2,281  446087557…132836351  687  October 9, 1952  Robinson 
18  3,217  259117086…909315071  969  September 8, 1957  Riesel, using BESK 
19  4,253  190797007…350484991  1,281  November 3, 1961  Hurwitz, using IBM 7090 
20  4,423  285542542…608580607  1,332  November 3, 1961  Hurwitz 
21  9,689  478220278…225754111  2,917  May 11, 1963  Gillies, using ILLIAC II 
22  9,941  346088282…789463551  2,993  May 16, 1963  Gillies 
23  11,213  281411201…696392191  3,376  June 2, 1963  Gillies 
24  19,937  431542479…968041471  6,002  March 4, 1971  Tuckerman, using IBM 360/91 
25  21,701  448679166…511882751  6,533  October 30, 1978  Noll & Nickel, using CDC Cyber 174 
26  23,209  402874115…779264511  6,987  February 9, 1979  Noll 
27  44,497  854509824…011228671  13,395  April 8, 1979  Nelson & Slowinski 
28  86,243  536927995…433438207  25,962  September 25, 1982  Slowinski 
29  110,503  521928313…465515007  33,265  January 28, 1988  Colquitt & Welsh 
30  132,049  512740276…730061311  39,751  September 19, 1983^{[9]}  Slowinski 
31  216,091  746093103…815528447  65,050  September 1, 1985^{[9]}  Slowinski 
32  756,839  174135906…544677887  227,832  February 19, 1992  Slowinski & Gage on Harwell Lab Cray2^{[12]} 
33  859,433  129498125…500142591  258,716  January 4, 1994^{[13]}  Slowinski & Gage 
34  1,257,787  412245773…089366527  378,632  September 3, 1996  Slowinski & Gage^{[14]} 
35  1,398,269  814717564…451315711  420,921  November 13, 1996  GIMPS / Joel Armengaud^{[15]} 
36  2,976,221  623340076…729201151  895,932  August 24, 1997  GIMPS / Gordon Spence^{[16]} 
37  3,021,377  127411683…024694271  909,526  January 27, 1998  GIMPS / Roland Clarkson^{[17]} 
38  6,972,593  437075744…924193791  2,098,960  June 1, 1999  GIMPS / Nayan Hajratwala^{[18]} 
39  13,466,917  924947738…256259071  4,053,946  November 14, 2001  GIMPS / Michael Cameron^{[19]} 
40^{[*]}  20,996,011  125976895…855682047  6,320,430  November 17, 2003  GIMPS / Michael Shafer^{[20]} 
41^{[*]}  24,036,583  299410429…733969407  7,235,733  May 15, 2004  GIMPS / Josh Findley^{[21]} 
42^{[*]}  25,964,951  122164630…577077247  7,816,230  February 18, 2005  GIMPS / Martin Nowak^{[22]} 
43^{[*]}  30,402,457  315416475…652943871  9,152,052  December 15, 2005  GIMPS / Curtis Cooper & Steven Boone^{[23]} 
44^{[*]}  32,582,657  124575026…053967871  9,808,358  September 4, 2006  GIMPS / Curtis Cooper & Steven Boone^{[24]} 
45^{[*]}  37,156,667  202254406…308220927  11,185,272  September 6, 2008  GIMPS / HansMichael Elvenich^{[25]} 
46^{[*]}  42,643,801  169873516…562314751  12,837,064  April 12, 2009^{[**]}  GIMPS / Odd M. Strindmo 
47^{[*]}  43,112,609  316470269…697152511  12,978,189  August 23, 2008  GIMPS / Edson Smith^{[25]} 
^{ *} It is not known whether any undiscovered Mersenne primes exist between the 39th (M_{13,466,917}) and the 47th (M_{43,112,609}) on this chart; the ranking is therefore provisional. Primes are not always discovered in increasing order. For example, the 29th Mersenne prime was discovered after the 30th and the 31st. Similarly, the current record holder was followed by 2 smaller Mersenne primes, first 2 weeks later and then 8 months later.
^{ **} M_{42,643,801} was first found by a machine on April 12, 2009; however, no human took notice of this fact until June 4. Thus, either April 12 or June 4 may be considered the 'discovery' date. The discoverer, Strindmo, apparently used the alias Stig M. Valstad.
To help visualize the size of the 47th known Mersenne prime, it would require 3,461 pages to display the number in base 10 with 75 digits per line and 50 lines per page.^{[9]}
The factorization of a prime number is by definition the number itself. This section is about composite numbers. Mersenne numbers are very good test cases for the special number field sieve algorithm, so often the largest number factorized with this algorithm has been a Mersenne number. As of March 2007, 2^{1039} − 1 is the recordholder,^{[26]} after a calculation taking about a year on a couple of hundred computers, mostly at NTT in Japan and at EPFL in Switzerland. See integer factorization records for links to more information. The special number field sieve can factorize numbers with more than one large factor. If a number has only one very large factor then other algorithms can factorize larger numbers by first finding small factors and then making a primality test on the cofactor. As of 2010, the composite Mersenne number with largest proven prime factors is 2^{20887} − 1, which is known to have a factor p with 6229 digits that was proven prime with ECPP.^{[27]} The largest with probable prime factors allowed is 2^{684127} − 1 = 23765203727 × q, where q is a probable prime.^{[28]}
Mersenne primes are interesting to many for their connection to perfect numbers. In the 4th century BC, Euclid demonstrated that if M_{p} is a Mersenne prime then
is an even perfect number (which is also the M_{p}th triangular number). In the 18th century, Leonhard Euler proved that, conversely, all even perfect numbers have this form. It is unknown whether there are any odd perfect numbers, but it appears unlikely that there is one.
The binary representation of 2^{p} − 1 is the digit 1 repeated p times, for example, 2^{5} − 1 = 11111_{2} in the binary notation. A Mersenne number is therefore a repunit in base 2, and Mersenne primes are the base 2 repunit primes.
The base 2 representation of a Mersenne number shows the factorization pattern for composite exponent. For example:
In computer science, unsigned pbit integers can be used to express numbers up to M_{p}.
In the mathematical problem Tower of Hanoi, solving a puzzle with a pdisc tower requires at least M_{p} steps.
The asteroid with minor planet number 8191 is named 8191 Mersenne after Marin Mersenne, because 8191 is the fifth Mersenne prime.^{[29]} The asteroids with the previous four numbers corresponding to Mersenne primes (3 Juno, 7 Iris, 31 Euphrosyne, 127 Johanna) were already named after others.
