Squares with All Odd Digits

Theorem

The only squares whose digits[1] are all odd are $1$ and $9$.

Proof

If $n$ is even, then at least the last digit of $n^2$ is even.

So for $n^2$ to have its digits all odd, $n$ itself must be odd.

We can see immediately that $1 = 1^2$ and $9 = 3^2$ fit the criterion.

Of the other 1-digit odd integers, we have $5^2 = 25, 7^2 = 49, 9^2 = 81$, all of which have an even digit.

Now, let $n > 10$ be an odd integer. There are five cases to consider:

• $n = 10 p + 1$: we have $\left({10p + 1}\right)^2 = 100 p^2 + 20 p + 1 = 10 \left({10 p^2 + 2 p}\right) + 1$.
• $n = 10 p + 3$: we have $\left({10p + 3}\right)^2 = 100 p^2 + 60 p + 9 = 10 \left({10 p^2 + 6 p}\right) + 9$.
• $n = 10 p + 5$: we have $\left({10p + 5}\right)^2 = 100 p^2 + 100 p + 25 = 10 \left({10 p^2 + 10 p + 2}\right)+ 5$.
• $n = 10 p + 7$: we have $\left({10p + 7}\right)^2 = 100 p^2 + 140 p + 49 = 10 \left({10 p^2 + 14 p + 4}\right)+ 9$.
• $n = 10 p + 9$: we have $\left({10p + 9}\right)^2 = 100 p^2 + 180 p + 81 = 10 \left({10 p^2 + 18 p + 8}\right)+ 1$.

It is clear that in all cases the 10's digit is even.

So the square of every odd integer greater than $3$ always has at least one even digit.

Hence the result.

$\blacksquare$

Notes

1. That is, when written in base 10 notation.