Simplifying $\gcd(a^x + 1, a^y + 1)$ I am hoping those with more experience in number theory than me can help me out on this question.
After learning that $\gcd(a^m - 1, a^n - 1) = a^{\gcd(m, n)} - 1$, I questioned what is $\gcd(a^m + 1, a^n + 1)$ ($m$ not equal to $n$).
I assumed WLOG that $m > n$ and then used the Euclidean Algorithm to get $\gcd(a^m + 1, a^n + 1) = \gcd(a^{m-n} - 1, a^n + 1)$. However, I am now stuck.
Please explain if the parity of $x$ and $y$ matter.
QUESTION: Calculate $\gcd(a^x + 1, a^y + 1)$ 
 A: You want to find a generator of the ideal $I = (a^x + 1, a^y + 1)$. So we argue in the ring $A = Z/I$.
First let $d = \gcd(x,y)$ and write $ \alpha x + \beta y = d$ for some integers $\alpha, \beta$.
In $A$, you have $a^x = -1$ and $a^y = -1$. In particular, $a$ is invertible in $A$. Now
$$a^d = (a^x)^{\alpha}(a^y)^{\beta} = (-1)^{\alpha}(-1)^{\beta} = (-1)^{\alpha + \beta}.$$
Let $\varepsilon = (-1)^{\alpha + \beta}$. Then $a^d - \varepsilon \in I$.
Conversely, let $J$ be the ideal $(a^d - \varepsilon) \subseteq I$. Let $x = x'd$ and $y = y'd$. Then $ \alpha x' + \beta y' = 1.$ Modulo $J$, we have
$$1 + a^x \equiv 1 + (a^d)^{x'} \equiv 1 + \varepsilon^{x'} \equiv 1 + (-1)^{(\alpha  +\beta)x'}.$$
Similarly, we have $1 + a^y \equiv 1 + (-1)^{(\alpha  +\beta)y'}.$
Therefore $I = (a^d - (-1)^{\alpha + \beta}, 1 + (-1)^{(\alpha  +\beta)x'}, 1 + (-1)^{(\alpha  +\beta)y'}).$ There are several cases to examine.
Case 1. $x'$ and $y'$ are both odd. In this case, $\alpha + \beta$ must also be odd, so $I = (a^d + 1)$, and the required gcd is $a^d + 1$.
Case 2. One of $x'$ and $y'$ is even, and $a$ is odd. In this case, $I = (a^d - (-1)^{\alpha + \beta}, 2)$ and $a^d - (-1)^{\alpha + \beta}$ is even, so the required gcd is $2$.
Case 3. One of $x'$ and $y'$ is even, and $a$ is even. This is similar to Case 2. Here the required gcd is $1$.
