Catalan-Mersenne Number Calculator

Mersenne

Catalan-Mersenne chain element 3127
written as a Mersenne number2^7 - 1
primalityPrime - confirmed by the Lucas-Lehmer test
next chain element2^127 - 1
How this was calculated
  1. Catalan's chain starts at 2 and repeatedly replaces p by the Mersenne number 2^p - 1: 2, 3, 7, 127, then 2^127 - 1.
  2. Element 3 is 2^7 - 1 = 127.
  3. The Lucas-Lehmer test confirms it is prime, so the Catalan-Mersenne chain can legally continue to the next element.
  4. Catalan conjectured in 1876 that every element of this chain is prime; the chain is verified prime through 2^127 - 1 and completely open beyond it.

The Catalan-Mersenne Calculator works through the Catalan-Mersenne number chain, which starts at 2 and repeatedly applies the Mersenne map p to 2^p - 1. The first elements are 2, 3, 7, 127, then 2^127 - 1, which equals 170141183460469231731687303715884105727. The calculator shows each element in turn and tells you whether it is prime. It confirms that element 4, 2^127 - 1, is prime, a result established with the Lucas-Lehmer test. It also makes clear that not every Mersenne number is prime: 2^11 - 1 = 2047 = 23 x 89. Catalan conjectured in 1876 that every element of the chain is prime; the chain is verified through 2^127 - 1 and completely open beyond it. Element 5 would be 2 raised to the power 2^127 - 1, minus 1, which is far too large to write out or test.

The Lucas-Lehmer test is the accepted standard for deciding whether a Mersenne number is prime, which is why this calculator relies on it rather than on trial division. That matters here because the numbers grow extremely fast: after 127, the next element is beyond anything that can be written out or tested. This page shows the formula behind the calculation, the step-by-step workings, worked examples and the sources used, so you can follow how each result is reached instead of taking the answer on trust.

Worked examples

Chain element 3: 127

(0 - walk the chain · 3 · 127)

Catalan-Mersenne chain element 3127
written as a Mersenne number2^7 - 1
primalityPrime - confirmed by the Lucas-Lehmer test
next chain element2^127 - 1

Chain element 4: 2^127 - 1

(0 - walk the chain · 4 · 127)

Catalan-Mersenne chain element 4170,141,183,460,469,231,731,687,303,715,884,105,727
written as a Mersenne number2^127 - 1
primalityPrime - confirmed by the Lucas-Lehmer test
next chain element2^127 - 1's successor: 2 raised to that Mersenne number, minus 1

Lucas-Lehmer test for p = 11

(1 - Lucas-Lehmer test for an exponent p · 3 · 11)

is 2^11 - 1 prime?No - the Lucas-Lehmer test fails; smallest factor 23
digits in the Mersenne number4
factorization starts2,047 = 23 x 89
double Mersenne outlookNone - a composite Mersenne number ends any chain through it

What is a Catalan-Mersenne number?

A Catalan-Mersenne number comes from a chain that starts at 2 and repeatedly applies the Mersenne map, which turns a number p into 2^p - 1. Take 2, plug it into the map, and you get 2^2 - 1 = 3. Apply the map to 3 and you get 2^3 - 1 = 7. Apply it to 7 and you get 2^7 - 1 = 127. Apply it once more to 127 and you get 2^127 - 1. Each element of the chain becomes the exponent for the next one, so the numbers grow explosively after only a few steps.

The verified elements of the chain are 2, 3, 7, 127, and 2^127 - 1. The first four are small enough to check by hand and are all prime. The fifth verified element is the large one: 2^127 - 1 = 170141183460469231731687303715884105727. This number is prime, a fact confirmed by the Lucas-Lehmer test, a standard method for testing whether a Mersenne number is prime. So every element from 2 through 2^127 - 1 has been shown to be prime.

It is tempting to assume that a number of the form 2^p - 1 is always prime whenever p is prime, but that is not true. A simple counterexample is 2^11 - 1 = 2047, which equals 23 x 89. Eleven is prime, yet 2047 is composite. This is why each link in the Catalan-Mersenne chain has to be tested rather than assumed, and why the primality of 2^127 - 1 is a verified result and not a guess.

In 1876, Catalan conjectured that every element of this chain is prime. The chain is verified through 2^127 - 1 and completely open beyond it. The next element would be 2 raised to the power 2^127 - 1, minus 1. That number is far too large to write out or test with current methods, so whether it is prime remains unknown. Anyone working with a Catalan-Mersenne number should keep this boundary in mind: the early links are settled, and everything past 2^127 - 1 is an open question.

  • 2 (prime)
  • 3 = 2^2 - 1 (prime)
  • 7 = 2^3 - 1 (prime)
  • 127 = 2^7 - 1 (prime)
  • 2^127 - 1 = 170141183460469231731687303715884105727 (prime, confirmed by the Lucas-Lehmer test)
Not every Mersenne number is prime: 2^11 - 1 = 2047 = 23 x 89. Each element of the Catalan-Mersenne chain must be tested, not assumed.

The Lucas-Lehmer test

The Lucas-Lehmer test is the standard method for deciding whether a Mersenne number — a number of the form 2^p - 1 — is prime. It rests on a simple sequence. Start with s = 4. Each step, square the current value and subtract 2. For a Mersenne number with exponent p, the number 2^p - 1 is prime exactly when the (p - 2)th term of this sequence is divisible by 2^p - 1. The test is fast because each squaring is done modulo 2^p - 1, so the numbers never grow beyond the size of the candidate itself. That is what makes it practical for large exponents, and it is the test that confirmed element 4 of the Catalan-Mersenne chain, 2^127 - 1 = 170141183460469231731687303715884105727, is prime.

To see the mechanics in words, run the test on a small exponent, p = 5, where the candidate is 2^5 - 1 = 31. The sequence begins at s = 4. Square it and subtract 2: 16 - 2 = 14. Square 14 and subtract 2: 196 - 2 = 194, which leaves remainder 8 when divided by 31. Square 8 and subtract 2: 64 - 2 = 62, which is exactly 2 × 31, so the remainder is 0. A remainder of zero means 31 passes, and indeed 31 is prime. Every step is ordinary arithmetic — square, subtract 2, take the remainder — repeated p - 2 times.

The test also exposes failures cleanly. Not every Mersenne number is prime: 2^11 - 1 = 2047 = 23 × 89. Because 2047 is composite, the Lucas-Lehmer sequence for p = 11 cannot end at a remainder of zero. The sequence begins 4, 14, 194, and continues by squaring and subtracting 2 modulo 2047; at no point does the final term reduce to 0 mod 2047. The factorization 23 × 89 explains why: a prime passing the test would have to survive division by every smaller number, and 2047 does not survive 23 or 89. So a nonzero final remainder is a certificate of compositeness, just as a zero is a certificate of primality.

This is precisely why the Lucas-Lehmer test matters for the Catalan-Mersenne number chain. The chain starts at 2 and repeatedly applies the Mersenne map p to 2^p - 1, giving 2, 3, 7, 127, then 2^127 - 1. Each element can be checked with the same square-and-subtract-2 procedure, and the test confirmed that 2^127 - 1 is prime. Beyond that point the test cannot help in practice: element 5 would be 2 raised to the power 2^127 - 1, minus 1 — far too large to write out or test. Catalan conjectured in 1876 that every element of the chain is prime; the chain is verified through 2^127 - 1 and completely open beyond it.

Lucas-Lehmer in one line: start at s = 4, then repeatedly square and subtract 2 modulo 2^p - 1. A final remainder of 0 means prime; anything else means composite — as with 2^11 - 1 = 2047 = 23 × 89.

How far the chain is verified

The Catalan-Mersenne number chain is a short list of numbers, but its verification status changes sharply along the way. The chain starts at 2 and repeatedly applies the Mersenne map, which takes a number p to 2^p - 1. That gives 2, 3, 7, 127, and then 2^127 - 1. The first four elements are small enough to check by hand or with elementary arithmetic. The fifth element is where the story turns.

Element 4, 2^127 - 1, equals 170141183460469231731687303715884105727, and it is prime. That result was confirmed by the Lucas-Lehmer test, a standard primality test for Mersenne numbers. So the chain is verified through 2^127 - 1: every element up to that point is prime. This is the farthest point at which the Catalan-Mersenne number chain has been confirmed.

Beyond that point, the chain is completely open. Element 5 would be 2 raised to the power 2^127 - 1, minus 1. That number is far too large to write out or test with current methods, so no one knows whether it is prime. Catalan conjectured in 1876 that every element of the chain is prime, but the conjecture remains unresolved past element 4. The table below summarizes where each element stands.

It is worth remembering that being a Mersenne number does not guarantee being prime. The classic counterexample is 2^11 - 1 = 2047 = 23 x 89. So the fact that the first four chain elements are prime is a genuine result at each step, not an automatic consequence of the form. Each confirmed element required its own check, and element 4 required the Lucas-Lehmer test because of its size. The chain's early success is real, but it stops at a hard boundary.

ElementValueStatus
12Prime
23Prime
37Prime
42^127 - 1 = 170141183460469231731687303715884105727Prime, confirmed by the Lucas-Lehmer test
52^(2^127 - 1) - 1Untestable: far too large to write out or test
The Catalan-Mersenne number chain is verified through 2^127 - 1 and completely open beyond it. Element 5, 2^(2^127 - 1) - 1, is far too large to write out or test.

Catalan-Mersenne vs ordinary Mersenne primes

A Catalan-Mersenne number belongs to one specific, tightly linked sequence, and that is what sets it apart from the broad family of Mersenne primes. The chain starts at 2 and repeatedly applies the Mersenne map, which takes an exponent p to 2^p - 1. Following that rule gives 2, then 3, then 7, then 127, and then 2^127 - 1. Each step feeds the previous result in as the next exponent, so the elements are not independent curiosities but links in a single iterated chain. An ordinary Mersenne prime, by contrast, is any prime of the form 2^p - 1 at whatever prime exponent p happens to work. The Catalan-Mersenne chain is the rare case where the exponents themselves are the earlier members of the same chain.

The fourth element shows how quickly this construction grows. Element 4, 2^127 - 1, equals 170141183460469231731687303715884105727, and it is prime, confirmed by the Lucas-Lehmer test. That is a genuine Mersenne prime, but its special status comes from its place in the chain: its exponent, 127, is itself the third element. In the wider world of Mersenne primes, an exponent like 127 would be just one input among many. Here it is the product of the previous step, which is why the chain is described as iterated rather than merely listed.

It is also worth remembering that the Mersenne form does not guarantee a prime. Not every Mersenne number is prime: 2^11 - 1 = 2047 = 23 x 89. This example separates two ideas that are easy to blur. Being a Mersenne number, meaning simply of the form 2^p - 1, is a structural property. Being a Mersenne prime requires that the number also pass a primality test. The Catalan-Mersenne chain is a claim about primality at each of its own special exponents, not a claim that every Mersenne number is prime.

Catalan conjectured in 1876 that every element of the chain is prime. The chain is verified through 2^127 - 1 and completely open beyond it. That open status is the sharpest contrast with ordinary Mersenne primes, which are discovered one exponent at a time and tested individually. The next link in this chain cannot be handled that way. Element 5 would be 2 raised to the power 2^127 - 1, minus 1, which is far too large to write out or test. So while the search for ordinary Mersenne primes continues across many separate exponents, the Catalan-Mersenne question rests on a single enormous, untested next term.

  • Catalan-Mersenne chain: 2, 3, 7, 127, then 2^127 - 1, each step applying p to 2^p - 1.
  • Element 4, 2^127 - 1 = 170141183460469231731687303715884105727, is prime, confirmed by the Lucas-Lehmer test.
  • Ordinary Mersenne primes can occur at many prime exponents; the chain uses only its own previous elements as exponents.
  • Not every Mersenne number is prime: 2^11 - 1 = 2047 = 23 x 89.
  • Catalan conjectured in 1876 that every element is prime; verified through 2^127 - 1 and completely open beyond it.
  • Element 5 would be 2^(2^127 - 1) - 1, far too large to write out or test.
The key difference: an ordinary Mersenne prime is tested at a chosen exponent, while the Catalan-Mersenne chain makes each new exponent out of the previous result, so the next term is far too large to write out or test.

FAQs

What are the Catalan-Mersenne numbers?

They are the chain 2, 3, 7, 127, 2^127 - 1, and onward, formed by repeatedly replacing p with 2^p - 1. Each term is a Mersenne number built from the previous term, so the numbers grow extremely fast. The first few are small enough to write out, but later terms become far too large to display in full.

Is 2^127 - 1 prime?

Yes. Lucas proved it in 1876 using the test that now bears his name. That makes 2^127 - 1 a Mersenne prime and the fifth number in the Catalan-Mersenne chain. It is far too large to check by trial division, so the proof relied on Lucas's specialized test rather than dividing by every smaller prime.

Is 2^11 - 1 prime?

No. The number 2^11 - 1 equals 2047, and 2047 = 23 x 89, so it is composite. This is a useful reminder that not every number of the form 2^p - 1 is prime, even when the exponent p is itself prime. Eleven is prime, yet 2047 factors into 23 and 89.

What is the next Catalan-Mersenne number after 2^127 - 1?

It is 2 raised to (2^127 - 1), minus 1. This number is astronomically large and cannot be written out in full. Its exponent is itself the enormous prime 2^127 - 1, so the result has vastly more digits than anything practical to print. The chain simply continues this way, each term built from the one before.

Who conjectured the chain is all prime?

Eugene Catalan conjectured in 1876 that every number in the chain is prime. The conjecture is still open, meaning no one has proved it true or found a counterexample. The early terms are known to be prime, but confirming later terms is far beyond current methods because of their enormous size.

How does the Lucas-Lehmer test work?

Start at s = 4 and repeatedly replace s by s squared minus 2, modulo the Mersenne number being tested. The Mersenne number is prime exactly when the test ends at 0. This modular squaring keeps the numbers manageable, which is why the test can handle primes like 2^127 - 1 that are far too large for ordinary division.

Sources

Related calculators

Mersenne Prime Calculator
Test whether a Mersenne number 2^p - 1 is prime with the Lucas-Lehmer test, for exponents up to 61.
Arithmetic Derivative Calculator
Compute the arithmetic derivative D(n) from the prime factorization using the Leibniz product rule.
Blum Integer Calculator
Test whether a number is a Blum integer - the product of exactly two distinct primes, both 3 mod 4 - with the factorisation, the residues mod 4 and the next Blum integer.