Prove that two distinct numbers of the form $a^{2^{n}} + 1$ and $a^{2^{m}} + 1$ are relatively prime if $a$ is even and have $\gcd=2$ if $a$ is odd

If $x = -1 \mod p$, then $x^{2^n} = 1 \mod p$.

Assume $n \gt m$. So if $p$ divides $x + 1 = a^{2^m} + 1$, then, $a^{2^n} + 1 = x^{2^{n-m}} + 1 = 1 + 1 = 2 \mod p$.


Hint:

Consider the following proof when $a=2$: https://planetmath.org/fermatnumbersarecoprime

Try adapting it to work for all $a$.

Hint 2: Factor $a^{2^n}-1$.