We first prove the special case
If m | n, then (Xm - 1) |
(Xn - 1).
From this we derive the general case
gcd(Xm - 1,Xn - 1) =
Xgcd(m,n) - 1.
In particular Xm - 1 divides
Xn - 1.
Thus, n can be replaced by the remainder of division of n by m.
But this is the first step of Euclid's algorithm,
which can be repeated
and repeated, until one of the arguments of the gcd is
Xgcd(m,n) - 1, and the other 0.