<s>[INST] Find all natural numbers $n$ where $n<1000$ such that cube of sum of the digits of $n$ be equal to $n^2$ 
Find all natural numbers $n$ where $n<1000$ such that cube of sum of
the digits of $n$ be equal to $n^2$

For one digit numbers $n=1$ is the only answer. For two digits numbers $\overline{ab}$:
$$(10a+b)^2=(a+b)^3$$
$$100a^2+20ab+b^2=a^3+3a^2b+3ab^2+b^3$$
But it seems this method doesn't work because I can't simplify above equation.
 [/INST] Use @lulu's notation for $S(n)$ to denote the sum of digits of $n$.  Using @NeatMath's observation that $(S(n))^3 = n^2$, we see that $n$ is a perfect cube, so it suffices to check the set $\{1^3,2^3,\dots,9^3\}$, due to the constraint $n < 1000 = 10^3$.  You might include $0$ if you have an affirmative answer to Is $0$ a natural number?.  $0$ and $1$ are trivial solutions.
@lulu's criterion $n^3 \equiv n^2 \pmod9$ restricts the searching to $1^3$, $3^3$, $6^3$ and $9^3$ because if $\gcd(n,9) = 1$, then the cancellation law gives $n\equiv1\pmod9$.




$n$
$S(n)$
$(S(n))^3$
$n^2$




$1^3 = 1$
$1$
$1$
$1$


$3^3 = 27$
$2+7 = 9$
$9^3 = 729$
$729$


$6^3 = 216$
$2+1+6 = 9$
$9^3 = 729$
$46656$


$9^3 = 729$
$7+2+9 = 18$
$18^3 = 5832$
$531441$




Hence, there's only two solutions $1$ and $27$.
</s>