While going to sleep, I just started thinking about numbers, their squares, cubes and after thinking for about $20$ minutes I got that:

There is no integer (having any numbers of digits) except $0$ and $1$, sum of squares of whose digits is equal to number itself.

Isn't it interesting ??

Now I came out blanket and started writing everything on paper (Or started finding a proof of what I have got).


Suppose there exist an integer $a_0a_1a_2.......a_{n-1}$ having n digits.

Firstly, we can easily exclude negative integers from the race as the number will be negative and sum of squares will be positive (we can never equate negative and positive).

Now comes the turn of non negative integers.

As we have assume that there exist an integer which satisfy our condition so, it should yield us:

$$10^{n-1}a_0+10^{n-2}a_1+.........10a_{n-2}+a_{n-1}={a_0}^2+{a_1}^2+.......{a_{n-2}}^2+{a_{n-1}}^2$$ Which on further solving becomes, $$a_0(10^{n-1}-a_0)+a_1(10^{n-2}-a_1)+.........+a_{n-2}(10-a_{n-2})+a_{n-1}(1-a_{n-1})=0$$ $$a_0(10^{n-1}-a_0)+a_1(10^{n-2}-a_1)+.........+a_{n-2}(10-a_{n-2})=a_{n-1}(a_{n-1}-1)$$

Now, the hardest part for me comes:

The terms of left are all positive and they increase as we keep on going towards left.

We can only compare the terms $$a_{n-1}(a_{n-1}-1)$$ and $$a_{n-2}(10-a_{n-2})$$ because the shortest of other terms is too far from comparison.

Now if we make some comparison, we will have $$a_{n-1}(a_{n-1}-1)=a_{n-2}(10-a_{n-2})$$

Now let's form a table for the function on RHS:

$$\begin{array}{c|c} a_{n-2}& a_{n-2}(10-a_{n-2})\\\hline 0& 0\\ 1& 9\\ 2& 16\\ 3& 21\\ 4& 24\\ 5& 25\\ 6& 24\\ 7& 21\\ 8& 16\\ 9& 9 \end{array}$$

Again, we form a table and this time for the function on LHS:

$$\begin{array}{c|c} a_{n-1}& a_{n-1}(a_{n-1}-1)\\\hline 0& 0\\ 1& 0\\ 2& 2\\ 3& 6\\ 4& 12\\ 5& 20\\ 6& 30\\ 7& 42\\ 8& 56\\ 9& 72 \end{array}$$ Now we have all possible values of $a_{n-1}(a_{n-1}-1)$ and $a_{n-2}(10-a_{n-2})$ and A quick look at tables yield that the only common value $a_{n-1}(a_{n-1}-1)$ and $a_{n-2}(10-a_{n-2})$ have is $0$.

So the condition is followed when ($a_{n-1}$ ,$a_{n-2}$ )=($0,0$) and ($1,0$). Or $1$ and $0$ are the only numbers which follow the condition.{ There is no integer (having any numbers of digits) except $0$ and $1$, sum of squares of whose digits is equal to number itself is proved}.

I hope you guys will understand that such questions are hard to write (specially for someone like me who is a beginer at Mathjax). So, if you have any problem in understanding, leave comment. I shall be thankful if someone can verify my proof or can give a new one (with completely different approach). You can suggest modification in my work or give suggestion that where it can be improved.Thanks

  • $\begingroup$ The number of digits of a number will be of the magnitude of its logarithm, you can also work with that. $\endgroup$
    – mathma
    Nov 26, 2016 at 11:49
  • $\begingroup$ @mathma, I knew that. But how it is going to help me here?? $\endgroup$ Nov 26, 2016 at 11:50
  • 1
    $\begingroup$ LONE WOLF It may give you conditions on the length of the resulting number when you sum squares of digits. $\endgroup$
    – mathma
    Nov 26, 2016 at 11:54
  • 1
    $\begingroup$ Side note: I, too, am puzzled by the downvote (and have upvoted the post). The OP states a clear, non-trivial, question and shows a very fleshed out argument in support of the proposed solution. What more can one ask? $\endgroup$
    – lulu
    Nov 26, 2016 at 13:04
  • 1
    $\begingroup$ In general if you wprk with a fixed power of the digits of a number $\overline {a_{1}\ldots a_{n}}$, since $ a_{1}^k+\ldots a_{n}^k\le n9^k$, but $10^{n-1}\ge n9^k $, so there are only finitely values for $ n $. $\endgroup$
    – Xam
    Nov 26, 2016 at 13:11

2 Answers 2


Your argument is good, though a little vague at the end. I would tighten it up by remarking that $$a_{n-k}>0\implies a_{n-k}\left(10^{n-1-k}-a_{n-k}\right)>1\times \left(10^{n-1-k}-9\right)$$ which is greater than $99$ for all the terms you wish to discard. In that way, you reduce the problem to two digit cases, and you resolve those correctly.

An algebraically simpler argument: If your integer has $n$ digits, then the sum of squares can be at most $81n$. But we have $$10^{n-1}≤81n\implies n≤3$$ so your number can have at most $3$ digits. Noting that $81\times 3= 243$ we see that in fact we only have to check up up $243$. This can easily be checked by (mechanically assisted) hand.

  • $\begingroup$ That's alright, but is there any problem in my proof?? $\endgroup$ Nov 26, 2016 at 12:47
  • 1
    $\begingroup$ Your argument gets a little hazy at the end...with "the shortest of the other terms is too far from comparison". You need to bound the terms explicitly, for example the right hand is at most $72$. If you do that, I expect you'll end up with my argument. Maybe you can do better and show that the number can have at most $2$ digits...that would make it a paper and pencil problem. $\endgroup$
    – lulu
    Nov 26, 2016 at 12:53
  • $\begingroup$ Okay, thanks @lulu $\endgroup$ Nov 26, 2016 at 12:55
  • 1
    $\begingroup$ Indeed, the third term, $a_{n-3}(10^2-a_{n-3})≥99$ which, of course, is greater than $72$. Thus your equality rules out three digit numbers. So...I agree, your method significantly reduces the finite set you need to look at. I stopped as soon as I got to a finite collection that was easy to run on the computer. Your method is better in that it reduces the problem to something you can easily check by hand. $\endgroup$
    – lulu
    Nov 26, 2016 at 12:56
  • 1
    $\begingroup$ I would tend to agree with @Charter .... As the article I linked to on Narcissistic Numbers shows, people have gone over all these. And I'd agree with the author of that article that, to date, nobody has found good number theoretic properties of these numbers...making the problems more interesting as puzzles than anything else. They are definitely good puzzles though. $\endgroup$
    – lulu
    Nov 26, 2016 at 13:19

The problem requires $$ \begin{align} 0 &=\sum_{k=0}^n\left(10^kd_k-d_k^2\right)\\ &=\sum_{k=0}^nd_k\left(10^k-d_k\right) \end{align} $$ The only negative term can be $d_0(1-d_0)\ge-72$.
For $k\ge2$, if $d_k\ne0$, then $d_k\left(10^k-d_k\right)\ge10^k-1\ge99$.
Therefore, only $d_0,d_1$ can be non-zero. So we just need to find $d_0,d_1$ so that $$ d_1(10-d_1)=d_0(d_0-1) $$ However $$ d_1(10-d_1)\in\{0,9,16,21,24,25\} $$ while $$ d_0(d_0-1)\in\{0,2,6,12,20,30,42,56,72\} $$ The only way they can be equal is if both are $0$ and that requires $d_1=0$ and $d_0\in\{0,1\}$.

That is, the only solutions are $0$ and $1$.

Your proof was a bit difficult to read, but it looks similar.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .