Mathwords logoMathwords

Mersenne Prime — Definition, Formula & Examples

A Mersenne prime is a prime number that can be written in the form 2p12^p - 1, where pp itself is a prime number. For example, 231=72^3 - 1 = 7 is a Mersenne prime, while 2111=2047=23×892^{11} - 1 = 2047 = 23 \times 89 is not.

A Mersenne prime is a prime number Mp=2p1M_p = 2^p - 1 for some prime pp. Not every prime exponent pp yields a prime; MpM_p is called a Mersenne number regardless of primality, and a Mersenne prime only when MpM_p is itself prime.

Key Formula

Mp=2p1M_p = 2^p - 1
Where:
  • MpM_p = The Mersenne number associated with exponent p
  • pp = A prime number used as the exponent

How It Works

To check whether a number is a Mersenne prime, first confirm the exponent pp is prime — if pp is composite, then 2p12^p - 1 is guaranteed to be composite. Then test whether 2p12^p - 1 is prime. For small exponents you can factor directly, but for large ones, the Lucas–Lehmer test provides an efficient method. The Great Internet Mersenne Prime Search (GIMPS) has used this test to discover the largest known primes, all of which are Mersenne primes.

Worked Example

Problem: Determine which of the exponents p = 2, 3, 5, 7, 11 produce Mersenne primes.
p = 2: Compute the Mersenne number and check primality.
M2=221=3(prime ✓)M_2 = 2^2 - 1 = 3 \quad \text{(prime ✓)}
p = 3: Compute and check.
M3=231=7(prime ✓)M_3 = 2^3 - 1 = 7 \quad \text{(prime ✓)}
p = 5: Compute and check.
M5=251=31(prime ✓)M_5 = 2^5 - 1 = 31 \quad \text{(prime ✓)}
p = 7: Compute and check.
M7=271=127(prime ✓)M_7 = 2^7 - 1 = 127 \quad \text{(prime ✓)}
p = 11: Compute and factor.
M11=2111=2047=23×89(not prime ✗)M_{11} = 2^{11} - 1 = 2047 = 23 \times 89 \quad \text{(not prime ✗)}
Answer: The exponents 2, 3, 5, and 7 produce Mersenne primes (3, 7, 31, 127). The exponent 11 does not, since 2047 is composite.

Why It Matters

Mersenne primes are central to the search for the largest known prime numbers — as of 2024, every record-holding prime is a Mersenne prime. They also connect to perfect numbers: every even perfect number has the form 2p1(2p1)2^{p-1}(2^p - 1) where 2p12^p - 1 is a Mersenne prime. This link makes them a key topic in any number theory course.

Common Mistakes

Mistake: Assuming every prime exponent p produces a Mersenne prime.
Correction: A prime exponent is necessary but not sufficient. For instance, p = 11 is prime, yet 2^11 − 1 = 2047 = 23 × 89 is composite. You must verify the primality of 2^p − 1 separately.