Mersenne Primes

Mersenne Primes take the form p=2kāˆ’1p = 2^k - 1. Often we just loop through all possible Mersenne primes and check if either pp or qq are that.

This is very easy to do in Sage:

from sage.combinat.sloane_functions import A000668

mersenne = A000668()

Then we can grab the nnth Mersenne prime using mersenne(n).

Last updated