TITLE: Use this sequence to prove that there are infinitely many prime numbers.
QUESTION [15 upvotes]: Problem:
By considering this sequence of numbers
$$2^1 + 1,\:\: 2^2 + 1,\:\: 2^4 + 1,\:\: 2^8 +1,\:\: 2^{16} +1,\:\: 2^{32}+1,\ldots$$
prove that there are infinitely many prime numbers.


I am thinking that if I can show that every pair of numbers in the sequence are relatively prime then since each has at least one prime factor this would prove the existence of infinitely many primes.
But I am new to discrete mathematics and number theory so I am not sure on how to proceed.

REPLY [9 votes]: If $2^{2^n}\equiv -1\pmod p$, then show that $2^{2^{m}}\not\equiv-1\pmod p$ for any $m<n$. 
This is because if $2^{2^m}\equiv -1\pmod p$ then: $$-1\equiv 2^{2^n}=\left(2^{2^{m+1}}\right)^{2^{n-m-1}}\equiv 1\pmod p$$
So $p=2$. But $p$ can't be $2$.
So $2^{2^n}+1$ and $2^{2^m}+1$ can't have any prime factors in common if $m\neq n$.