Why is there a pattern to the last digits of square numbers? I was programming and I realized that the last digit of all the integer numbers squared end in $ 0, 1, 4, 5, 6,$ or $ 9 $.
And in addition, the numbers that end in $ 1, 4, 9, 6 $ are repeated twice as many times as the numbers that end in $ 0, 5$
I checked the numbers from $1$ to $1000$, and the results are:
$1.$ The numbers on the left are the last digit of each digit squared.
$2.$ The numbers on the right are the number of times that the last digit is repeated.
$$
\begin{array}{cc}
0: &100, \\
1: &200, \\
4: &200, \\
5: &100, \\
6: &200, \\
9: &200
\end{array}
$$
So, why does this happen? What is the property that all integers have?

Consider:
$$(x+k)^2=(x+k)(x+k)=x^2+2xk+k^2$$
In your case, $x=10z, z\in \Bbb Z$, and $0\le k\le9, k\in \Bbb Z$. Thus it becomes:
$$(x+k)^2=100z^2+20zk+k^2$$ for which the only possible unit is the unit from $k^2$, and so the facts that:
$$1^2,9^2\space\text{end in}\space 1$$
$$2^2,8^2\space\text{end in}\space 4$$
$$3^2,7^2\space\text{end in}\space 9$$
$$4^2,6^2\space\text{end in}\space 6$$
$$5^2\space\text{ends in}\space 5$$
$$0^2\space\text{ends in}\space 0$$
means that those are your only possibilities.
