$n$ is twice the sum of squares of digits of $n$

129 Views Asked by At

Let $f(n)$ denote the sum of squares of digits of $n$, that is

$$ f(10k+r) = \begin{cases} r^2 + f(k) &\text{for }10k+r \neq 0,\\ 0&\text{otherwise}. \end{cases} $$ I've found (while investigating this question) that solutions for

$$n = 2f(n)$$

are quite rare, namely there are only three for $n \leq 10^{10}$ \begin{align} 0 &= 2f(0), \\ 50 &= 2f(50), \\ 298 &= 2f(298). \end{align}

Are there any other solutions (perhaps infinitely many)?

3

There are 3 best solutions below

0
On BEST ANSWER

Assume $n$ is a solution to your problem and has $k$ digits in decimal representation. Then $162k \ge 2f(n)=n \ge 10^{k-1}$, especially $162k \ge 10^{k-1}$. But it's easy to see that this only holds for $k \le 3$. Hence, we are only left to check all the numbers from 1 up to 1000 which you apparently already did. Thus, no more solutions.

0
On

If you've found all of them for $n \leq 10^{10}$, you've found them all.

You didn't need to go that high, in fact. Note that the maximum of $f(n)$ for an $m-$digit number is $81m$ (all $9$'s), so twice this value is already less than the minimum value for an $m-$digit number when $m=4$.

0
On

The number of digits of $n$ is at most $1+\log_{10} n$, and each digit is $\le9$, of course, so $$f(n)\le81(1+\log_{10}n)$$

If you assume that $2f(n)=n$, you get $$n\le162(1+\log_{10}n)\qquad(*)$$

Now define for $x>0$:

$$g(x)=162(1+\log_{10}x)-x$$

and compute its derivative $$g'(x)=\frac{162}{x\ln 10}-1$$

Notice that it is negative for $x>162/\ln10$ or for $x\ge 71$.

But $g(1000)<0$, so $g$ is negative for any number with four digits or more. That is, the necessary condition $(*)$ does not hold.

Therefore, there are not more solutions.