Skip to main content

2004 AIME II Problem 10

Problem 10 of 15IntermediateNumber TheoryCombinatoricsArithmetic

Let S\mathcal{S} be the set of integers between 11 and 2402^{40} whose binary expansions have exactly two 11’s. If a number is chosen at random from S,\mathcal{S}, the probability that it is divisible by 99 is pq,\frac{p}{q}, where pp and qq are relatively prime positive integers. Find p+q.p + q.

Your answer

Integer from 0 to 999
Show solution

Solution

The set S\mathcal{S} consists of the (402)=780\binom{40}{2} = 780 numbers 2a+2b2^a + 2^b with 0≤a<b≤39.0 \le a \lt b \le 39. Since 2a2^a is coprime to 9,9, we have 2a(2b−a+1)2^a(2^{b-a} + 1) divisible by 99 exactly when 2b−a≡−1(mod9).2^{b-a} \equiv -1 \pmod{9}. The powers of 22 modulo 99 cycle through 2,4,8,7,5,12, 4, 8, 7, 5, 1 with period 6,6, so 2d≡8≡−12^d \equiv 8 \equiv -1 exactly when d≡3(mod6).d \equiv 3 \pmod{6}. For each difference d=b−ad = b - a there are 40−d40 - d pairs, so the number of multiples of 99 in S\mathcal{S} is ∑d=3,9,…,39(40−d)=37+31+25+19+13+7+1=133. \begin{aligned} &\sum_{d = 3, 9, \ldots, 39} (40 - d) \\ &= 37 + 31 + 25 \\ &\quad {}+ 19 + 13 + 7 + 1 \\ &= 133. \end{aligned} The probability is 133780,\frac{133}{780}, and since 133=7⋅19133 = 7 \cdot 19 while 780=22⋅3⋅5⋅13,780 = 2^2 \cdot 3 \cdot 5 \cdot 13, it is in lowest terms. Thus p+q=133+780=913.p + q = 133 + 780 = 913.
AoPS wiki

Tagged: number base · modular exponentiation · multiplicative order · counting pairs

More practice