6
$\begingroup$

Suppose you have n sequences of bits stacked in rows. The sequences can repeat along their row indefinitely. The goal is to select n sequences such that the following are both true:

  1. All $2^n$ possible columns will eventually happen at least once.
  2. The longest sequence is $O(P(n))$ in length; where P is some polynomial.

For example, if n=4, the sequences you could pick are:

01
0011
00001111
0000000011111111   //Length 2^4 or 2^n in general

Repeating them along their rows gives:

0101010101010101
0011001100110011
0000111100001111
0000000011111111

If you take each column as its own bit string, you can see that every possible column appears. In fact, it mimics the classic binary counting system. However, this system is problematic since the longest sequence has length 2^4 or 2^n in general; instead of being polynomial in n.

An alternative would be the following sequences where the length of the next sequence is just 2 greater than the previous, instead of 2 times the previous:

01
0011
000111
00001111   //Length 2*4 or 2*n in general

Repeating them along their rows gives:

010101010101010101010101
001100110011001100110011
000111000111000111000111
000011110000111100001111

In this case, every possible column still appears at least once (even though there are duplicates). Furthermore, the longest sequence has length $2*4$ or $2*n$ in general. This is polynomial in $n$ and seems to solve the problem. However, this only works until $n=7$. In that case, there are some columns which never appear no matter how much you repeat the sequences.

So my question is, is there some way to pick the sequences so that the two rules are fulfilled for any n? Thanks

$\endgroup$
1
  • $\begingroup$ Slight language nitpicking: You start with "Suppose you have n sequences". To my mathematician's mind, this means that the sequences are given. Then when you say "the goal is to select", I imagine you should select some out of the given sequences. Only later I realized that in both sentences you have $n$ sequences, so my interpretation makes no sense. $\endgroup$ Commented 3 hours ago

1 Answer 1

6
$\begingroup$

Let row $i$ consist of any sequence of length $p_i$ that includes both $0$ and $1$ (for definiteness, say, $0^{p_i-1}1$), where $p_i$ denotes the $i$th prime. Then all columns eventually occur by the Chinese remainder theorem, and the longest sequence has period $p_n=O(n\log n)$ by Chebyshev's theorem.

We can improve the construction to get essentially optimal sequences as follows. If we want only sequences of length $\le m$, then for each prime $p\le m$, we can take up to $\lfloor\log_2p\rfloor$ rows of length $p$ such that all columns restricted to these rows occur, using e.g. the binary encoding as in the question. (Slightly better, we could take $\lfloor k\log_2p\rfloor$ sequences of length $p^k$, where $p^k$ is the maximal power of $p$ such that $p^k\le m$, but this would not change the asymptotics.) So the sequences can look like this:

01
010
01010
00110
0101010
0011001
01010101010
00110011001
00001111000
0101010101010
0011001100110
0000111100001
01010101010101010
00110011001100110
00001111000011110
00000000111111110
0101010101010101010
0011001100110011001
0000111100001111000
0000000011111111000
...

Then all columns still occur by the Chinese remainder theorem. How large $m$ we need to get $n$ rows? This construction gives us up to $\sum_{p\le m}\lfloor\log_2p\rfloor$ rows, hence we need $$n\le\sum_{\substack{p\le m\\\text{$p$ prime}}}\lfloor\log_2p\rfloor=\Omega(m)$$ using Chebyshev’s theorem again, hence it suffices to take $$m=O(n).$$ More precisely, the prime number theorem implies $$\sum_{\substack{p\le m\\\text{$p$ prime}}}\lfloor\log_2p\rfloor\sim\frac m{\ln2},$$ whence it suffices to take $$m=(\ln 2+o(1))n.$$ This bound is asymptotically optimal: if we can get all $2^n$ columns using $n$ sequences of lengths $m_1,\dots,m_n\le m$, then $$2^n\le\operatorname{lcm}\{m_1,\dots,m_n\}\le\operatorname{lcm}\{1,\dots,m\}=e^{(1+o(1))m}$$ using the prime number theorem again, hence $m$ is at least $(\ln2+o(1))n$.

There is nothing special about binary in the argument above: if we fix any finite alphabet $\Sigma$ of size $|\Sigma|\ge2$, then for any $n$, we can construct $n$ sequences over $\Sigma$ of length at most $$(\ln|\Sigma|+o(1))n$$ such that every column occurs when they are extended periodically, and this is asymptotically optimal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.