Problem

Source: RMO Mumbai 2016, P3

Tags: number theory, inequalities, sum of digits



For any natural number $n$, expressed in base $10$, let $S(n)$ denote the sum of all digits of $n$. Find all natural numbers $n$ such that $n=2S(n)^2$.