I'm having trouble applying the Euclidean algorithm to $$\gcd(a^n-1,a^m-1)=a^{\gcd(n,m)}-1$$ I've seen others do it such as in this solution but I'm having trouble figuring out what they are doing in each step.
Could someone help explain this to me?