Let's use the inclusion-exclusion method.
First we find the number of bit-strings of length $n$ that don't contain the sequence '000'. We will construct a recursion formula; let $F(n)$ be that number.
- If the first bit is '1' then the rest is just a string of length $n-1$ that doesn't contain '000'
- If the first bits are '01' then the rest is just a string of length $n-2$ that doesn't contain '000'
- If the first bits are '001' then the rest is just a string of length $n-3$ that doesn't contain '000'
Therefore we get:
$F(n) = F(n-1)+F(n-2)+F(n-3)$
With the initial conditions
$F(0) =1, F(1) =2, F(2) =2^2$
With the same method we get:
$G(n) = G(n-1)+G(n-2)+G(n-3)+G(n-4)$
With the initial conditions
$G(0) =1, G(1) =2, G(2) =2^2, G(3)=2^3$
Where $G(n)$ is the number of bit-strings of length $n$ that don't contain the sequence '1111'.
Now, by opening the recursion up we get $F(8)= 149$ and $G(8)=208$
So if we define:
- A = bit-strings of length 8 that contain '000'
- B = bit-strings of length 8 that contain '1111'
and by what we calculated we have $|A| = 2^8-F(8)$ and $|B| = 2^8-G(8)$
What's left to complete inclusion-exclusion is to find the size of $|A\cap B|$, which is easy since the only strings that satisfy both are:
'00001111' , '11110000', '11111000', '00011111', '00011110', '10001111', '01111000', '11110001'
Now the desired number is $|A|+|B|-|A \cap B|$