Problem:
For any positive integer x, let S(x) be the sum of the digits of x, and let T(x) be β£S(x+2)βS(x)β£. For example, T(199)=β£S(201)βS(199)β£=β£3β19β£=16. How many values T(x) do not exceed 1999?
Solution:
If the final digit of x is less than 8, then S(x+2)=2+S(x), so T(x)=2. When the last digit of x is 8, then x has the form Aβ£Bβ£8, where B is a block of k nines, k is nonnegative, and the final digit of the block A is not 9. Because x+2 has the form (A+1)β£Z, where Z is a block of k+1 zeros, it follows that T(x)=S(x)βS(x+2)= S(A)+9k+8βS(A+1)=S(A)+9k+8βS(A)β1=9k+7. When the last digit of x is 9, then x has the form Aβ£B, where B is a block of k nines, k is positive, and the final digit of A is not 9. Because x+2 has the form (A+1)β£Zβ£1, where Z is a block of kβ1 zeros, it follows that T(x)=S(x)βS(x+2)=S(A)+9kβS(A+1)β1=9kβ2. Notice that the sequence 9k+7 for nonnegative k coincides with the sequence 9kβ2 for positive k. Thus T can have the values 7,16,25,β¦,1996, and2.There are 91β(1996β(β2))+1=223β values in all.
The problems on this page are the property of the MAA's American Mathematics Competitions