If $n$ is a square, can $n$ consist of only odd digits?

281 Views Asked by At

The question is: If $n$ is a square, can $n$ consist of only odd digits?

I have a feeling that the answer is no, with the only exceptions being $n=1,9$. I am not sure how to go about proving this though. Any help or hints would be appreciated.

2

There are 2 best solutions below

2
On BEST ANSWER

Assume $n=m^2$ and all digits of $n$ are odd. Then certainly $m$ is odd (as otherwise $n$ is even and ends in an even digit). Note that $(m+50)^2=m^2+100m+2500\equiv m^2\pmod{100}$ so that it suffices to show that for all odd $m=1,3,5,\ldots ,49$ the tens digit is even. Actually, already for $(m+10)^2=m^2+20m+100\equiv m^2+20m\pmod{100}$ the tens digit parity is the same as for $m^2$, so it really suffices to check $m=1,3,5,7,9$ where $n=01,09,25,49,81$ has even tens.

0
On

Modulo $10$, we have $n^2=(10k\pm d)^2=100k^2\pm20kd+d^2$, where $d\in\{0,1,2,3,4,5\}.$ Notice

that the tens' digit is always even, except when we have a carry, i.e., when $d^2>9\iff d=4$

and/or $d=5.$ The former case can be discarded, since it yields and even units' digit. The same

goes for the latter, since $25$ yields an even carry.