Mersenne Primesarrow-up-right take the form p=2k−1p = 2^k - 1p=2k−1. Often we just loop through all possible Mersenne primes and check if either ppp or qqq are that.
This is very easy to do in Sage:
from sage.combinat.sloane_functions import A000668 mersenne = A000668()
Then we can grab the nnnth Mersenne prime using mersenne(n).
mersenne(n)
Last updated 5 months ago
Was this helpful?