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
Digit sums are small, so n must be between 1969 and 2007. A remainder argument with 9 shows n is a multiple of 3, leaving 13 numbers to test.
Solution
The digit sums are tiny compared with , so must be close to . First find how close, then shrink the list, then test.
Step 1: is at least .
- is less than . Among such numbers, the largest digit sum is .
- So is at most . Among numbers up to , the largest digit sum is . So is at most .
- Therefore .
Step 2: must be a multiple of .
- A number and its digit sum leave the same remainder when divided by . (For example, and both leave remainder .) So , and all leave the same remainder; call it .
- Then leaves the same remainder as . This sum is , and is a multiple of . So must be a multiple of , which means is , or . In every case is a multiple of .
Step 3: test the multiples of from to .
| 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 |
The total is for and : four values.
The answer is .
Why this works
Digit-sum problems use two tools. First, a digit sum is small (at most for each digit), which squeezes into a short range. Second, a number and its digit sum leave the same remainder when divided by , which removes most of that range. What is left is short enough to check by hand.
Alternative approach
Skip Step 2 and test every from to . That is numbers, but they go quickly in groups of ten, because the digit sum goes up by each time until the last digit rolls over. You find the same four values; the multiple-of- filter just saves time.
The trap
Starting the search too high by forgetting the S(S(n)) term, or giving up because testing every number looks too long without the multiple-of-3 filter.
Concise 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 .
Review in the AoPS books
- Introduction to Number Theory, Chapter 8: Base Numbers
- Introduction to Number Theory, Chapter 12: Introduction to Modular Arithmetic
- Prealgebra, Chapter 15: Problem-Solving Strategies (§15.2)
- Introduction to Number Theory, Chapter 9: Base Number Arithmetic
Techniques
Bound the quantity above/below or estimate to pin it down · Organized listing / direct enumeration