1999 AIME Problem 5

Attempt Problem 5 of the 1999 AIME below, then check your answer against the professionally curated solution from LIVE by Po-Shen Loh. You can also try the full timed exam, view all 1999 AIME solutions, or check the answer key.

All problems are used with official legal permission of the Mathematical Association of America (MAA).

5.

For any positive integer x,x, let S(x)S(x) be the sum of the digits of x,x, and let T(x)T(x) be S(x+2)S(x).|S(x + 2) - S(x)|. For example, T(199)T(199) =S(201)S(199)= |S(201) - S(199)| =319= |3 - 19| =16.= 16. How many values T(x)T(x) do not exceed 1999?1999?

Answer: 223
Concepts:digitsarithmetic sequencecasework
Difficulty rating: 2400
Solution:

If the last digit of xx is at most 7,7, adding 22 changes no other digit, so T(x)=2.T(x) = 2. Otherwise there is carrying. If xx ends in the digit 88 preceded by exactly m0m \ge 0 nines, then x+2x + 2 replaces a99m8\ldots a\underbrace{9 \cdots 9}_{m}8 by (a+1)00m0,\ldots (a{+}1)\underbrace{0 \cdots 0}_{m}0, so S(x+2)S(x)=19m8S(x + 2) - S(x) = 1 - 9m - 8 and T(x)=9m+7.T(x) = 9m + 7. If xx ends in exactly m1m \ge 1 nines, then x+2x + 2 replaces a99m\ldots a\underbrace{9 \cdots 9}_{m} by (a+1)00m11,\ldots (a{+}1)\underbrace{0 \cdots 0}_{m - 1}1, so S(x+2)S(x)=29mS(x + 2) - S(x) = 2 - 9m and T(x)=9m2.T(x) = 9m - 2.

Both carrying families give exactly the values 7,16,25,,7, 16, 25, \ldots, that is, 9j+79j + 7 for j0,j \ge 0, and every such value occurs. So the possible values of TT are 22 together with all 9j+7.9j + 7. Requiring 9j+719999j + 7 \le 1999 gives j221,j \le 221, which is 222222 values, and T=2T = 2 adds one more, for a total of 223.223.

← Problem 4#4
Full Exam

Problem 5 in Other Years