1

I suspect this problem involves a recurrence relation, but I can't figure out how to start... Can someone help me?

thanks!

marcos
  • 341

2 Answers2

4

There’s no real need to look for a recurrence when you want the answer only for a single short length. $7$ is so small that it’s probably easiest to do it by hand. The cases are $001xxxx$, $1001xxx$, $x1001xx$, and their mirror images.

  • $x1001xx$: The first bit is arbitrary, and the last two can be anything but $00$, for a total of $2\cdot 3=6$ strings.

  • $1001xxx$: How many of the $8$ possible continuations are ruled out?

  • $001xxxx$: Break this into the subcases $0011xxx$ and $0010xxx$ and use what you’ve already done.

Don’t forget to double to account for the mirror images. Does this count anything twice (i.e., is any acceptable string its own mirror image)?

If you need the general solution, Ross’s approach is as straightforward as any.

Brian M. Scott
  • 616,228
1

Hint: If you let A(n) be the number of n-bit strings without two consecutive zeros and ending in 1, B(n) be the number of n-bit strings with two consecutive zeros and ending in 1, C(n) be the number of n-bit strings without two consecutive zeros and ending in 0, D(n) be the number of n-bit strings with two consecutive zeros and ending in 0, you can set up a set of linked recurrences. Imagine adding each of 1 and 0 to each type of string and find where it goes. Then your final answer is B(7)+D(7). A good check is to define E(n) as the number of strings that have failed, either by having three zeros in a row or having two sets of two. Then you should have accounted for all the strings.

Ross Millikan
  • 374,822