Elementary Number Theory – Last Two Decimal Digits of a Perfect Square

decimal-expansionelementary-number-theorysquare-numbers

Show that the last two decimal digits of a perfect square must be one of the following pairs:

$00, e1, e4, 25, o6, e9$ ($e$ stand for even digit, $o$ for odd).

Solution is given, but I don't understand it at all.
enter image description here

Best Answer

First observe that it suffices to check the integers from $0$ to $99$ as $(100x+y)^2 \equiv y^2 \pmod{100}$. Now, we consider $y \ge 50$. In that case, $y = 50 +n$, where $0 \le n \le 49$. In that case, $$y^2 = (50+n)^2 = 2500 + 100n + n^2 \equiv n^2 \pmod{100}.$$ Therefore, the numbers $n$ and $50+n$ share the same last two digits (check, for example, $n=0,1,2$ etc.). As a consequence, we do not need to check the last two digits of the numbers greater than $49$. Rather, we focus on the numbers $0, 1, \cdots , 49$.

Among them, we now consider $y \ge 25$. These numbers can be written as $y = 50-n$ for $0 \le n \le 25$. But $$y^2 = (50-n)^2 = 2500 - 100n + n^2 \equiv n^2 \pmod{100}.$$ Therefore, the numbers $n$ and $50-n$ share the same last two digits (check, for example, $n=1,2$ etc.; i.e. $1^2$ and $49^2$ have the same last two digits). As a consequence, we do not need to check the last two digits of the numbers greater than $25$. Rather, we focus on the numbers $0, 1, \cdots , 25$.

For $0 \le n \le 25$, we compute their squares and observe the pattern of the last two digits. The pattern turns out to be $00, e1, e4, 25, o6, e9$.

Related Question