Let $a > 1$ be an integer, $m, n, t$ positive integers. One can prove the following facts.
- $a^{m} - 1$ divides $a^{n} - 1$ iff $m \mid n$. Thus
- $a^{\gcd(m, n)}-1$ divides $\gcd(a^{m} - 1, a^{n} - 1)$. In fact
- $a^{\gcd(m, n)}-1 = \gcd(a^{m} - 1, a^{n} - 1)$.
The last point follows from the fact that if $t$ divides both $a^{m} - 1$ and $a^{n} - 1$, then $a^{m} \equiv a^{n} \equiv 1 \pmod{t}$, and a simple application of Bezout shows that $a^{\gcd(m, n)} \equiv 1 \pmod{t}$.
From this it follows that
$$
\frac{a^{\gcd(m, n)}-1}{a-1} = \gcd\left(\frac{a^{m} - 1}{a-1}, \frac{a^{n} - 1}{a-1}\right).
$$