-
galois.mersenne_primes(n: int | None =
None
) list[int] Returns all known Mersenne primes \(p\) for \(p \le 2^n - 1\).
See also
Notes¶
Mersenne primes are primes that are one less than a power of 2.
References¶
Examples¶
# List all Mersenne primes up to 2000 bits In [1]: p = galois.mersenne_primes(2000); p Out[1]: [3, 7, 31, 127, 8191, 131071, 524287, 2147483647, 2305843009213693951, 618970019642690137449562111, 162259276829213363391578010288127, 170141183460469231731687303715884105727, 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151, 531137992816767098689588206552468627329593117727031923199444138200403559860852242739162502265229285668889329486246501015346579337652707239409519978766587351943831270835393219031728127, 10407932194664399081925240327364085538615262247266704805319112350403608059673360298012239441732324184842421613954281007791383566248323464908139906605677320762924129509389220345773183349661583550472959420547689811211693677147548478866962501384438260291732348885311160828538416585028255604666224831890918801847068222203140521026698435488732958028878050869736186900714720710555703168729087] In [2]: galois.is_prime(p[-1]) Out[2]: True