# $\gcd(b^x - 1, b^y - 1, b^ z- 1,\dots) = b^{\gcd(x, y, z,\dots)} -1$ [duplicate]

Possible Duplicate: Prove that $\gcd(a^n - 1, a^m - 1) = a^{\gcd(n, m)} - 1$

$$b$$, $$x$$, $$y$$, $$z$$, $$\ldots$$ are integers greater than 1. How can we prove that $$\gcd (b ^ x - 1, b ^ y - 1, b ^ z - 1 ,\dots)= b ^ {\gcd (x, y, z, \dots)} - 1\ ?$$

It suffices to prove it for two terms, that is, $\gcd(a^n - 1, a^m - 1) = a^{\gcd(n,m)} - 1$. The basic idea is that we can use the Euclidean algorithm on the exponents, as follows: if $n > m$, then

$$\gcd(a^n - 1, a^m - 1) = \gcd(a^n - 1, a^n - a^{n-m}) = \gcd(a^{n-m} - 1, a^m - 1).$$

So we can keep subtracting one exponent from the other until we get $\gcd(n, m)$ as desired. Another way to look at this computation is to write $d = \gcd(a^n - 1, a^m - 1)$ and note that

$$a^n \equiv 1 \bmod d, a^m \equiv 1 \bmod d \Rightarrow a^{nx+my} \equiv 1 \bmod d$$

from which it readily follows, as before, that $a^{\gcd(n,m)} \equiv 1 \bmod d$, so $d$ dividess $a^{\gcd(n,m)} - 1$. On the other hand, $a^{\gcd(n, m)} - 1$ also divides $d$. To see this, denote $e \cdot \gcd(n,m) = n$ and $f \cdot \gcd(n,m) = m$ (verify for yourrself that this makes sense). We then have \begin{align*}a^n-1 = (a^{\gcd(n,m)})^e -1 \equiv & 0 \pmod{a^{\gcd(n,m)}-1} \\ a^m-1 = (a^{\gcd(n,m)})^f-1 \equiv & 0 \pmod{a^{\gcd(n,m)}-1}. \end{align*} Hence we have $$a^{\gcd(n,m)}-1 \; |\; d .$$

What's really nice about this result is that it holds both for particular values of $a$ and also for $a$ as a variable, e.g. in a polynomial ring with indeterminate $a$.

You can readily deduce several seemingly nontrivial results from this; for example, the sequence defined by $a_0 = 2, a_n = 2^{a_{n-1}} - 1$ is a sequence of pairwise relatively prime integers, from which it follows that there are infinitely many primes. By working only slightly harder you can deduce that in fact there are infinitely many primes congruent to $1 \bmod p$ for any prime $p$.

• I can't understand this passage; if $n > m$, then $$\gcd(a^n - 1, a^m - 1) =\color{red}{ \gcd(a^n - 1, a^n - a^{n-m}) = \gcd(a^{n-m} - 1, a^m - 1)}$$ – Alessar Dec 18 '18 at 10:02
• @Alessar I think, subtract $a^n-a^{n-m}$ from $a^n-1$ to get $a^{n-m}-1$, then remove the factor $a^{n-m}$ on the right since it is coprime with $a^{n-m}-1$ – Evariste Dec 21 '18 at 11:27
• I actually didn't understand it either, that red step. Could someone explain? – xtreyreader Oct 4 '20 at 19:57

Hint  By below $$\, a^M\!-\!1,\:a^N\!-\!1\$$ and $$\, a^{(M,N)}\!-\!1\$$ have the same set $$\,S$$ of common divisors $$\,d,\,$$ so they have the same greatest common divisor $$\ (= \max\ S),\,$$ i.e. using $$\,\rm\color{#90f}{R\! = }$$mod order reduction

$$\begin{eqnarray}\ {\rm mod}\:\ d\!:\ a^M\!\equiv 1\equiv a^N&\!\iff\!& {\rm ord}(a)\ |\ M,N\!\color{#c00}\iff\! {\rm ord}(a)\ |\ (M,N)\!\!\!\overset{\rm\color{#90f}R\!\!}\iff\! \color{#0a0}{a^{(M,N)}\!\equiv 1}\\[.3em] {\rm i.e.}\ \ \ d\ |\ a^M\!-\!1,\:a^N\!-\!1\! &\!\iff\!\!&\ d\ |\ \color{#0a0}{a^{(M,N)}\!-\!1},\qquad\,\ {\rm where} \quad\! (M,N)\, :=\, \gcd(M,N) \end{eqnarray}\ \ \ \ \$$

Note  We used the GCD universal property $$\ a\mid b,c \color{#c00}\iff a\mid (b,c)\$$ [which is the definition of a gcd in more general rings].  Compare that with $$\ a $$a and, analogously, $$\, a\subset b,c\iff a\subset b\cap c,\$$ and $$\ a\supset b,c\iff a\supset b\cup c.\,$$ Such universal "iff" characterizations enable quick and easy simultaneous proof of both directions.

The conceptual structure that lies at the heart of this simple proof is the ubiquitous order ideal. $$\$$ See this answer for more on this and the more familiar additive form of a denominator ideal.

Generally: $$\, \gcd(f(m), f(n)) = f(\gcd(m,n))\$$ if $$\, f(n) \equiv f(n\!-\!m)\pmod{\!f(m)}\,$$ and $$\, f(0) = 0,\,$$ which is proved by a simple induction in this answer.

In fact there is a $$q$$-analog: the result also holds true for polynomials $$\ f(n) = (x^n\!-\!1)/(x\!-\!1),\,$$ and $$\ x\to 1\$$ yields the integer case (Bezout identity) - see this answer for a simple proof.