# A five-digit number whose square has its last five digits equal to the number.

Pretty straightforward problem as the title suggests, but I don't know how to start:

Find a five digit number, so that its square has its last five digits equal to the number.

• Try 90625. This is padding to satisfy the requirements of a comment. – John Douma Mar 10 '16 at 20:45
• Can you find a one digit number whose last digit is equal to the number? A two digit number? – deinst Mar 10 '16 at 20:46

## 2 Answers

Instead of a five-digit number, let's find a two-digit number. We want $x^2 - x = x(x-1)$ to be a multiple of 100. So it's a multiple of 4 and of 25.

Now, one of $x-1$ and $x$ is even and the other is odd. Let's say that the even one is a multiple of 4 (since the odd one won't contribute any powers of 2) and the odd one must be a multiple of 25.

So either $x$ is a multiple of 4 and $x-1$ is a multiple of 25, or $x-1$ is a multiple of 4 and $x$ is a multiple of 25. It's not too hard to check all the cases and see that we get $x = 76$ in the first case and $x = 25$ in the second case. When there are more digits, use the Chinese Remainder Theorem to solve the simultaneous congruences.

(Alternatively, $x$ could be a multiple of 4 and of 25, giving $x = 0$, or $x-1$ could be a multiple of 4 and of 25, giving $x = 1$. But these are trivial.)

• Thank you for your answer! So one can use this approach to tackle the problem for any number of digits (k-digit number whose square has its last k digits equal to the number ). Very nice indeed. – MathematicianByMistake Mar 10 '16 at 21:13
• That's right. I did it for $k = 2$ because doing it for $k = 1$ seemed trivial. – Michael Lugo Mar 10 '16 at 21:15

Call such a number $n$. Then $n^2-n=(n-1)n$ should be divisible by $100\,000=2^5\cdot5^5$. It follows that one of $n-1$ or $n$, call it $n'$, should be divisible by $5^5=3125$, the other by $32$. Therefore we have to find a $k$ with $$n'=k\cdot3125\ \equiv\pm1\qquad({\rm mod}\>32)\ .\tag{1}$$ Now $3125=21$ $({\rm mod}\>32)$, hence $k_*=3$ would satisfy $(1)$ with $=-1$ on the right hand side. But the given size restriction on $n'$ enforces $4\leq k\leq 31$. As $21$ is prime to $32$ there is exactly one $k$ in this range that fulfills $(1)$, namely $k=32-k_*=29$, which then fulfills $(1)$ with $=1$ on the right hand side. This implies that our problem has exactly one solution, namely $n=29 n'=90\,625$.