Skip to main content

AMC 12 Mock Exam 9 Problem 20

Problem 20 of 25

For a positive integer mm, let S(m)S(m) denote the sum of the digits of mm in base ten. For example, S(507)=12S(507)=12. How many positive integers n<108n<10^8 have the property that both S(n)S(n) and S(n+1)S(n+1) are divisible by 1111?

Answer choices

Show solution

Solution

If nn ends in exactly tt nines, adding 11 turns those nines into zeros and raises the next digit by 11, so S(n+1)=S(n)+1−9tS(n+1)=S(n)+1-9t. If 1111 divides both digit sums, then 11∣9t−111\mid 9t-1. Since 9⋅5=45≡1(mod11)9\cdot5=45\equiv1\pmod{11}, this means t≡5(mod11)t\equiv5\pmod{11}. A number below 10810^8 has at most 88 digits, so t=5t=5. Conversely, if t=5t=5 and 11∣S(n)11\mid S(n), then S(n+1)=S(n)−44S(n+1)=S(n)-44 is also a multiple of 1111.

So we count n<108n<10^8 that end in exactly five nines and have 11∣S(n)11\mid S(n). Write n=106m+105e+99999n=10^6m+10^5e+99999 with 0≤m≤990\le m\le99 and 0≤e≤80\le e\le8. Then S(n)=S(m)+e+45S(n)=S(m)+e+45, and we need S(m)+e≡−45≡10(mod11)S(m)+e\equiv-45\equiv10\pmod{11}. Since 0≤S(m)+e≤18+8=260\le S(m)+e\le18+8=26, the requirement is S(m)+e=10S(m)+e=10 or 2121.

Let N(s)N(s) be the number of m∈{0,…,99}m\in\{0,\dots,99\} with S(m)=sS(m)=s. Then N(s)=s+1N(s)=s+1 for s≤9s\le9 and N(s)=19−sN(s)=19-s for 9≤s≤189\le s\le18, and N(s)=0N(s)=0 for s>18s>18. Summing over e=0,1,…,8e=0,1,\dots,8: ∑e=08N(10−e)=9+10+9+8+7+6+5+4+3=61,∑e=08N(21−e)=0+0+0+1+2+3+4+5+6=21.\sum_{e=0}^{8}N(10-e)=9+10+9+8+7+6+5+4+3=61,\qquad\sum_{e=0}^{8}N(21-e)=0+0+0+1+2+3+4+5+6=21. The total is 61+21=8261+21=\boxed{82}. (The bound n<107n<10^7 would leave only 88 such numbers. Missing the case S(m)+e=21S(m)+e=21 gives 6161.)

Tagged: digit sums and carries: S(n) and S(n+1)