How can I find $\gcd(a^m+1,a^n+1)$ with $a,m,n$ positive integers?

How can I find $\gcd(a^m+1,a^n+1)$ with $a,m,n$ positive integers?

I have this idea:

Let $d=\gcd(m,n)$. Then there exist positive integers $x,y$ such that $mx-ny=d$ (WLOG). We shall find $G=\gcd(a^m+1,a^n+1)$.

If $m,n$ are odd, then $d$ is odd, therefore one and only one of $x,y$ is even. We have: $$a^{ny}(a^d+1)=a^{mx}+a^{ny}=(a^{mx}-1)+(a^{ny}+1)=(a^{mx}+1)+(a^{ny}-1).$$

If $x$ is even and $y$ is odd, then $a^{m}+1\mid a^{mx}-1$ and $a^{n}+1\mid a^{ny}+1$, therefore $G\mid a^{ny}(a^d+1)$.
If $x$ is odd and $y$ is even, then $a^{m}+1\mid a^{mx}+1$ and $a^{n}+1\mid a^{ny}-1$, thus $G\mid a^{ny}(a^d+1)$. However, since $\gcd(a^m+1,a^{ny})=\gcd(a^n+1,a^{ny})=1$, so $\gcd(G,a^{ny})=1$, hence $G\mid a^d+1$. We also have $a^d+1\mid a^{m}+1$ and $a^d+1\mid a^{n}+1$, so $a^d+1\mid G$. Thus $G=a^d+1$.

If $v_2(m)=v_2(n)=v_2(d)=k>1$, then there exist some odd numbers $m_1,n_1,d_1$ such that $m=2^km_1,n=2^kn_1,d=2^kd_1$. We shall have $m_1x-n_1y=d_1$, so one and only one of $x,y$ is even, and we can use the same argument when $m,n$ are odd, so $G=a^d+1$.

However, if $v_2(m) \neq v_2(n)$, I cannot find any solutions for this. I think that $G \in \{1,2\}$, but I cannot prove or disprove it. How can I find $G=\gcd(a^m+1,a^n+1)$ if $v_2(m) \neq v_2(n)$ ? Moreover, is there anything from my arguments that can be improved ?


Solution 1:

Here is a proof that is valid in any ring. Here $\,(x,y)\,$ can be read either as a gcd or an ideal. First we reduce to coprime exponents $\,b,c\,$ then we derive a formula for this special coprime case.

$(A^{\large m}\!+\!1,A^{\large n}\!+\!1) =\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\! \overbrace{((A^{\large d})^{\large b}\!+\!1,(A^{\large d})^{\large c}\!+\!1)}^{\Large\qquad\qquad\ \ \ \ (a^{\LARGE b}\ +\, 1\,,\, \ \ \ \ a^{\LARGE c}\ +\ 1),\ \ \,a\, =\, A^{\LARGE d}}\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!\!$ for $\,d = (m,n),\, $ so $\,(b,c)=1,\,$ wlog $\,b\,$ odd, so

$$d := (a^{\large b}\!+\!1,a^{\large c}\!+\!1)=(a\!+\!1,\color{#0a0}{(-\!1)^{\large c}\!+\!1}) =\begin{cases} (a\!+\!1)\quad \ \, {\rm if}\ \ 2\nmid c\\ (a\!+\!1,2) \ \ {\rm if}\ \ 2\mid c\end{cases}\qquad$$

by $\!\bmod d\!:\, a^{\large b}\equiv -1\equiv a^{\large c}\Rightarrow a^{\large 2b}\equiv 1\equiv a^{\large 2c}$ so $\,{\rm ord}\, a^{\large 2}$ divides coprimes $b,c$ so is $1,$ so $\color{#c00}{a^{\large 2}\equiv 1}.\,$ $\,b\,$ odd $\,\Rightarrow\,b = 1\!+\!2j^{\phantom{|^{|^|}}\!\!\!\!}\,$ so $\,{-}1^{\phantom{|^{|^|}}\!\!\!\!}\equiv a^{\large b}\!\equiv a^{\large\phantom{,}}\!(\color{#c00}{a^{\large 2}})^{\large j}\!\equiv a\,\Rightarrow\,a\!+\!1\equiv 0,\,$ so $\,d{\phantom{|^{|^|}}\!\!\!\!} = (a\!+\!1,d) = (a\!+\!1,\,\color{#0a0}{d\bmod a\!+\!1})\,$ is as claimed, by $\!\underbrace{a^{\large k}\!+\!1 \equiv \color{#0a0}{(-1)^{\large k}\!+\!1}}_{\large\ \bmod\ a\,+\,1:\ \ a\ \equiv\ \color{#0a0}{-1}\ \ \ \ \ }^{\phantom .}\!\!\!\pmod{\color{#0a0}{\!\!a\!+\!1}}$

Corollary $\ $ If $\,A,B=1\,$ and $\,M,N\in \Bbb N,$ and wlog $M/(M,N)\,$ odd, then

$\quad(A^M\!+\!B^M,A^N\!+\!B^N)\, =\, (A^{(M,N)}\!+\!B^{(M,N)},C),\,\ \begin{cases} C = 2\ \ {\rm if}\ \ 2\mid N/(M,N)\\ C = 0\ \ {\rm otherwise}\end{cases}$

Proof $ $ Homogenize the above proof (details are here).