Number Theory
Intermediate

Mersenne Number

Numbers one less than a power of two.

Formula

Mp=2p−1M_p = 2^p - 1

Live Calculator

Members

Variables

pExponent

Example

M_7 = 127 (prime)

How it works

A Mersenne number is formed by taking a power of 2 and subtracting 1, so its size is always just below a "round" binary boundary. This is useful because powers of 2 are especially simple in binary: 2^p is written as 1 followed by p zeros, and subtracting 1 turns those zeros into ones. That is why M_p = 2^p - 1 produces numbers like 3, 7, 15, 31, and so on.

When to use it

Use this formula when working with special integers in number theory, especially when testing candidates for Mersenne primes or studying patterns in binary representation. It also appears in computer science and cryptography because powers of 2 and their neighbors have convenient bit patterns.

Worked example, step by step

Take p = 11 M_11 = 2^11 - 1 2^11 = 2048 2048 - 1 = 2047 So, M_11 = 2047

Common mistakes to avoid

  • Forgetting that p is the exponent, not the value being doubled
  • Subtracting 1 before calculating the power of 2
  • Assuming every Mersenne number is prime

Did You Know?

The largest known primes are all Mersenne primes, one form 2^p−1 with over 24 million digits.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026