Given a binary string {${x_{1},x_{2},x_{3},...,x_{n}}$} find all "legal" strings with more than $2$ consecutive ($ 1's)$.
For example for $N=7$ , we have $16$
With $3 (1's)$: {$1,1,1,0,0,0,0$} , {$0,1,1,1,0,0,0$} , {$0,0,1,1,1,0,0$} , {$0,0,0,1,1,1,0$} , {$0,0,0,0,1,1,1$}
With $4 (1's)$: {$1,1,1,1,0,0,0$} , {$0,1,1,1,1,0,0$} , {$0,0,1,1,1,1,0$} ,{$0,0,0,1,1,1,1$}
With $5 (1's)$: {$1,1,1,1,1,0,0$} , {$0,1,1,1,1,1,0$} ,{$0,0,1,1,1,1,1$}
With $6 (1's)$: {$1,1,1,1,1,1,0$} , {$0,1,1,1,1,1,1$} , {$1,1,1,0,1,1,1$}
With $7 (1's)$: {$1,1,1,1,1,1,1$}
Is there elegant way to calculate the number of such "legal "sub strings for any $N$.
$ Edit: $ A "legal" string is a string in which all consecutive $(1's)$ are with length $\geq 3$

Let $B_n$ count the number of $n$-bit strings in which any $1$'s come in Bunches of $3$ or more. This is the count we want. Let $A_n$ count the number of $n$-bit strings which can start with an Arbitrary number of $1$'s, but as soon as a $0$ appears, any subsequent $1$'s occur in bunches of $3$ or more. It's easy to see that $B_1=B_2=1$ and $B_3=2$, while $A_1=2$, $A_2=3$, and $A_3=4$. What's important is the entangled recursion for $n\ge4$:
$$\begin{align} A_n&=A_{n-1}+B_{n-1}\\ B_n&=B_{n-1}+A_{n-3} \end{align}$$
That is, if the first digit of an $A$-type string is a $1$, the remaining $n-1$ digits are of $A$-type, while if the first digit is a $0$, the rest must be of $B$-type; likewise, if the first digit of a $B$-type string is a $0$, the remaining $n-1$ digits must be of $B$-type, while if the first digit is a $1$, then the next two must also be $1$'s, but the remaining $n-3$ digits can start with an arbitrary number of $1$'s, i.e., they are of $A$-type.
We can now compute
$$\begin{align} A_4&=4+2=6\\ B_4&=2+2=4\\ \\ A_5&=6+4=10\\ B_5&=4+3=7\\ \\ A_6&=10+7=17\\ B_6&=7+4=11\\ \\ A_7&=17+11=28\\ B_7&=11+6=17 \end{align}$$
Note, $B_7=17$ agrees with what the OP found for $N=7$, provided you include the all-$0$ string $\{0,0,0,0,0,0,0\}$ in the count.