Lucas-Lehmer primality test
The Lucas-Lehmer primality test is a specific algorithm used to determine if a number of the form 2^p - 1 is prime, where p is a prime number. This test is particularly efficient for Mersenne primes, which are named after the French monk Marin Mersenne.
To perform the test, one starts with the number 4 and iteratively squares it, subtracting 2 each time, for p-2 iterations. If the final result is 0 when taken modulo 2^p - 1, then the number is prime; otherwise, it is composite.