Mersenne Prime Checker
Test whether 2ⁿ − 1 is a Mersenne prime for a given exponent n.
About Mersenne Prime Checker
A Mersenne prime is a prime number of the form Mₙ = 2ⁿ − 1. A necessary (but not sufficient) condition is that n itself is prime. Known Mersenne prime exponents include 2, 3, 5, 7, 13, 17, 19, 31, 61. Primality here is decided by the Lucas–Lehmer test, which settles Mₙ in n − 2 exact modular squarings; the n ≤ 61 cap is so that 2ⁿ − 1 (up to ≈ 2.3×10¹⁸) can still be shown in full.
Formula
Mersenne number
M(n) = 2^n − 1
- n
- Exponent (must be prime for M(n) to possibly be prime)
Worked example
With the default values below, Mersenne Prime Checker returns Is Mersenne Prime? of Yes. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Exponent (n)accepts 2–61
- 7
Results
- Is Mersenne Prime?
- Yes
- 2ⁿ − 1
- 127
- Is Exponent Prime?
- Yes
Step by step
- 1Mersenne number
- 2Exponent prime?= Yes (required)
- 3M(n) prime?= Yes — Mersenne prime!
Assumptions and limits
- The result is derived only from the single input listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why must the exponent be prime?
If n = a × b with a,b > 1, then 2ⁿ − 1 is divisible by 2ᵃ − 1, so it cannot be prime. Therefore n must be prime — but that alone is not sufficient (e.g. M(11) = 2047 = 23 × 89).
What are the known Mersenne primes?
As of 2024, 51 Mersenne primes are known. The smallest exponents are 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, … The largest known prime is always a Mersenne prime.
