Skip to main content

1999 AIME Problem 5

Problem 5 of 15EasierAlgebraNumber TheoryProblem-Solving Techniques

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)| =∣3−19∣= |3 - 19| =16.= 16. How many values T(x)T(x) do not exceed 1999?1999?

Your answer

Integer from 0 to 999
Show solution

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 m≥0m \ge 0 nines, then x+2x + 2 replaces …a9⋯9⏟m8\ldots a\underbrace{9 \cdots 9}_{m}8 by …(a+1)0⋯0⏟m0,\ldots (a{+}1)\underbrace{0 \cdots 0}_{m}0, so S(x+2)−S(x)=1−9m−8S(x + 2) - S(x) = 1 - 9m - 8 and T(x)=9m+7.T(x) = 9m + 7. If xx ends in exactly m≥1m \ge 1 nines, then x+2x + 2 replaces …a9⋯9⏟m\ldots a\underbrace{9 \cdots 9}_{m} by …(a+1)0⋯0⏟m−11,\ldots (a{+}1)\underbrace{0 \cdots 0}_{m - 1}1, so S(x+2)−S(x)=2−9mS(x + 2) - S(x) = 2 - 9m and T(x)=9m−2.T(x) = 9m - 2. Both carrying families give exactly the values 7,16,25,…,7, 16, 25, \ldots, that is, 9j+79j + 7 for j≥0,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+7≤19999j + 7 \le 1999 gives j≤221,j \le 221, which is 222222 values, and T=2T = 2 adds one more, for a total of 223.223.
AoPS wiki

Tagged: digits · arithmetic sequence · casework

More practice