How many sequences of s and s of length are there that begin with a , end with a , contain no two consecutive s, and contain no three consecutive s?
- A)
- B)
- C)
- D)
- E)
Answer
C
Key insight
After the first 0, the string breaks into pieces 10 and 110. Count how many of each fit into 18 more digits, then choose where the long pieces go.
Solution
The rules say what can sit between two s, so cut the string at its s.
Step 1: the building blocks.
- Two s can never be next to each other, so between neighboring s there is at least one .
- There are never three s in a row, so between neighboring s there are at most two s.
- The string starts and ends with . So after the first , it is a chain of blocks, each block being or . For example, is the string .
Step 2: how many blocks?
4. Say there are blocks, and of them are the long block . The short blocks have digits and the long ones , so the total length is
5. The number of long blocks is between and . So means , and means .
Step 3: count the arrangements. For each , choose which of the block positions hold the long blocks.
| blocks | long blocks | ways |
|---|---|---|
Total: .
The answer is .
Why this works
Rules like "no two s in a row" and "no three s in a row" limit what can appear between the s. That turns the string into a chain of a few allowed blocks, and counting chains of a given length is just choosing where the long blocks go. Look for this block picture before writing a long list.
Alternative approach
Let count the good strings of length . Every good string longer than ends with the block or , and removing it leaves a shorter good string. So , starting from (the string ), , (the string ). The values for are
So .
The trap
Forgetting the piece 110, or allowing 1110, or setting up the wrong recurrence (like Fibonacci) and getting a wrong count.
Concise solution
Between consecutive s there must be at least one (no ) and at most two (no ). So after the initial , the string is a sequence of blocks, each either or .
Suppose there are blocks, of which are . The length is
Since , we need . For each , choose which of the blocks are the long ones:
| 6 | 6 | 1 |
| 7 | 4 | 35 |
| 8 | 2 | 28 |
| 9 | 0 | 1 |
Total: .
The answer is .
Review in the AoPS books
- Intermediate Counting & Probability, Chapter 10: Recursion (§10.2, §10.3)
- Introduction to Counting & Probability, Chapter 1: Counting Is Arithmetic
- Intermediate Counting & Probability, Chapter 4: Constructive Counting and 1-1 Correspondences (§4.4, §4.5, §4.6)
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques (§2.2)
Techniques
Map the objects to something easier to count · Split into exhaustive cases and handle each