For any positive, base-$10$ integer $N$, define $f(N)$ as the number of times you have to add up its digits until you get a one-digit number. For example, $f(23) = 1$ because $2+3 = 5$, a one-digit number. Meanwhile, $f(888) = 2,$ since $8+8+8 = 24,$ a two-digit number, and then adding up those digits gives you $2+4 = 6,$ a one-digit number. Find the smallest whole number $N$ such that $f(N) = 4.$
Clearly $\min f^{-1}(\{1\}) = 10,$ so we must figure out what the smallest integer whose base-$10$ digits sum to $10.$ In this case, we can guess and peck, and arrive at $19$. It becomes slightly harder to figure out the smallest integer whose base-$10$ digits sum to $19.$ Certainly there are no two digit numbers that sum to 19, since the maximum sum of base-$10$ digits of any two digit number is $18$. So let's look for three digit numbers $N = 100a + 10b + c$ where $a + b + c = 19,$ $a \in \{1, 2, \dots, 9\}$ and $b, c \in \{0, 1, \dots, 9\}.$ Obviously the minimal number involves $a = 1,$ where then $b=c=9.$
So we have $f(199) = 3.$ However, we want to now figure out what is the smallest integer whose base-$10$ digits sum to $199,$ since this will give us $\min f^{-1}(\{4\}).$ Since any $22$ digit number will sum to no more than $198,$ we should look for a $23$ digit number. In particular, if the first digit is a $1$ and it is followed by twenty-two $9$'s, then we would get $199$ as the sum of the digits. So, $N = 19,999,999,999,999,999,999,999$ is the smallest integer with $f(N) = 4.$
Let's enumerate the first $10,000$ values of the function $f.$ We can see that $f(N) = 0$ for $N \in \{1, 2, \dots, 9\}.$ As we saw before, $f(N) = 1$ for $N = 10, 11, dots, 18$ and then $f(19) = 2.$ Similarly, $f(N) = 1$ for $N = 20, \dots, 27$ and then $f(N) = 2$ for $N = 28$ and $N=29.$ Since, the maximum sum of the digits for of any integer $N \leq 10,000$ is $36,$ if all we wanted to do is determine which numbers in the first $10,000$ have value $f(N) = 3,$ we therefore only need to worry about numbers $N$ whose digits sum to either $19,$ $28$ or $29.$
We have already seen that, e.g., $199$ satisfies $f(199) = 3.$ By cleverly adding $90$ and $99,$ both of which preserve the total sum of digits provided that the $1000$'s digit remains unchanged, that there are $44$ other three digit numbers $N$ with $f(N) = 3,$ namely $289,$ $298,$ $379,$ $388,$ $398,$ $469,$ $478,$ $487,$ $496,$ $559,$ $568,$ $577,$ $586,$ $595,$ $649,$ $658,$ $667,$ $676,$ $685,$ $694,$ $739,$ $748,$ $757,$ $766,$ $775,$ $784,$ $793,$ $829,$ $838,$ $847,$ $856,$ $865,$ $874,$ $883,$ $892,$ $919,$ $928,$ $937,$ $946,$ $955,$ $964,$ $973,$ $982,$ and $991.$ We can continue adding other cleverly conjured addends (e.g., $900$) that preserve the sum of digits, or just let some even smarter computer run through all of the numbers for us. In the end, we get a total of $945$ integers $N$ with $1\leq N \leq 10,000$ and $f(N)=3$.
No comments:
Post a Comment