AMC 10 Step by Step

2007 AMC 10A Problem 25

P21-25~8 minPrint

For each positive integer nn , let S(n)S(n) denote the sum of the digits of n.n. For how many values of nn is n+S(n)+S(S(n))=2007?n + S(n) + S(S(n)) = 2007?

Log in to save your progress.
Show solution without answering

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 nn, so nn must be close to 20072007. First find how close, then shrink the list, then test.

Step 1: nn is at least 19691969.

  1. nn is less than 20072007. Among such numbers, the largest digit sum is S(1999)=1+9+9+9=28S(1999) = 1 + 9 + 9 + 9 = 28.
  2. So S(n)S(n) is at most 2828. Among numbers up to 2828, the largest digit sum is S(19)=10S(19) = 10. So S(S(n))S(S(n)) is at most 1010.
  3. Therefore n=2007−S(n)−S(S(n))≥2007−28−10=1969n = 2007 - S(n) - S(S(n)) \ge 2007 - 28 - 10 = 1969.

Step 2: nn must be a multiple of 33.

  1. A number and its digit sum leave the same remainder when divided by 99. (For example, 19771977 and 1+9+7+7=241 + 9 + 7 + 7 = 24 both leave remainder 66.) So nn, S(n)S(n) and S(S(n))S(S(n)) all leave the same remainder; call it rr.
  2. Then n+S(n)+S(S(n))n + S(n) + S(S(n)) leaves the same remainder as 3r3r. This sum is 20072007, and 2007=9×2232007 = 9 \times 223 is a multiple of 99. So 3r3r must be a multiple of 99, which means rr is 00, 33 or 66. In every case nn is a multiple of 33.

Step 3: test the multiples of 33 from 19711971 to 20072007.

nn1971197419771980198319861989199219951998200120042007
S(n)S(n)18212418212427212427369
S(S(n))S(S(n))9369369369369
total1998199820072007200720162025201620252034200720162025

The total is 20072007 for n=1977,1980,1983n = 1977, 1980, 1983 and 20012001: four values.

The answer is (D) 4\boxed{\textbf{(D)}\ 4}.

Why this works

Digit-sum problems use two tools. First, a digit sum is small (at most 99 for each digit), which squeezes nn into a short range. Second, a number and its digit sum leave the same remainder when divided by 99, which removes most of that range. What is left is short enough to check by hand.

Alternative approach

Skip Step 2 and test every nn from 19691969 to 20072007. That is 3939 numbers, but they go quickly in groups of ten, because the digit sum goes up by 11 each time until the last digit rolls over. You find the same four values; the multiple-of-33 filter just saves time.

Concise solution

A shorter write-up, the way contest solutions are usually written. It may take a different route from the solution above.

Bound the search. Since n<2007n < 2007, nn has at most four digits with the leading one at most 22; the largest digit sum available is S(1999)=28S(1999) = 28, and then S(S(n))≤S(28)=10S(S(n)) \le S(28) = 10 (in fact at most 1010 for any S(n)≤28S(n) \le 28). So
n=2007−S(n)−S(S(n))≥2007−28−10=1969.n = 2007 - S(n) - S(S(n)) \ge 2007 - 28 - 10 = 1969.

Filter by 99. A number is congruent to its digit sum modulo 99, so n≡S(n)≡S(S(n))(mod9)n \equiv S(n) \equiv S(S(n)) \pmod 9. The equation gives 3n≡2007≡0(mod9)3n \equiv 2007 \equiv 0 \pmod 9, hence n≡0(mod3)n \equiv 0 \pmod 3.

That leaves the multiples of 33 from 19711971 to 20072007, thirteen candidates. Compute n+S(n)+S(S(n))n + S(n) + S(S(n)) for each:

nn1971197419771980198319861989199219951998200120042007
S(n)S(n)18212418212427212427369
S(S(n))S(S(n))9369369369369
total1998199820072007200720162025201620252034200720162025

Exactly four values work: n=1977,1980,1983,2001n = 1977, 1980, 1983, 2001.

The answer is (D) 4\boxed{\textbf{(D)}\ 4}.

Review in the AoPS books

Similar problems

Problem © Mathematical Association of America (MAA), American Mathematics Competitions. Reproduced for non-commercial educational use. Solution and commentary are original to this site. Also appeared as 2007 12A #22.