2

I know there is recurence solution, but thats not what I am interested in, I want pure combinatorial solution, similar to this post. What I tried and started with but never realy finished was:

I know all count of all ternary strings is $3^n$ where n is length of string, so my plan is to subtract $T_n$ from $S_n$ where $T_n$ is number of all ternary strings with "00" substring, I am only able to count part of $T_n$ as it is very problematic since many of those cases overlap. Maybe I am supposed to use inclusion/exclusion principle but I dont know how to use it exactly, I am only aware that something like that exist and maybe could be useful here, but even there you have to count those overlappign cases.

Anyone could give me a hit how to solve it without any recursion ?

lllook
  • 217

1 Answers1

2

How many have $k$ zeroes?

First, select the places where your zeroes are going to go. This problem is choosing $k$ spots, out of $n$, so that no two are consecutive. Here is a solution to that problem, it turns out to be $\binom{n-k+1}{k}$.

After this there are $2^{n-k}$ ways to select the other positions (they can be $1$ or $2$).

Therefore we obtain

$$\sum\limits_{k=0}^{\lceil n/2 \rceil}\binom{n-k+1}{k}2^{n-k}$$

Asinomás
  • 105,651