Prove that $\gcd(1 + a + a^2 +\dots + a^{n-1}, 1+a + \dots +a ^{m - 1}) = 1 + a +\dots+ a^{\gcd(m, n) - 1}$ Let $f(n) = 1 + a + a^2 + \dots + a^{n-1}$
We are required to prove $\gcd(f(n), f(m)) = f(\gcd(m, n))$.
Proceed by induction on $n$. The base $n = 1$ is trivial. Assume inductively that for some $k$, the above statement holds true for all integers from $1$ to $k$.
Now, we are required to prove that $\gcd(f(k+1), f(m)) = f(\gcd(k + 1, m))$. 
If $n > k + 1$, then by the Euclidean Algorithm, $\gcd(f(k+1), f(m)) = \gcd(f(k+1), f(m - k - 1)) = \gcd(f(k + 1), f(m - 2(k+1)))$ and so on until $k + 1 > m - l(k+1)$. 
If $m - l(k + 1) < k + 1$, then by the inductive hypothesis $\gcd(f(k + 1), f(m - l(k + 1))) = f(\gcd(k+1, m-l(k+1)))$,  by the inductive hypothesis. We can apply the Euclidean Algorithm to this in reverse to get $\gcd(f(k+1), f(n)) = f(\gcd(k+1, n))$ as desired. 
If $n < k + 1$, we can apply the inductive hypothesis directly. The case where $n =k$ is trivial. 
First off, this proof seems too good to be true. Secondly, it's very inelegant. Is there a more concise proof?
Is this proof correct? Or is there a mistake somewhere?
 A: HINT:
Using this, $$(a^n-1,a^m-1)=a^{(n,m)}-1$$ where $m,n$ are positive integers
$$\implies \left(\frac{a^n-1}{a-1},\frac{a^m-1}{a-1}\right)=\frac{a^{(n,m)}-1}{a-1}$$
A: You can use the following:

Let $\Bbb G_n$ denote the multiplicative group of $n$-th roots of unity. Then $$\Bbb G_n\cap \Bbb G_m=\Bbb G_{(m,n)}$$

Can you relate this to $z^m-1$, $z^n-1$ and $z^{(m,n)}-1$? Then note that $$\frac{z^m-1}{z-1}=1+z+z^2+\cdots+z^{m-1}$$
Put differently

Let $n\Bbb Z$ denote the coset $\{nm:m\in\Bbb Z\}=\{\ldots,-2n,-n,0,n,2n,\ldots\}$. Then $$n\Bbb Z+m\Bbb Z=(m,n)\Bbb Z$$


So we want to prove $$\left(a^{n}-1,a^m-1\right)=a^{(m,n)}-1$$
If $m=0$ or $n=0$ there is nothing to prove. Suppose w.l.o.g. that $0<m<n$. Then $${a^n} - 1 = {a^{n - m}} - 1 + {a^{n - m}}\left( {{a^m} - 1} \right)$$
It follows that $\mod a^{m}-1$, $$a^n-1\equiv   {{a^{n - m}} - 1}  $$ so $$\left(a^{n}-1,a^m-1 \right)=(a^n-1,a^{n-m}-1)$$
By inducting on $m+n$, the above allows to fall down to the inductive hypothesis that $$\left(a^{n}-1,a^m-1\right)=a^{(m,n)}-1$$
But since $(n,n-m)=(m,n)$, we're done. This idea is due to Bill Dubuque, and holds in more generality:

Let $f_n$ be an integer sequence with $f_0=0$ and $$f_n\equiv f_{n-m}\mod f_m$$ Then $$(f_n,f_m)=f_{(m,n)}$$

A: Here is a direct proof method.
Suppose that $m\lt n$ - the case of equality is trivial so that - following the Euclidean algorithm we have $n=qm+r$. Let $$\sum_{i=0}^{k-1}a^{i}=f_k$$ We note that for all $k$ that $(f_k,a)=1$. This means we can essentially ignore powers of $a$ in the argument below, as they are coprime with all the $f$s and we are looking at common factors. We have $$f_n=1+a+a^2+\dots+a^{n-1}=f_m+a^mf_m+a^{2m}f_m+\dots a^{(q-1)m}f_m+a^{qm}f_r$$
From which it follows that $(f_n, f_m)=(f_m, f_r)$ by precise analogy with the Euclidean algorithm in the case of integers. Essentially the same proof goes through.
