12. Find positive integers $\boldsymbol{n}$ and $m, n>m \geqslant 1$, such that the last three digits of $1978^{n}$ and $1978^{m}$ are equal, and make $n+m$ as small as possible. (20th International Mathematical Olympiad Problem)
12. Solution: $1978^{n}-1978^{m}=1978^{m}\left(1978^{n-m}-1\right)$
$$=2^{m} \cdot 989^{m}\left(1978^{n-m}-1\right)$$

Since the last three digits of $1978^{n}$ and $1978^{m}$ are the same, the last three digits of $1978^{n}-1978^{m}$ are all 0. Therefore, $1978^{n}-1978^{m}$ is divisible by 1000. And $1000=2^{3} \cdot 5^{3}$. Thus,
$$2^{3} \cdot 5^{3} \mid 2^{m} \cdot 989^{m}\left(1978^{n-m}-1\right)$$

Since $989^{m}$ and $1978^{n-m}-1$ are both odd, $2^{3} \mid 2^{m} . . m$ must be at least 3.
$$\text { Also, }\left(5^{3}, 2^{m} \cdot 989^{m}\right)=1 \text {, so } 5^{3} \mid\left(1978^{n \cdots m}-1\right) \text {, }$$

i.e.,
$$1978^{n-m} \equiv 1(\bmod 125)$$

The problem now is to find the smallest positive integer $n-m$ that satisfies the above congruence. At this point, taking $m=3, n+m=(n-m)+2 m$ will also be the smallest.

Since $\varphi(125)=5^{2} \cdot 4=100,(1978,125)=1$, by Theorem 1 we get
$$1978^{100} \equiv 1(\bmod 125)$$

We can prove that $(n-m) \mid 100$. Because otherwise:
$100=(n-m) q+r, q$ is an integer, $r$ is a positive integer,
and $0<r<n-m$, then
$$1978^{100}=1.978^{(n-m) q} \cdot 1978^{r} \equiv 1978^{r}(\bmod 125)$$

But
$$1978^{100} \equiv 1(\bmod 125)$$
so
$$1978^{r} \equiv 1(\bmod 125)$$

However, $r<n-m$, which contradicts the assumption that $n-m$ is the smallest positive integer that satisfies the congruence. Therefore, $(n-m) \mid 100$.

Since $125 | (1978^{n-m}-1)$, the last digit of $1978^{n-m}$ must be 1 or 6. It is easy to verify that the last digit of $1978^{n-m}$ is 6 only when $4 \mid(n-m)$. So $n-m$ is a multiple of 4, a divisor of 100, and can only be one of 4, 20, 100.

Since
$$\begin{aligned}
1978^{4} & =(125 \times 15+103)^{4} \equiv 103^{4}(\bmod 125) \\
103^{2} & =\left(3+4 \cdot 5^{2}\right)^{2} \equiv 3^{2}+2 \cdot 3 \cdot 4 \cdot 5^{2} \\
& \equiv 609 \equiv-16(\bmod 125) \\
103^{4} & \equiv(-16)^{2} \equiv 6(\bmod 125)
\end{aligned}$$

So
$$1978^{4} \equiv 1(\bmod 125)$$

And
$$1978^{20}=\left(1978^{4}\right)^{5} \equiv 6^{5} \equiv 1(\bmod 125)$$

Therefore, the smallest value of $n-m$ is 100. Now taking $m=3$, we have $n=103, n+m=106$.