A prime number is called a Mersenne prime if it can be written in the form 2p

Question:

A prime number is called a Mersenne prime if it can be written in the form 2p - 1 for some positive integer p. Write a program that finds all Mersenne primes with p … 31 and displays the output as follows:
p ...................2^p –1
2 ......................3
3 ......................7
5 ....................31
...

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: