The reason why m must be of the form 2^x for 2^m + 1 to be prime is known as the Lucas-Lehmer primality test. This test is based on the Lucas-Lehmer sequence, which is a sequence of numbers generated by the formula:
S(n) = (S(n-1)^2 - 2) mod M, where S(0) = 4 and M = 2^m - 1.
If the resulting value of S(n) is equal to 0, then 2^m - 1 is a prime number. However, if the value of S(n) is not equal to 0, then 2^m - 1 is not a prime number.
Now, if we consider the specific case of 2^m + 1, we can see that it can be written as 2^m - (-1)^m. Therefore, for 2^m + 1 to be prime, we need to find a value of m for which 2^m - (-1)^m is a prime number.
Using the Lucas-Lehmer primality test, we can see that for 2^m - (-1)^m to be prime, the value of S(n) must be equal to 0. And for S(n) to be equal to 0, m must be of the form 2^x for some natural number x. This is because, for any other value of m, the resulting value of S(n) will not be equal to 0 and therefore, 2^m - (-1)^m will not be a prime number.
To learn more about the Lucas-Lehmer primality test and its proof, you can refer to the following resources:
1. "Lucas-Lehmer Primality Test" by Eric Weisstein, MathWorld. Available at:
https://mathworld.wolfram.com/Lucas-LehmerPrimalityTest.html
2. "The Lucas-Lehmer Test for Mersenne Primes" by David Cleaver, University of Western Australia. Available at:
https://www.maths.uwa.edu.au/~dcleaver/chap6.pdf
3. "Prime Numbers and the Lucas-Lehmer Test" by Chris K. Caldwell, University of Tennessee at Martin. Available at:
https://primes.utm.edu/notes/proofs/Lucas-Le