<s>[INST] Find the number of all 3 digit numbers $n$ such that $S(S(n))=2$ For any natural number $n$ ,let $S(n)$ denote the sum of the digits of $n$.Find the number of all 3 digit numbers $n$ such that $S(S(n))=2$ 
 [/INST] First, by the nice answer/hint provided by mfl, the only way that $S(S(n)) = 2$ is if $a+b+c = 2$ or $11$ or $20$. 
Next, suppose that $a$, $b$, and $c$ are digits with $a+b+c=2$ or $11$ or $20$. Then since,
$$100a+10b+c+9 = 100a + 10(b+1) + (c-1),$$
the new digits are either $a$, $b+1$, and $c-1$ (when $c>0$) or $a$, $b$, and $c+9$ (when $c=0$).  Now, if the new digits are $a$, $b+1$, and $c-1$, then the new digit sum is the same.  If the new digits are $a$, $b$, and $c+9$, then the new digits sum is increased by $9$.  Now, there are three cases:


*

*$a+b+c=2$, in which case $a+b+c+9=11$ so that $S(S(n))=2$,

*$a+b+c=11$, in which case $a+b+c+9=20$ so that again $S(S(n))=2$, or

*$a+b+c=20$.  But in this case we can't have $c=0$ so that the new digits are $a$, $b-1$, and $c-1$.  Thus, the new digit sum is the same as the original and again $S(S(n))=2$.


As a result $S(S(n))=2$ iff $S(S(n+9))=2$.  There's now a simple pattern that leads to the count of 100 such integers.  Here they are:

</s>