# Predicted distribution of Mersenne primes

We’ll construct a plot below using Python.

Note that the conjecture is asymptotic, and so it could make poor predictions for now and still be true for much larger numbers.

But it appears to make fairly good predictions over the range where we have discovered Mersenne primes.

import numpy as np import matplotlib.

pyplot as plt # ps for which 2^p – 1 is prime.

# See https://oeis.

org/A000043 ps = [2, 3, 5, .

, 82589933] # x has 200 points from 10^1 to 10^8 # spaced evenly on a logarithmic scale x = np.

logspace(1, 8, 200) # number of ps less than x such that 2^p – 1 is prime actual = [np.

searchsorted(ps, t) for t in x] exp_gamma = np.

exp(0.

5772156649) predicted = [exp_gamma*np.

log2(t) for t in x] plt.

plot(x, actual) plt.

plot(x, predicted, “–“) plt.

xscale(“log”) plt.

xlabel(“p”) plt.

ylabel(r”Mersenne primes \$leq 2^p-1\$”) plt.

legend([“actual”, “predicted”]) Related posts Five interesting things about Mersenne primes Algorithm to search for Mersenne primes NIST primes [1] Fifty one Mersenne primes have been verified.

But these may not be the smallest Mersenne primes.

It has not yet been verified that there are no Mersenne primes yet to be discovered between the 47th and 51st known ones.

The plot in this post assumes the known Mersenne primes are consecutive, and so it is speculative toward the right end.

.