# Prove that a square of a positive integer cannot end with $4$ same digits different from $0$

Prove that a square of a positive integer cannot end with $4$ same digits different from $0$.

I already proved that square of positive integer cannot end with none of digits $1,2,3,5,6,7,8,9$ using the remainder of division by $3,4,8,10$. Now problem is how to prove that this number cannot end with $4444$.

• Integers whose squares end $444$ are of the form $500k\pm38$ and these squares all have an odd digit immediately before the $444$. – Henry Dec 21 '14 at 13:41

Assume that a number $x\in \mathbb N$ suffices $x^2\mod 10000 = 4444$. Notice that only the 4 least significat digits of $x$ are important for computing $x^2\mod 10000$, so denote by $a,b,c,d$ digits such that: $$x\mod 10000 = 1000a+100b+10c+d$$
Next, notice that: $$x^2 \mod 10000 = 1000(2ad+2bc)+100(2bd+c^2)+10(2cd)+d^2 \mod 10000$$
This gives us a set of equations: $$\begin{cases} d^2 = 4 \\ 2cd = 4\\ 2bd + c^2 = 4\\ 2ad+2bc = 4\\ \end{cases}$$
Since there is no solution for this equation set (for $a,b,c,d\in\{0,1,\ldots,9\}$), no such integer $x$ exists.
• Why $d^2=4$? If, for example, $d=8$ then $d^2=64$, but $(d^2\mod10)=4$ and then $((2cd+d^2-(d^2\mod10))\mod10)=4$ etc. But then this system of equations become more complicated. – user164524 Dec 25 '14 at 18:38
As $$x^2=4444\equiv12 \pmod{ 16}$$, so no squares can end in four $$4$$'s.