Problem 675: (2014 AIME I, 8)
The positive integers $N$ and $N^2$ both end in the same sequence of four digits $abcd$ when written in base 10, where digit $a$ is not zero. Find the three-digit number $abc$.
- $N^2\equiv N\pmod{10^4}$ means $16\cdot625\mid N(N-1)$. Since $N,N-1$ are coprime, one is divisible by $16$ and the other by $625$ (or one by both).
- Mod $10^4$ the solutions are $0,1$, $N\equiv1\pmod{625}$ with $16\mid N$, and $N\equiv0\pmod{625}$ with $N\equiv1\pmod{16}$. Since $625\equiv1\pmod{16}$, these are $625\cdot15+1=9376$ and $625$.
- Only $9376$ has a nonzero leading digit, so $abc=937$. The answer is $\boxed{937}$.
The positive integers $N$ and $N^2$ both end in the same sequence of five digits $abcde$ when written in base 10, where digit $a$ is not zero. Find the three-digit number $abc$.