Let be a sequence of numbers, where each is either or . For each positive integer , define Suppose for all . What is the value of the sum
- A)
- B)
- C)
- D)
- E)
Answer
A
Key insight
Write the first few S_n in binary. After the first 1 the bits repeat 1, 1, 0, so bits at multiples of 3 are 0.
Solution
is the number whose binary digits, from the right, are . The condition means: leaves remainder when divided by . The target just needs the four bits to .
- Only one choice at each stage. is between and . If two such numbers and both worked, would be a multiple of . Since is odd, itself would be a multiple of , so . Also, the last bits of form a number that passes the test for (dropping the top bit subtracts a multiple of , which does not change the remainder), so they form . So there is one fixed string of bits, and each is its last bits.
- Small cases. Find each by adding the next bit (either or the next power of ) and testing.
| check | binary | ||
|---|---|---|---|
Reading from the right: , then and . So exactly when is a positive multiple of .
3. Why the pattern continues. In binary . Let be the binary number with blocks. Multiplying by turns each into , so ( ones) .
4. Build the answer from . Let . Then
which leaves remainder when divided by . So .
5. in binary. . Subtracting from just flips each bit of , giving . Adding gives . This is exactly the pattern from step 2, for as many blocks as we like.
6. Read off the bits. and are multiples of , so . The positions and are not, so .
7. The sum. .
The answer is .
Why this works
The bits repeat because is one more than , just as the decimal digits of repeat because is a multiple of . Computing a handful of small cases shows the pattern, and the fact that in binary proves it. When a problem asks about a far-away term, look for a repeating cycle first.
The trap
Guessing the pattern from the first three bits (all 1s) instead of computing a few more terms to see the repeating 0, 1, 1 pattern.
Concise solution
is the -bit binary number , so the condition says is the unique inverse of modulo ; each is determined, and adds one bit on top. The desired sum is the -bit block .
Small cases (each checked directly, e.g. ): , , , , , , . The bits are : after the block seems to repeat.
Proof of the pattern: since , the number is an integer, with binary form ( blocks). Let . Then
and , so . In binary, is the bitwise complement of plus one: . Reading from the bottom, and for , exactly when .
Take so . Then (), , , ().
The sum is .
The answer is .
Review in the AoPS books
- Introduction to Number Theory, Chapter 12: Introduction to Modular Arithmetic
- Introduction to Number Theory, Chapter 8: Base Numbers
- Prealgebra, Chapter 15: Problem-Solving Strategies (§15.1)
- Introduction to Algebra, Chapter 11: Special Factorizations
Techniques
Apply an identity: SFFT, sum of squares, difference of cubes, Vieta · Compute small cases, spot the pattern, generalize