For each positive integer , let denote the sum of the digits of For how many values of is
- A)
- B)
- C)
- D)
- E)
Answer
D
Key insight
S(n) + S(S(n)) is at most 38, so n is at least 1969; mod 9 forces n to be a multiple of 3, leaving 13 candidates to test.
Solution
Bound the search. Since , has at most four digits with the leading one at most ; the largest digit sum available is , and then (in fact at most for any ). So
Filter by . A number is congruent to its digit sum modulo , so . The equation gives , hence .
That leaves the multiples of from to , thirteen candidates. Compute for each:
| 1971 | 1974 | 1977 | 1980 | 1983 | 1986 | 1989 | 1992 | 1995 | 1998 | 2001 | 2004 | 2007 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 18 | 21 | 24 | 18 | 21 | 24 | 27 | 21 | 24 | 27 | 3 | 6 | 9 | |
| 9 | 3 | 6 | 9 | 3 | 6 | 9 | 3 | 6 | 9 | 3 | 6 | 9 | |
| total | 1998 | 1998 | 2007 | 2007 | 2007 | 2016 | 2025 | 2016 | 2025 | 2034 | 2007 | 2016 | 2025 |
Exactly four values work: .
The answer is .
Why this works
Digit-sum equations are tamed by two tools: a size bound (digit sums are tiny compared with the number) that restricts to a short interval, and the mod- invariant that thins the interval further. What remains is a checklist small enough to finish by hand. Whenever appears, think "mod 9" and "at most (number of digits)."
The trap
Testing every n from 1969 to 2007 without the mod-9 filter, or dropping the S(S(n)) term when estimating the bound and starting the search too high.
Common mistakes
- Testing every from to without the mod- filter, or dropping the term when estimating the bound and starting the search too high.
- Concluding from , which would wrongly discard and and leave only .
Techniques
Bound the quantity above/below or estimate to pin it down · Organized listing / direct enumeration