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$
Find the number of all 3 digit numbers $n$ such that $S(S(n))=2$
1.5k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 5 best solutions below
On
Update
Mark McClure's answer suggests the following "structural" approach:
From $10\equiv1\ (9)$ it follows by the rules of elementary number theory that $10^r\equiv1 \ (9)$ for all $r\geq0$, and this in turn implies $$S(n)\equiv n \ \ (9)\qquad\forall\ n\geq0\ .\tag{1}$$
Claim: When $0\leq n\leq 2998$ then $$S\bigl(S(n))\bigr)=2\quad\Longleftrightarrow\quad n\equiv2 \ (9)\ .$$ Proof. The principle $(1)$ immediately implies $\Rightarrow$. Conversely, let $n$ be within the given bounds, and assume $n\equiv2 \ (9)$. Then $0\leq S(n)<29$ and $S(n)\equiv2 \ (9)$. It follows that $S(n)\in\{2,11,20\}$, whence $S\bigl(S(n)\bigr)=2$.
Since there are $900$ consecutive three digit numbers in all, exactly $100$ of them are $\equiv2 \ (9)$. It follows that the answer to the problem is $100$.
On
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:

On
The maximum value of S(n) where $n$ is a three digit number is 27. Thus $S(n)$ is from $1$ to $27$. Now we find the numbers $k$ from $1$ to $27$ such that $S(k)=2$. We can see that only $2$, $11$, and $20$ satisfy. Thus the sum of the digits of the 3 digit number must be $2$, $11$, or $20$.
So the sum of the digits is 2 mod 9. (Those are actually all the possible 2 mod 9 sums of digits)
So we consider any streak of 9 numbers. Exactly one of them is 2 mod 9. We can find 900/9=100 independent streaks of 9 numbers among the 3 digit numbers, so the answer is $\boxed{100}$.
On
Here is a short and general proof:
Since we know that for all natural numbers $n$,
$$n\equiv k\pmod 9\iff S(n)\equiv k\pmod 9$$
we get,
$$S(n)\equiv k\pmod 9\iff S(S(n))\equiv k\pmod 9$$
from which we derive:
$$n\equiv k\pmod 9\iff S(S(n))\equiv k\pmod 9$$
Take $k=2$ and count the $n$s such that $100\le n<1000$.
Write $n=abc=100a+10b+c.$ Then, $S(n)=a+b+c.$ Note that $S(n)$ has two digits. Then,
if $a+b+c<10$ then $a+b+c=2$ (since $S(S(n))=a+b+c);$
if $10\le a+b+c<20$ then $a+b+c=11$ (since $S(S(n))=a+b+c-9);$
if $20\le a+b+c$ then $a+b+c=20$ (since $S(S(n))=a+b+c-18).$