I got a question recently, and I am unable to solve it.
Find all natural numbers $N$, With sum of digits $S(N)$, where $N=2\{S(N)\}^2$
I know that $9|N-S(N)$, and since N is twice a square, it must end in $0,2,8$. But I do not know where to go from here. Can anyone help?
The Official Solution from the Organization
We use the fact that $9|n−S(n)$ for every natural number $n$. Hence $S(n)(2S(n)−1)$ is divisible by $9$. Since $S(n)$ and $2S(n)−1$ are relatively prime, it follows that $9$ divides either $S(n)$ or $2S(n)−1$, but not both. We also observe that the number of digits of $n$ cannot exceed $4$. If $n$ has $k$ digits, then $n≥10k−1$ and $$2S(n)^2≤2\cdot(9k)^2=162k^2$$ If $k≥6$, we see that $$2S(n)^2≤162k^2<5^4k^2<10^{k−1}≤n$$ If $k = 5$, we have $$2S(n)^2≤162\cdot25=4150<10^4≤n$$ Therefore $n ≤ 4$ and $S(n) ≤ 36$. If $9|S(n)$, then $S(n) = 9,18,27,36$. We see that $2S(n)^2$ is respectively equal to $162, 648, 1458, 2592$. Only $162$ and $648$ satisfy $n = 2S(n)^2$. If $9|(2S(n)−1)$, then $2S(n) = 9k+1$. Only $k = 1,3,5,7$ give integer values for $S(n)$. In these cases $2S(n)^2 = 50,392,1058,2048$. Here again $50$ and $392$ give $n = 2S(n)^2$. Thus the only natural numbers wth the property $n = 2S(n)^2$ are $50,162,392,648$.