# Proving that a number with digits 1...9 in some order, ending in 5, is not a perfect square.

If "x" is a 9 digit number , which contains digits from 1 to 9 which ends in 5 . Prove that it can't be a perfect square ( digits are not to be repeated).

Please suggest the solution of this question.

• The number must end in $25$ or $75$, but apart form that? Without the condition baout $5$, there are 30 such perfect squares, so I'm afraid this boils down to lots of case distinctions ... Apr 28, 2013 at 11:14
• Please reformulate the question in a more understandable way. Do you mean "Prove that if $n$ is a $9$-digit number, containing all digits from $1$ to $9$, and ending in $5$, then $n$ cannot be a perfect square"? Apr 28, 2013 at 11:14
• @Hagen: How can it end in 75? Apr 28, 2013 at 11:17
• $(10x+5)^2=100x(x+1)+25\equiv25\pmod{100}$ Apr 28, 2013 at 11:24
• @TonyK You are right (by the same reasoning) ;) Apr 28, 2013 at 11:54

Assume on the contrary that there is a $9$ digit number containing all digits from $1$ to $9$ and ending in $5$ which is a perfect square $m^2$.
Then clearly $m^2$ is odd and divisible by $5$, so $m$ is odd and divisible by $5$. $\frac{m}{5}$ is an integer, so $(\frac{m}{5})^2 \equiv 0, 1, 4 \pmod{5}$. Thus $m^2 \equiv 0, 25, 100 \pmod{125}$. Also $m^2 \equiv 1 \pmod{8}$, so combining gives $m^2 \equiv 625, 025, 225 \pmod{1000}$. Clearly $m^2$ cannot end with $025$ or $225$, so $m^2$ ends with $625$. This implies that $125 \mid m^2$, so $25 \mid m$, so $625 \mid m^2$. Now $m^2 \equiv 625 \pmod{5000}$, so $m^2 \equiv 0625, 5625 \pmod{10000}$, a contradiction.
Therefore a $9$ digit number containing all digits from $1$ to $9$ and ending in $5$ cannot be a perfect square.
• How did you rule out $m^2 = 425$ and $m^2=825$ (mod $1000$)? Apr 28, 2013 at 11:54
• @TonyK Because $m^2 \equiv 0, 25, 100 \pmod{125}$. Apr 28, 2013 at 12:15
• Sorry, my mistake. I read (mod $125$) as (mod $100$) for some reason. Apr 28, 2013 at 12:23