Mersenne numbers, 2^p − 1, hold the record for the largest known primes, and they give the even perfect numbers. The Mersenne prime calculator takes the exponent p and gives the number of digits of 2^p − 1, the digits of the matching perfect number, the storage size, the Lucas-Lehmer steps and the pages needed to print the number.
How the calculation works
- Digits of the Mersenne number 2^p − 1 = floor(p × log10 2) + 1. The −1 never changes the digit count, because a power of 2 is not a power of 10.
- Digits of the perfect number 2^(p−1) × (2^p − 1) = floor((2p − 1) × log10 2) + 1. Euclid and Euler showed that when 2^p − 1 is prime, this number is perfect, equal to the sum of its proper divisors.
- Storage = p ÷ 8 bytes, since the number has p bits, all equal to 1.
- Lucas-Lehmer steps = p − 2. The test squares a number modulo 2^p − 1 that many times, and is the way record primes are found.
Example
The largest known Mersenne prime in 2018 was 2^82,589,933 − 1. Its digit count is floor(82,589,933 × 0.30103) + 1 = 24,862,048. The perfect number built from it has floor(165,179,865 × 0.30103) + 1 = 49,724,095 digits. Stored in binary it takes 82,589,933 ÷ 8 ≈ 10.32 MB, and the Lucas-Lehmer test needs 82,589,931 squarings. Printed at 3,000 digits per page, the Mersenne number would fill about 8,287 pages.
Why it matters
The numbers are so large that their size is hard to picture. A page count, a file size and a number of steps make it concrete, which helps in teaching number theory and in explaining what distributed computing projects do.
Good to know
The digit counts are exact for any exponent. The calculator does not decide if the number is prime, and not every prime p gives a prime 2^p − 1: for example 2^11 − 1 = 2047 = 23 × 89. For very large p the displayed values are rounded to the precision of the screen.
Related tools
The Catalan number calculator and the combinations calculator give other quickly growing counts from combinatorics.