No Login Data Private Local Save

Mersenne Prime Checker - Online 2^p‑1 Validation

10
0
0
0

Mersenne Prime Checker

Validate 2p − 1 primes using the Lucas–Lehmer primality test

p =
Quick picks:
If p is composite, 2p−1 is definitely composite. Lucas–Lehmer test runs only for prime p.
Known Mersenne Primes
#p (Exponent)Mersenne Prime (2p−1)Digits
1231
2371
35312
471273
51381914
6171310716
7195242876
831214748364710
961230584300921369395119
1089618970019642...13744956211127
11107162259276829...57801028812733
12127170141183460...71588410572739
13521686479766013...291115057151157
14607531137992816...219031728127183
151279104079321946...703168729087386
162203147597991521...686697771007664
172281446087557183...418132836351687
183217259117086013...362909315071969
194253190797007524...8153504849911281
204423285542542228...9026085806071332

51 Mersenne primes are known as of 2024. The largest is M82589933 with 24,862,048 digits, discovered in December 2018 by GIMPS.

Frequently Asked Questions
A Mersenne prime is a prime number that can be written in the form Mp = 2p − 1, where p is itself a prime number. They are named after the French monk Marin Mersenne who studied them in the 17th century. Not all values of prime p yield a Mersenne prime — for example, p=11 gives 2047 = 23 × 89, which is composite.
The Lucas–Lehmer primality test is a deterministic algorithm specifically for Mersenne numbers. For an odd prime p, define the sequence: s0 = 4, and si = si−12 − 2 (mod Mp). Mp is prime if and only if sp−2 ≡ 0 (mod Mp). This test is remarkably efficient — it runs in O(p² log p) time — making it the standard method for verifying Mersenne primes.
No. While p being prime is a necessary condition for Mp to be prime, it is not sufficient. If p is composite, then 2p−1 is definitely composite. However, many prime p values produce composite Mersenne numbers. The first counterexample is p=11: 211−1 = 2047 = 23 × 89. Other examples include p=23, p=29, and p=37.
As of 2024, there are 51 known Mersenne primes. The largest is M82589933, discovered in December 2018 by the GIMPS (Great Internet Mersenne Prime Search) project. It has 24,862,048 decimal digits and is also the largest known prime number overall. It is widely believed that there are infinitely many Mersenne primes, though this remains unproven.
GIMPS (Great Internet Mersenne Prime Search) is a collaborative distributed computing project where volunteers worldwide contribute their computers' processing power to search for new Mersenne primes. Founded in 1996, GIMPS has discovered the last 17 Mersenne primes. Anyone can participate by downloading the free Prime95 software from mersenne.org.
Mersenne primes have several important applications: they are used in pseudorandom number generators (like the Mersenne Twister), in cryptography for testing primality of large numbers, and in error-correcting codes. Historically, the search for Mersenne primes has also driven advances in distributed computing, algorithm design, and computer hardware testing. The largest known prime number has almost always been a Mersenne prime for the past century.
Yes, for small exponents. This online tool uses the Lucas–Lehmer test implemented in JavaScript with BigInt arithmetic, which works well for p up to about 5,000–10,000. For larger exponents (like those used in GIMPS), specialized software like Prime95 using Fast Fourier Transforms and optimized assembly is required — a single test for p ≈ 100,000,000 can take weeks on a consumer PC. This tool is best suited for educational purposes and verifying smaller Mersenne primes.
The Mersenne Twister is a widely-used pseudorandom number generator (PRNG) named after its period length, which is a Mersenne prime: 219937 − 1. Developed in 1997, it is the default PRNG in many programming languages including Python, Ruby, and R. Despite its name, the algorithm itself is not directly related to Mersenne prime discovery — it simply uses a Mersenne prime as its period length for excellent statistical properties.

Powered by the deterministic Lucas–Lehmer primality test | JavaScript BigInt arithmetic

For large exponents (p > 10,000), consider using GIMPS with Prime95 for production-grade verification.