Find a recurrence and appropriate initial conditions for the number of binary strings of length n in which every 0 is immediately preceded or followed by another 0, but not both.

Ashlyn Krause

Ashlyn Krause

Answered question

2022-07-17

Find a recurrence and appropriate initial conditions for the number of binary strings of length n in which every 0 is immediately preceded or followed by another 0, but not both.

Answer & Explanation

taguetzbo

taguetzbo

Beginner2022-07-18Added 16 answers

Step 1
Let us call such a sequence "good" and let a n denote their number.
Clearly any good sequence ends either in 1 or in 00. Let b n denote the number of good sequences that end in 1 and let c n denote the number of good sequences that end in 00. We remark that
a n = b n + c n
Step 2
We can always append a 1 to any good sequence so:
c n = b n 2 = a n 3
We can only append 00 to good sequences that end in 1 so
c n = b n 2 = a n 3
Thus a n = a n 1 + a n 3
Marisol Rivers

Marisol Rivers

Beginner2022-07-19Added 4 answers

Step 1
I think these are the first few instances of all words of that length and the number of words matching the condition:
I think these are the first few instances of all words of that length and the number of words matching the condition:
n = 1
w # 0 1 1
n = 2
w # 00 1 01 10 11 2
n = 3
w # 000 001 1 010 011 100 2 101 110 111 3
n = 4
w # 0000 0001 0010 0011 1 0100 0101 0110 0111 1000 1001 2 1010 1011 1100 3 1101 1110 1111 4
n = 5
w # 00000 00001 00010 00011 00100 1 00101 00110 00111 2 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 10011 3 10100 10101 10110 10111 11000 11001 4 11010 11011 11100 5 11101 11110 11111 6
Step 2
And indeed (lulu beat me by 1 min) the case n = 4 does not agree with your recurrence relation.
We see that all 0 symbols, if showing up at all, must show up in pairs 00 isolated by 1s.

Do you have a similar question?

Recalculate according to your conditions!

New Questions in Discrete math

Ask your question.
Get an expert answer.

Let our experts help you. Answer in as fast as 15 minutes.

Didn't find what you were looking for?