Find all 4 digits numbers that $ABCD=(CD)^2$ Please help me to solve following problem:
Find all 4 digits numbers such that $ABCD=(CD)^2$.(any of $A,B,C,D$ is a digit!)
I know one of solutions is $5776=(76)^2$.
 A: We need $D^2\equiv D\pmod{10}$ hence $D(D-1)$ must be a multiple of $10$. This implies that $D\in\{0,1,5,6\}$.
Next, the tens digit of $(CD)^2=(10\cdot C+D)^2=100\cdot C^2+20\cdot C\cdot D+D^2$ is determined by the ones digit of $2\cdot C\cdot D$ and the tens digit of $D^2$.


*

*For $D=0$ we need $2\cdot 0\cdot C\equiv C\pmod {10}$, so $C=0$.

*For $D=1$ we need $2\cdot 1\cdot C\equiv C\pmod {10}$, so $C=0$.

*For $D=5$ we need $2\cdot 5\cdot C+2\equiv C\pmod {10}$, so $C=2$

*For $D=6$ we need $2\cdot 6\cdot C+3\equiv C\pmod {10}$, so $C=7$


Thus the full list of answers is
$$00^2=0000\quad 01^2=0001\quad 25^2=0625\quad 76^2=5776 $$
and possibly you won't count the first three as valid.
A: If you allow leading zeros, there are three more. $D$ must be $0,1,5,6$.  You can then just try them all-there are only $40$ possibilities.  As $0,1$ don't carry, in both cases we must have $C=0$.  For $5$ it has to be $2$, giving $00,01,25,76$
A: $ABCD=(CD)^2$ can be translated as $100n + x = x^2$ which implies 
$x^2 - x \equiv 0 \pmod{100}$.
$$ \text{$x^2-x \equiv 0 \pmod{100} \iff x(x-1) \equiv 0 \pmod{4}$ 
    and $x(x-1) \equiv 0 \pmod{25}$}$$
$$x^2-x \equiv 0 \pmod{4} \iff x \in \{\bar 0_{4}, \bar1_{4} \}$$
$$x^2-x \equiv 0 \pmod{25} \iff x \in \{\bar 0_{25}, \bar1_{25} \}$$
$$x\equiv a \pmod{4} \ \wedge \ x \equiv b \pmod{25} \iff x \equiv 25a - 24b \pmod{100}$$
\begin{align}
   x \equiv 0 \pmod{4} \ \wedge \ x \equiv 0 \pmod{25} \iff x \equiv 0 \pmod{100} \\
   x \equiv 0 \pmod{4} \ \wedge \ x \equiv 1 \pmod{25} \iff x \equiv 76 \pmod{100} \\
   x \equiv 1 \pmod{4} \ \wedge \ x \equiv 0 \pmod{25} \iff x \equiv 25 \pmod{100} \\
   x \equiv 1 \pmod{4} \ \wedge \ x \equiv 1 \pmod{25} \iff x \equiv 1 \pmod{100} \\
\end{align}
So, we get


*

*00^2 = 0000

*01^2 = 0001

*25^2 = 0625

*76^2 = 5776

A: If a programmatic solution (Python 2.7) is acceptable, then:
for n in range(0,100):
    if (n*n)%100 == n:
        print "%04d"%(n*n)

Gives:
0000
0001
0625
5776

