Skip to main content

Mersenne Prime Finder

Solve mersenne prime problems step-by-step with our free calculator. See formulas, worked examples, and clear explanations.

Skip to calculator
Mathematics

Mersenne Prime Finder

Find and verify Mersenne primes of the form 2^p - 1. Explore Mersenne numbers, their connection to perfect numbers, and search for Mersenne primes within any exponent range.

Last updated: December 2025Reviewed by NovaCalculator Mathematics Team

Calculator

Adjust values & calculate
2^17 - 1
M(17) = 2^17 - 1
131,071
MERSENNE PRIME
Exponent Prime?
Yes
Digit Count
6
Perfect Number
8,589,869,056

Mersenne Numbers (prime exponents 2-31)

2^2 - 1
3PRIME
2^3 - 1
7PRIME
2^5 - 1
31PRIME
2^7 - 1
127PRIME
2^11 - 1
2,047composite
2^13 - 1
8,191PRIME
2^17 - 1
131,071PRIME
2^19 - 1
524,287PRIME
2^23 - 1
8,388,607composite
2^29 - 1
536,870,911composite
2^31 - 1
2,147,483,647PRIME
Mersenne Primes Found in Range
8
Your Result
M(17) = 131,071 | MERSENNE PRIME
Share Your Result
Understand the Math

Formula

M(p) = 2^p - 1

A Mersenne number M(p) equals 2 raised to the power p minus 1. When both p is prime and M(p) is prime, M(p) is called a Mersenne prime. The associated even perfect number is 2^(p-1) * M(p).

Last reviewed: December 2025

Worked Examples

Example 1: Verifying M17 = 2^17 - 1 is Prime

Check whether 2^17 - 1 = 131,071 is a Mersenne prime.
Solution:
First confirm 17 is prime: not divisible by 2, 3, or any prime up to sqrt(17) = 4.12. 2^17 - 1 = 131,071 Check divisibility by primes up to sqrt(131071) = 362. No prime factor found, confirming 131,071 is prime. Associated perfect number: 2^16 * 131,071 = 8,589,869,056
Result: M17 = 131,071 is a Mersenne prime | Perfect number: 8,589,869,056

Example 2: Showing M11 = 2^11 - 1 is NOT Prime

Test whether 2^11 - 1 = 2,047 is a Mersenne prime despite 11 being prime.
Solution:
2^11 - 1 = 2,047 Check divisibility: 2047 / 23 = 89 So 2047 = 23 * 89, which is composite. Note: The factor 23 = 2 * 11 + 1, illustrating that factors of Mersenne numbers 2^p - 1 must be of the form 2kp + 1.
Result: M11 = 2,047 = 23 * 89 is NOT a Mersenne prime
Expert Insights

Background & Theory

The Mersenne Prime Finder applies the following established principles and formulas. Mathematics rests on a hierarchy of number systems, each extending the previous. The natural numbers (1, 2, 3, ...) support counting and ordering. The integers add negative values and zero, enabling subtraction without restriction. The rational numbers, expressible as p/q where p and q are integers and q is nonzero, close the system under division. The real numbers fill the gaps left by irrationals such as the square root of 2 or pi, forming a complete ordered field. The complex numbers, written as a + bi where i is the square root of negative one, complete the algebraic closure of the reals and allow every polynomial to have a root. Prime factorization states that every integer greater than one is uniquely expressible as a product of primes, a result known as the Fundamental Theorem of Arithmetic. Computing the greatest common divisor (GCD) of two integers relies most efficiently on the Euclidean algorithm: repeatedly replace the larger number with the remainder when it is divided by the smaller, until the remainder is zero. The last nonzero remainder is the GCD. The least common multiple (LCM) follows from the identity LCM(a, b) = |a * b| / GCD(a, b). Modular arithmetic defines equivalence classes of integers that share the same remainder under division by a modulus n. Fermat's Little Theorem and Euler's Theorem arise from this structure and underpin modern cryptography. Logarithms are the inverses of exponential functions. If b raised to the power x equals y, then the logarithm base b of y equals x. The natural logarithm uses base e, approximately 2.71828. Combinatorics counts arrangements and selections. The number of ordered arrangements (permutations) of r objects from n distinct objects is nPr = n! / (n - r)!. The number of unordered selections (combinations) is nCr = n! / (r! * (n - r)!). Pascal's triangle arranges these binomial coefficients so that each entry equals the sum of the two entries directly above it. The Fibonacci sequence, defined by F(1) = 1, F(2) = 1, and F(n) = F(n-1) + F(n-2), appears throughout nature and connects deeply to the golden ratio via Binet's formula.

History

The history behind the Mersenne Prime Finder traces back through the following developments. Mathematics as a systematic discipline traces to ancient Mesopotamia. Babylonian clay tablets dating to around 1800 BCE demonstrate knowledge of quadratic equations, Pythagorean triples, and base-60 arithmetic, suggesting a practical mathematical tradition far preceding Greek formalism. Euclid of Alexandria compiled the Elements around 300 BCE, establishing the axiomatic method that would define rigorous mathematics for over two thousand years. His work organized plane geometry, number theory, and proportion into logically chained propositions derived from a small set of postulates. The algorithm bearing his name for computing GCDs appears in Book VII and remains in use today. In the 9th century, the Persian scholar Muhammad ibn Musa Al-Khwarizmi wrote Al-Kitab al-mukhtasar fi hisab al-jabr wal-muqabala, the treatise whose title gave algebra its name. He systematized the solution of linear and quadratic equations and described procedures that operated on unknowns as objects, a conceptual leap away from purely numerical calculation. Rene Descartes introduced coordinate geometry in 1637 by uniting algebra and Euclidean geometry, allowing curves to be studied through equations. This synthesis set the stage for calculus. Isaac Newton and Gottfried Wilhelm Leibniz independently developed calculus during the 1660s and 1670s, triggering a priority dispute that lasted decades and divided British and Continental mathematicians. Carl Friedrich Gauss proved the Fundamental Theorem of Algebra in 1799, showing that every nonconstant polynomial has at least one complex root. His Disquisitiones Arithmeticae of 1801 established modern number theory. David Hilbert's formalist program at the turn of the 20th century sought to place all of mathematics on an explicit axiomatic foundation, a project that Kurt Godel's incompleteness theorems of 1931 showed to be fundamentally limited. Alan Turing's work in the 1930s on computability introduced the theoretical model of the stored-program computer and linked mathematical logic directly to the limits of algorithmic calculation. His proof that no algorithm can decide in general whether an arbitrary program will halt or run forever placed fundamental boundaries on what mathematics can mechanically determine, and it opened the discipline now known as theoretical computer science.

Share this calculator

Explore More

Frequently Asked Questions

A Mersenne prime is a prime number that can be written in the form 2^p - 1, where p itself must also be a prime number. They are named after the French monk Marin Mersenne, who studied them in the 17th century. Mersenne primes are important because they are deeply connected to perfect numbers through the Euclid-Euler theorem, and they hold records as the largest known prime numbers. The Great Internet Mersenne Prime Search (GIMPS) project has discovered the largest known primes, all of which are Mersenne primes. As of recent records, the largest known prime has over 41 million digits and is a Mersenne prime.
If the exponent p is composite, meaning p = a * b where both a and b are greater than 1, then 2^p - 1 can always be factored algebraically. Specifically, 2^(ab) - 1 is divisible by 2^a - 1 and also by 2^b - 1. For example, 2^6 - 1 = 63 = 9 * 7, and indeed 2^2 - 1 = 3 divides 63 and 2^3 - 1 = 7 divides 63. This algebraic factorization means composite exponents can never yield primes. However, having a prime exponent is necessary but not sufficient, since 2^11 - 1 = 2047 = 23 * 89 is composite despite 11 being prime.
The Euclid-Euler theorem establishes a one-to-one correspondence between Mersenne primes and even perfect numbers. If 2^p - 1 is a Mersenne prime, then 2^(p-1) * (2^p - 1) is an even perfect number. Conversely, every even perfect number has this form. For example, the Mersenne prime 2^2 - 1 = 3 gives the perfect number 2^1 * 3 = 6, and the Mersenne prime 2^3 - 1 = 7 gives the perfect number 2^2 * 7 = 28. Whether odd perfect numbers exist remains one of the oldest unsolved problems in mathematics. This beautiful connection means that discovering each new Mersenne prime automatically gives a new perfect number.
As of early 2025, there are 51 known Mersenne primes. The search for new ones is ongoing through the Great Internet Mersenne Prime Search (GIMPS), a collaborative distributed computing project that anyone can join. The first few Mersenne primes correspond to exponents 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, and 127. The exponents grow increasingly sparse and unpredictable. It is an open question whether there are infinitely many Mersenne primes, though most mathematicians believe there are. Each new discovery requires testing enormous numbers and typically takes months of continuous computation across thousands of volunteer computers worldwide.
A Mersenne number is any number of the form 2^n - 1 for a positive integer n. A Mersenne prime is a Mersenne number that happens to be prime. Most Mersenne numbers are composite. For example, 2^4 - 1 = 15 = 3 * 5 is a Mersenne number but not a Mersenne prime. Only when the exponent n is itself prime does 2^n - 1 have a chance of being prime, and even then most are composite. Out of all prime exponents tested up to several hundred million, only 51 yield Mersenne primes. The density of Mersenne primes among Mersenne numbers with prime exponents decreases as the exponents grow larger, following conjectured heuristic distributions.
Mersenne primes have specialized applications in cryptography and pseudorandom number generation. The Mersenne Twister, one of the most widely used pseudorandom number generators, is based on properties of Mersenne primes (specifically 2^19937 - 1). In RSA cryptography, while Mersenne primes themselves are not used directly as key components because their special form would make them easy to guess, the mathematical theory behind primality testing of Mersenne numbers has advanced general prime-testing algorithms. Additionally, the binary structure of Mersenne numbers (all 1s in binary representation) makes modular arithmetic with them extremely efficient, which benefits various cryptographic implementations.
Educational Note: This calculator is provided for educational and informational purposes. Results are based on the formulas and inputs provided. Always verify important calculations independently. NovaCalculator processes calculator inputs client-side; optional analytics follow visitor consent settings.Reviewed by: NovaCalculator Mathematics Team โ€” Verified against standard mathematical and scientific references. Last reviewed: December 2025. ยฉ 2024โ€“2026 NovaCalculator.

Share this calculator

Formula

M(p) = 2^p - 1

A Mersenne number M(p) equals 2 raised to the power p minus 1. When both p is prime and M(p) is prime, M(p) is called a Mersenne prime. The associated even perfect number is 2^(p-1) * M(p).

Worked Examples

Example 1: Verifying M17 = 2^17 - 1 is Prime

Problem: Check whether 2^17 - 1 = 131,071 is a Mersenne prime.

Solution: First confirm 17 is prime: not divisible by 2, 3, or any prime up to sqrt(17) = 4.12.\n2^17 - 1 = 131,071\nCheck divisibility by primes up to sqrt(131071) = 362.\nNo prime factor found, confirming 131,071 is prime.\nAssociated perfect number: 2^16 * 131,071 = 8,589,869,056

Result: M17 = 131,071 is a Mersenne prime | Perfect number: 8,589,869,056

Example 2: Showing M11 = 2^11 - 1 is NOT Prime

Problem: Test whether 2^11 - 1 = 2,047 is a Mersenne prime despite 11 being prime.

Solution: 2^11 - 1 = 2,047\nCheck divisibility: 2047 / 23 = 89\nSo 2047 = 23 * 89, which is composite.\nNote: The factor 23 = 2 * 11 + 1, illustrating that factors of Mersenne numbers 2^p - 1 must be of the form 2kp + 1.

Result: M11 = 2,047 = 23 * 89 is NOT a Mersenne prime

Frequently Asked Questions

What is a Mersenne prime and why are they important?

A Mersenne prime is a prime number that can be written in the form 2^p - 1, where p itself must also be a prime number. They are named after the French monk Marin Mersenne, who studied them in the 17th century. Mersenne primes are important because they are deeply connected to perfect numbers through the Euclid-Euler theorem, and they hold records as the largest known prime numbers. The Great Internet Mersenne Prime Search (GIMPS) project has discovered the largest known primes, all of which are Mersenne primes. As of recent records, the largest known prime has over 41 million digits and is a Mersenne prime.

Why must the exponent p be prime for 2^p - 1 to be prime?

If the exponent p is composite, meaning p = a * b where both a and b are greater than 1, then 2^p - 1 can always be factored algebraically. Specifically, 2^(ab) - 1 is divisible by 2^a - 1 and also by 2^b - 1. For example, 2^6 - 1 = 63 = 9 * 7, and indeed 2^2 - 1 = 3 divides 63 and 2^3 - 1 = 7 divides 63. This algebraic factorization means composite exponents can never yield primes. However, having a prime exponent is necessary but not sufficient, since 2^11 - 1 = 2047 = 23 * 89 is composite despite 11 being prime.

What is the connection between Mersenne primes and perfect numbers?

The Euclid-Euler theorem establishes a one-to-one correspondence between Mersenne primes and even perfect numbers. If 2^p - 1 is a Mersenne prime, then 2^(p-1) * (2^p - 1) is an even perfect number. Conversely, every even perfect number has this form. For example, the Mersenne prime 2^2 - 1 = 3 gives the perfect number 2^1 * 3 = 6, and the Mersenne prime 2^3 - 1 = 7 gives the perfect number 2^2 * 7 = 28. Whether odd perfect numbers exist remains one of the oldest unsolved problems in mathematics. This beautiful connection means that discovering each new Mersenne prime automatically gives a new perfect number.

How many Mersenne primes are currently known?

As of early 2025, there are 51 known Mersenne primes. The search for new ones is ongoing through the Great Internet Mersenne Prime Search (GIMPS), a collaborative distributed computing project that anyone can join. The first few Mersenne primes correspond to exponents 2, 3, 5, 7, 13, 17, 19, 31, 61, 89, 107, and 127. The exponents grow increasingly sparse and unpredictable. It is an open question whether there are infinitely many Mersenne primes, though most mathematicians believe there are. Each new discovery requires testing enormous numbers and typically takes months of continuous computation across thousands of volunteer computers worldwide.

What is the difference between Mersenne numbers and Mersenne primes?

A Mersenne number is any number of the form 2^n - 1 for a positive integer n. A Mersenne prime is a Mersenne number that happens to be prime. Most Mersenne numbers are composite. For example, 2^4 - 1 = 15 = 3 * 5 is a Mersenne number but not a Mersenne prime. Only when the exponent n is itself prime does 2^n - 1 have a chance of being prime, and even then most are composite. Out of all prime exponents tested up to several hundred million, only 51 yield Mersenne primes. The density of Mersenne primes among Mersenne numbers with prime exponents decreases as the exponents grow larger, following conjectured heuristic distributions.

Can Mersenne primes be used in cryptography?

Mersenne primes have specialized applications in cryptography and pseudorandom number generation. The Mersenne Twister, one of the most widely used pseudorandom number generators, is based on properties of Mersenne primes (specifically 2^19937 - 1). In RSA cryptography, while Mersenne primes themselves are not used directly as key components because their special form would make them easy to guess, the mathematical theory behind primality testing of Mersenne numbers has advanced general prime-testing algorithms. Additionally, the binary structure of Mersenne numbers (all 1s in binary representation) makes modular arithmetic with them extremely efficient, which benefits various cryptographic implementations.

References

Reviewed by Manoj Kumar, Mathematics Educator ยท Editorial policy