IsMersennePrimeExponent
Tests whether 2^p - 1 is prime, by the Lucas-Lehmer test.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
MersennePrimeExponentQ✓IsMersennePrimeExponent(p)True if p is prime and 2^p - 1 passes Lucas-Lehmer, False if p is not prime or fails itTyped signatures
| Type | Package | Applies |
|---|---|---|
(integer) -> boolean | combinatorics | always |
Details
- Runs Lucas-Lehmer directly (s0 = 4, s(i+1) = s(i)^2 - 2 mod 2^p - 1, prime iff s(p-2) = 0) rather than a table lookup -- exact, not a probable-prime test.
- Capped at p <= 4423 (the 20th known Mersenne prime exponent, same bound number-theory's own MersennePrimeExponent table is complete to) -- past that, whether 2^p - 1 is prime is GIMPS-scale search, so the call stays unevaluated rather than running an arbitrarily expensive test.
- A non-prime p (or p < 2) answers False outright, without running Lucas-Lehmer -- a composite exponent's Mersenne number always has a proper factor.
Examples
About
| Examples | 12 |
|---|---|
| Checked against | Wolfram Language 12 agree |
| Crosswalk | Wolfram Language |
See also: MersennePrimeExponent, IsPrime