Constructing a sequence so every contiguous subsequence of $5$ is unique

92 Views Asked by At

Construct a sequence of $36$ integers using just $1$'s and $0$'s so that every subsequence of length $5$ is unique (or explain why no such sequence exists).

I think that the answer is possible since there are $2^{5} = 32$ possible sequences of length $5$, and we're looking at $5$ at a time. So we'll look at exactly $32$ sequences. I've been having trouble constructing this though. I think that we need to use the binary representations of all numbers between $0$ and $31$.

I started with something like this:

$$0000010$$

Because first we're looking at $0$ then $1$ then $2$. But it gets strange for $3$ since I need two consecutive numbers. So I'm not sure how to proceed.

1

There are 1 best solutions below

4
On

I wrote a Matlab script to check for duplicate sequences, and then just kept adding zeroes unless this resulted in a doubly occurring sequence, in which case I added one. I had to backtrack a few times too.

$0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0$