# What digits can square numbers end in?

Here was the solution that I stumbled upon, but I'm sure it can be improved upon: $$1^2=1 \\ 2^2 = 4 \\ 3^2 = 9 \\ \ldots \\ 20^2 = 400$$ The last digits of square numbers repeat in the following pattern: $$1,4,9,6,5,6,9,4,1,0$$. It seems like square numbers can end in any digit except $$2,3,7, \text{and }8$$. Proof that the pattern always repeats: $$(n+10)^2=n^2+20n+100=n^2+10(2n+10)$$ A number plus a multiple of $$10$$ does not change its last digit, so the pattern will always repeat.

I have two questions:

1. Can my solution be improved upon (e.g. by generalising it further)?
2. Do you have any advice for getting to the solution more quickly when you are finding the answer to these problem solving-type questions? Even though the mathematics I used to find the solution to this problem was rather elementary, it took me half an hour of complete guess-work to find it. Is there a more structured approach one can take?
• $$(10n\pm a)^2\equiv a^2\pmod{20}$$ So, it is sufficient to check for $a=0,1,2,3,4,5$ Commented Oct 12, 2019 at 10:47

Consider a number $$n$$ in $$\mod10$$. The possible representations are : $$n \equiv 0,1,2,3,4,5,6,7,8,9\mod10$$ and $$n^2 \equiv 0,1,4,9,6,5,6,9,4,1 \mod 10$$
Hence the possible digits in the end of a square number is $$\in (0,1,4,5,6,9)$$