MathLabs

Problem 1

Let mm and nn be positive integers with 1≤m<n1 \le m < n. In their decimal representations, the last three digits of 1978m1978^m are equal, respectively, to the last three digits of 1978n1978^n. Find mm and nn such that m+nm+n has its least value.
Step 4 of 8: Reduce the mod-125 part to an order condition
In plain words

1978^m is invertible mod 125, so it can be cancelled entirely from the congruence.

gcd⁡(1978,125)=1  ⇒  1978 n−m≡1(mod125)\gcd(1978,125)=1 \;\Rightarrow\; 1978^{\,n-m}\equiv 1 \pmod{125}
Detailed analysis

Since 19781978 is invertible modulo 125125, the mod-125125 condition 1978m(1978 n−m−1)≡01978^m\left(1978^{\,n-m}-1\right)\equiv 0 reduces directly to 1978 n−m≡1(mod125)1978^{\,n-m}\equiv 1\pmod{125}, independent of mm.