Find a recursion formula for the number of binary vectors in length n that doesn't contain $k$ consecutive $1$'s. $(k\geq 2)$
If $n<k$ it's clear there are not limitations therefore $2^n$.
If $n\geq k$, I was thinking about 2 forms, define $F(n)$ a legal vector:
$\ \ $I. The vector starts with $0$ - remains $n-1$ bits $\Rightarrow F(n-1)$
$\ \ $II. The vector starts with $k-1$ 1's and must have 0 after $\Rightarrow F(n-k)$ .
My problem is first that I'm not sure about the concept of solution, second, how to sum it all up, third, what are my non recursively defined values ($F(0),F(k-1)?)$?
Thanks.
Assume that $F(k, n)$ is the number of different $n$-bit vectors and less than $k$ consecutive $1$ bits.
A complementary function $G(k, n)$ is the number of different $n$-bit vectors with at least $k$ consecutive $1$ bits.
In the following, $k$ is assumed to be less than or equal to $n$.
The sum of both functions is the total number of different $n$-bit vectors: $$F(k, n) + G(k, n) = 2^n$$ There is only one $n$-bit vector with all bits set to $1$ $$G(k=n, n) = 1$$ Reducing $k$ from $n$ to $n-1$ results in additional $2$ vectors, as the reduced $1$ bit can be replaced by $0$ on both ends: $$G(k=n-1,n) = G(n, n) + 2 = 3$$ Similarly, extending the bit-length from $n$ to $n+1$ while keeping $k$ constant: $$G(k=n, n+1) = G(n+1, n+1) + 2 = 3$$
The following table lists values for $G(k, n)$:
You'll find the first two sequences as A008466 and A050231.