For $a, m, n \in \mathbb{N}$, prove that $$\gcd(a^{2^m} + 1, a^{2^n} + 1) = \begin{cases} 1, & \text{if $a$ is even}\\ 2, & \text{if $a$ is odd} \end{cases}$$ given $m \ne n$.
My attempt:
Let $\gcd(a^{2^m} + 1, a^{2^n} + 1) = d$. Let $p$ be a prime factor of $d$. Clearly, $p \nmid a \implies \gcd(p,a) = 1$. $\tag*{}$ But, $ \ \ \ a^{2^m} \equiv -1 \pmod{p} \\ \implies a^{2^{m+1}} \equiv 1 \pmod{p} \\ \implies \text{ord}_p(a) = 2^{m+1}$ $\tag*{}$ But by similar logic, $\text{ord}_p(a) = 2^{n+1}$ $\implies m = n$ $\tag*{}$ Therefore, no such prime exists. $\implies d = 1$.
But obviously, there's something wrong with this, as, for an odd $a \text{, } 2 \mid d$.
After some head-scratching, I realized that $-1 \equiv 1 \pmod{2}$. And for all odd positive integers, $\text{ord}_2(a) = 1$.
So my question is, while working with orders, do I need to treat $\text{ord}_2(x)$ as an exception? I just can't figure a general working rule for it.
Edit: Just to calrify, $\text{ord}_p(a) = 2^{m+1} \text{ because, }\text{ord}_p(a) \mid 2^{m+1} \text{ but, } \text{ord}_p(a) \nmid 2^{m}$.