There are some numbers which appear at the end of their own square. More formally, these numbers, $k$, are $n$ digit integers such that $$k^2 - k \equiv 0 \pmod {10^n}$$

Trivially, for $1$ digit numbers we have $1 \to 1, 5 \to 25, 6 \to 36$. For $2$ digit numbers, $25 \to 625, 76 \to 5776$, and for $3$ digit numbers we have $376, 625$.

Here's where it gets interesting. The only four digit number is $9,376$. The only five digit numbers is $90,625$. Six digit numbers? $109,376$ and $890,625$. Seven? $7,109,376$ and $2,890,625$. Eight? $87,109,376$ and $12,890,625$. As we go further and further, they always end in $376$ or $625$.

Another possibly significant observation which can be made is that the sum of the two for each $n$ is $10^n + 1$. Note that this is still true for $n = 4$ and $n = 5$ -- $9376 + 0625 = 10001, 90625 + 09376 = 100001$.

I may be able to construct an algebraic argument, but I'm not in the mood for a plethora of ugly variables. Can you help me understand these observations I've made and show, if true, that it holds for all $n$?


1 Answer 1


It is shown in this answer that there are two infinite, non-trivial sequences of numbers that satisfy this condition: \begin{align} k&\equiv0\pmod{2^n}\quad\text{and}\quad k\equiv1\pmod{5^n}\\ k&\equiv1\pmod{2^n}\quad\text{and}\quad k\equiv0\pmod{5^n} \end{align}

If we look at the equation they solve, $$ k^2-k\equiv0\pmod{10^n} $$ we see that since the sum of the roots is the negative of the penultimate term (the linear term in this case), the sum of the roots will be $\equiv1\pmod{10^n}$.

  • 1
    $\begingroup$ Also since each root is less than $10^n$ and greater than $1$, the sum must be exactly $10^n + 1$. $\endgroup$ Mar 14, 2014 at 2:13
  • $\begingroup$ Ending in $376$ and $625$ -- is that just CRT at work? $\endgroup$
    – MCT
    Mar 14, 2014 at 2:16
  • $\begingroup$ @user92774: indeed. The last $n-1$ digits of the solutions mod $10^n$ match the digits of the solutions mod $10^{n-1}$, so each term in the sequence just adds a new digit to the left. $\endgroup$
    – robjohn
    Mar 14, 2014 at 2:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.