| CodeRams Practice Problem Archive |
|---|
| Finished |
As you may know, large prime numbers are in very high demand currently, and there are many large scale searches for even larger primes. Some of the largest prime numbers discovered fit a number called a Mersenne Prime, which is essentially any prime number than can be represented by the equation $$$2^{p}-1$$$. Mersenne Primes are especially interesting as they can be tested for primality with a special test called the Lucas-Lehmer test. Although you could technically solve Mersenne Primes using typical prime-number algorithms, the Lucas-Lehmer test will almost always be faster. The pseudocode for conducting the Lucas-Lehmer test for as found on Wikipedia is as follows:
A single integer $$$p$$$ that represents the power of 2 in the equation $$$2^{p}-1$$$ to be tested.
The phrase "true" should be printed if the value calculated with $$$p$$$ is a Mersenne Prime, and the phrase "false" should be printed otherwise.
7
true
15
false
More information regarding the Lucas-Lehmer test and Mersenne Primes can be found here: https://en.wikipedia.org/wiki/Lucas-Lehmer_primality_test, https://en.wikipedia.org/wiki/Mersenne_prime.
| Name |
|---|


