<s>[INST] Find the smallest integer $n$ greater than $1$ such that the last $3$ digits of $n^2$ are the same as the last $3$ digits of $n$. Find the smallest integer $n$ greater than $1$ such that the last $3$ digits of $n^2$ are the same as the last $3$ digits of $n$.
So far I've got $n^2 = 1000k + n$ which means $n^2 ≡ n \mod 1000$. I  don't know how to proceed since 1000 seems to be a bit high.
 [/INST] $$n(n-1)\equiv0\pmod{2^35^3}$$
As $(n,n-1)=1,$  we can have following four cases
$$n\equiv0\pmod{2^35^3}$$
$$n-1\equiv0\pmod{2^35^3}$$
$$n-1\equiv0\pmod{2^3}\text{  and } n\equiv0\pmod{5^3}$$
$$n-1\equiv0\pmod{5^3}\text{  and } n\equiv0\pmod{2^3}$$
For the last two cases use Chinese Remainder Theorem
</s>