2

I have been investigating the problem of counting the number of binary strings of length $n$ such that it has no three consecutive $1$'s, but also either has exactly $k$ $1$'s or exactly $k$ $0$'s where $k$ is a positive integer between $1$ and $n$ (inclusive). For example, if $n = 4$ and $k = 3$, then there are six valid such binary strings: $0001$, $0010$, $0100$, $1000$, $1011$, and $1101$.

From my previous post, we defined $F(p,q)$ as the number of binary strings with no three consecutive 1's with exactly $p$ $1$'s and $q$ $0$'s. From the answer by Markus there, we get the following formula for counting the desired binary strings with exactly $k$ $1$'s:

$$ F(k,n-k) = \sum_{j=0}^{\min(n-k+1, \lfloor k/2 \rfloor)} {n-k+1 \choose j}{n-k+1-j \choose k-2j} $$

Similarly, we have the formula for $F(n-k,k)$ to count the desired binary strings with exactly $k$ $0$'s.

$$ F(n-k,k) = \sum_{j=0}^{\min(k+1,\lfloor (n-k)/2 \rfloor)} {k+1 \choose j}{k+1-j \choose n-k-2j} $$

We can add the two results at the end to get our final answer (i.e., $F(k,n-k) + F(n-k,k)$).

What I am curious about now is, can we get the closed form of these two formulas? Or at least, a non-trivial asymptotic lower bound? It is obvious that $F(k,n-k) + F(n-k,k) = \Omega(n)$ as the number of solutions for $k = 1$ is at least $n$. Moreover, is it possible to obtain an asymptotic upper bound tighter than $O(2^n)$? Here $2^n$ is the number of binary strings of length $n$ with no restriction.

Here is what I have found so far:

  1. The spreadsheet that shows the number of solutions for $n \leq 100, 1 \leq k \leq n$ can be viewed here.

  2. Based on this post, the number of binary strings of length $n$ with no occurrence of "$111$" and no other restrictions follows the tribonacci sequence but shifted forward by two terms. An explicit formula for calculating the $n$-th tribonacci number is available here. Then, we can derive the asymptotic upper bound for this case to be $O((p_{+} + p_{-} + 1)^{n})$ where $p_\pm = \sqrt[3]{19\pm 3 \sqrt{33}}$ or roughly $O(1.8392^n)$. Since this case allows any number of $1$'s or $0$'s, it basically sums up the solutions for $k = 1, 2, \dots n$ in our problem. Therefore, this upper bound also applies to our problem. However, this does not consider the value $k$ in our original expression.

  3. For even $n$ with $k = \frac{n}{2}$, the number of solutions follows the sequence $2, 6, 16, 45, 126, 357, \dots$ which is available in the OEIS. Using an approximation by Vaclav Kotesovec there, we get $F(\frac{n}{2}, \frac{n}{2}) = O(3^{\frac{n}{2}})$ or roughly $O(1.732^n)$. I checked with a program for $n \leq 5000$, the asymptotic upper bound seems to also apply for odd $n$ (with $k = \lfloor \frac{n}{2} \rfloor)$. As $k = \frac{n}{2}$ doesn't always give the peak value for $F$, then a tight asymptotic upper bound for general $k$ is somewhere between $O(3^{\frac{n}{2}})$ and $O(1.8392^n)$.

I would appreciate any ideas or suggestions to improve or verify these bounds, and I am open to alternative solutions that may provide more accurate estimates for the problem. Additionally, final bounds that include the variable $k$ would be great if possible.

Thanks in advance.

  • Why do you say "this upper bound might also apply to our problem"? Your strings form a subset of the strings with no three consecutive $1$s, so any upper bound on that superset is necessarily also a bound for your subset, no? – joriki Mar 23 '23 at 13:15
  • @joriki I think OP should write, ".. this upper bound also applies to our problem", but $O(1.8392^n)$ is not tight enough for this problem. – Iqazra Mar 24 '23 at 08:11
  • My mistake, thanks for pointing that out. I've edited the post. – whitebook Mar 24 '23 at 10:16
  • If you fix $k$, once $n > 3k + 2$ such strings cannot have only $k$ 0s, so must have exactly $k$ 1s, so the count is given by $$\sum_{i = \lceil k/2 \rceil}^k \binom{n - k - 1}{i},$$ (where $i$ is the number of strings of 1s) in particular $\Theta(n^k)$. – ronno Apr 12 '23 at 09:53

0 Answers0