2. Determine all positive integers $n$ such that $n$ equals the square of the sum of the digits of $n$.
2. Let $s(n)$ denote the sum of all the digits of $n$. Suppose $n$ is a positive integer such that $s(n)^{2}=n$. Let $s(n)=k$ so that $n=k^{2}$. Then $s\left(k^{2}\right)=s(n)=k$. Let $10^{r-1} \leq k<10^{r}$, where $r$ is a positive integer. That is $k$ has exactly $r$ digits. From $10^{r-1} \leq k$, we have $r \leq \log k+1$. From $k<10^{r}$, we have $k^{2}<10^{2 r}$ so that $k^{2}$ has at most $2 r$ digits. Therefore, $s\left(k^{2}\right) \leq 9 \times 2 r=18 r \leq 18 \log k+18$ which is less than $k$ if $k \geq 50$. Thus the equation $s\left(k^{2}\right)=k$ has no solution in $k$ if $k \geq 50$.

Let $k<50$ and $s\left(k^{2}\right)=k$. Taking $\bmod 9$, we get $k^{2} \equiv k \quad(\bmod 9)$. Thus $k \equiv 0,1$ $(\bmod 9)$. That is $k=1,9,10,18,19,27,28,36,37,45,46$. Only when $k=1$ and $k=9$, we have $s\left(k^{2}\right)=k$. The corresponding solutions for $n$ are $n=1$ or 81 .