Find $N$ with $N^2=10^4M+N$ I'm a high school student in France and I participated in a math olympiad, and there was a question which I found impossible to solve. Maybe they are here some people who can help me:

We take a number $N$ which can be written by numbers $a,b,c$ and $d$ in
  the same order.
so $N=a(10^3)+b(10^2)+c10+d$. And $M\in \mathbb{Z}$ with
  $N^2=M(10^4)+N$
Find $M$.

 A: $$10^4M=N^2-N=N(N-1)$$
Observe that $10^4$ divides $N(N-1)$ and $10^4>N\ge10^3$ as $N$ only has four digits. As their difference is 1, $N$ and $N-1$ are relatively prime to each other, meaning they don't have common divisors except $1$.
There are four cases
i) $10^4|N$, this cannot happen as $N$ is less than $10^4$.
ii) $2^4|N$ and $5^4|N-1$. Then, $N=k\cdot 5^4+1$ for some $k$. As $N$
has four digits, $2\le k\le 15$. $$5^4\equiv 1 \pmod{16}$$
So, $2^4=16|N$ implies $k=15, N=9376,M=8790$
iii) $5^4|N$ and $2^4|N-1$ Then, $N=k\cdot 5^4$ for some $k$. As $N$
has four digits, $2\le k\le 15$. $$5^4\equiv 1 \pmod{16}$$
So, $2^4=16|N-1$ implies $16|k-1$. However, no integer between $2$ and $15$ is equivelant to $1$ modulo $16$. Contradiction
iv) $10^4|N-1$, this cannot happen as $N-1$ is less than $10^4$.
A: $$N^2-N=10^4 \cdot M$$
$$N(N-1)=2^4\cdot 5^4\cdot M$$
$N(N-1)=16\cdot 625\cdot M$
$\gcd(N,N-1)=1$ 
Then 1)$$N=2^4k; N-1=5^4l, k,l \in \mathbb N$$ or 2)$$N-1=2^4k; N=5^4l, k,l \in \mathbb N$$
1) $10^4\le N-1=5^4l \le 10^5 \Rightarrow 2\le l \le 15$ and $16|N$
2)$10^4\le N=5^4l \le 10^5 \Rightarrow 2\le l \le 15$ and $16|(N-1)$
1) $l=2, N-1=1250$, but $16 \not |N=1251$
$l=3, N-1=1875$, but $16 \not |N=1876$
and so on ...
$l=15, N-1=9375, N=9376=586 \cdot 16$
$$N^2=9376^2=87909376=10^4\cdot 8790+9376$$
$$M=8790$$
A: By trial and error.
The last digit of $N^2$ only depends on the last digit of $N$. We have the compatibilities
$$0\to0,1\to1,5\to5,6\to6.$$
With the last two digits, starting from these four solutions and trying to prefix all digits,
$$00\to00,
01\to01,
25\to25,
76\to76.$$
With the last three digits,
$$000\to000,
001\to001,
625\to625,
376\to376.$$
And with the four digits,
$$0000\to0000,
0001\to0001,
0625\to0625,
9376\to9376.$$
Note that this is a little better than brute force (trying all $10000$ possibilities), but it requires the evaluation of $10$ squares to add a digit, for a total of $130$ squares (!)
A: Parce que $N^2=10000M+N$, on saurait que le fin (4 digits) de $N^2$ et $N$ sont pareil.
Donc, le juste fin de $N$ serait $5$ ou $6$ ($5^2=25$, $6^2=36$).
On essaie et trouve que le fin serait $25$ ou $76$.
On essaie et trouve que le fin serait $625$ ou $376$ (on doit apprendre ca par coeur).
On essaie encore et trouve que $N$ serait seulement $9376$.
$9376^2=87909376$.
