Lucas-Lehmer Test Calculator
Enter a prime exponent.

Mersenne Numbers and Primality

A Mersenne number has the form 2p-1. For certain prime exponents p, this number is itself prime, yielding the celebrated Mersenne primes. These primes grow rapidly, so testing them efficiently requires specialized algorithms. The Lucas-Lehmer test provides a remarkably simple criterion: for prime p greater than two, define the sequence s0=4 and sk+1=sk2-2 computed modulo 2p-1. If sp-2=0, then 2p-1 is prime.

Historical Perspective

ร‰douard Lucas developed this method in the nineteenth century, and Derrick Lehmer later refined it for computational use. The test has powered the search for record-breaking primes, notably by the distributed GIMPS project. Because the sequence involves repeated squaring modulo the candidate prime, its simplicity belies the depth behind its correctness, which relies on properties of cyclic groups and quadratic recurrences.

Using the Calculator

Enter a prime exponent p. For practical reasons this calculator accepts moderate values of p; extremely large exponents may exceed the precision of JavaScriptโ€™s BigInt. The script initializes s0 to 4 and iterates p-2 times, squaring and subtracting two modulo 2p-1. If the final result is zero, the candidate is prime; otherwise it is composite. This provides a quick way to explore the rarity of Mersenne primes.

The Lucas-Lehmer test is deterministic for prime p and remarkably fast compared with general-purpose primality checks. Understanding and experimenting with this algorithm highlights the interplay between number theory and computer arithmetic. It also offers a gateway into the world of distributed prime-search efforts.

Related Calculators

Zodiac Compatibility Calculator - Explore Astrological Matches

Discover how your sun sign pairs with another using this zodiac compatibility calculator. Learn about the elements and qualities that influence astrological relationships.

zodiac compatibility calculator astrology match horoscope

Career Skills Gap Analyzer - Identify Development Priorities

Measure the difference between required skills and your current abilities. Plan your professional development with a clear skills gap score.

career skills gap analyzer professional development calculator skills assessment

Japan Highly Skilled Professional Points Calculator - Immigration to Japan

Check your eligibility for Japan's Highly Skilled Professional visa using our comprehensive points calculator. Estimate points for education, experience, income, age, and more.

Japan immigration calculator highly skilled professional points calculator Japan visa points