This week the question is: How Many Times Can You Add Up the Digits?
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.
And let’s look at the extra credit puzzle too:
For how many whole numbers N between 1 and 10,000 (inclusive, not that it matters) does f(N) = 3?
And here’s my suggested solution, highlight to reveal:
For the first puzzle, I created a small program, to explore what’s going on.
If I’m looking for the lowest N, f(N) = 2, 19 is a good bet. Likewise, for f(N) = 3, we can use 199. Then my program broke down, when I tried to move to 4…
Let’s look at this a different way. The digit sum for 199 is 19. The digit sum for 19 is 10. The digit sum for 10 is 1. Aha! There’s something going on here. N = 19 (read, one 1, one 9) gets me to f(N)=2. N = 199 (read, one 1, two 9s) gets me to f(N)=3. There’s something very efficient about using 9s. Few digits, big sum. Question is, how do we take the next step? Well, 199 = 1 + 22*9. So it might be 19999999999999999999999 (read, one 1, twentytwo 9s). And I can’t think of a reason, why anything smaller would work.
For the second puzzle, I modified the earlier code into a new program. This time I’m testing all the numbers, counting all those where I get 3. And the answer is 945.