The Minimal Superpermutation Problem
Imagine that there is a TV series that you want to watch. The series consists of n episodes, with each episode on a single DVD. Unfortunately, however, the DVDs have become mixed up and the order of the episodes is in no way marked (and furthermore, the episodes of the TV show are not connected by any continuous storyline – there is no way to determine the order of the episodes just from watching them).
Suppose that you want to watch the episodes of the TV series, consecutively, in the correct order. The question is: how many episodes must you watch in order to do this?
To illustrate what we mean by this question, suppose for now that n = 2 (i.e., the show was so terrible that it was cancelled after only 2 episodes). If we arbitrarily label one of the episodes “1″ and the other episode “2″, then we could watch the episodes in the order “1″, “2″, and then “1″ again. Then, regardless of which episode is really the first episode, we’ve seen the two episodes consecutively in the correct order. Furthermore, this is clearly minimal – there is no way to watch fewer than 3 episodes while ensuring that you see both episodes in the correct order.
So what is the minimal number of episodes we must watch for a TV show consisting of n episodes? Somewhat surprisingly, no one knows. So let’s discuss what is known.
Minimal Superpermutations
Rephrased a bit more mathematically, we are interested in finding a shortest possible string on the symbols “1″, “2″, …, “n” that contains every permutation of those symbols as a contiguous substring. We call a string that contains every permutation in this way a superpermutation, and one of minimal length is called a minimal superpermutation. Minimal superpermutations when n = 1, 2, 3, 4 are easily found via brute-force computer search, and are presented here:
| n | Minimal Superpermutation | Length |
|---|---|---|
| 1 | 1 | 1 |
| 2 | 121 | 3 |
| 3 | 123121321 | 9 |
| 4 | 123412314231243121342132413214321 | 33 |
By the time n = 5, the strings we are looking for are much too long to find via brute-force. However, the strings in the n ≤ 4 cases provide some insight that we can hope might generalize to larger n. For example, there is a natural construction that allows us to construct a short superpermutation on n+1 symbols from a short superpermutation on n symbols (which we will describe in the next section), and this construction gives the minimal superpermutations presented in the above table when n ≤ 4.
Similarly, the minimal superpermutations in the above table can be shown via brute-force to be unique (up the relabeling the characters – for example, we don’t count the string “213212312″ as distinct from “123121321″, since they are related to each other simply by interchanging the roles of “1″ and “2″). Are minimal superpermutations unique for all n?
Minimal Length
A trivial lower bound on the length of a superpermutation on n symbols is n! + n – 1, since it must contain each of the n! permutations as a substring – the first permutation contributes a length of n characters to the string, and each of the remaining n! – 1 permutations contributes a length of at least 1 character more.
It is not difficult to improve this lower bound to n! + (n-1)! + n – 2 (I won’t provide a proof here, but the idea is to note that when building the superpermutation, you can not add more than n-1 permutations by appending just 1 character each to the string – you eventually have to add 2 or more characters to add a permutation that is not already present). In fact, this argument can be stretched further to show that n! + (n-1)! + (n-2)! + n – 3 is a lower bound as well (a rough proof is provided here). However, the same arguments do not seem to extend to lower bounds like n! + (n-1)! + (n-2)! + (n-3)! + n – 4 and so on.
There is also a trivial upper bound on the length of a minimal superpermutation: n×n!, since this is the length of the string obtained by writing out the n! permutations in order without overlapping. However, there is a well-known construction of small superpermutations that provides a much better upper bound, which we now describe.
Suppose we know a small superpermutation on n symbols (such as one of the superpermutations provided in the table in the previous section) and we want to construct a small superpermutation on n+1 symbols. To do so, simply replace each permutation in the n-symbol superpermutation by: (1) that permutation, (2) the symbol n+1, and (3) that permutation again. For example, if we start with the 2-symbol superpermutation “121″, we replace the permutation “12″ by “12312″ and we replace the permutation “21″ by “21321″, which results in the 3-symbol superpermutation “123121321″. The procedure for constructing a 4-symbol superpermutation from this 3-symbol superpermutation is illustrated in the following diagram:

A diagram that demonstrates how to construct a small superpermutation on 4 symbols from a small superpermutation on 3 symbols.
It is a straightforward inductive argument to show that the above method produces n-symbol superpermutations of length
for all n. Although it has been conjectured that this superpermutation is minimal [1], this is only known to be true when n ≤ 4.
Uniqueness
As a result of minimal superpermutations being unique when n ≤ 4, it has been conjectured that they are unique for all n [1]. However, it turns out that there are in fact many superpermutations of the conjectured minimal length – the main result of [2] shows that there are at least

distinct n-symbol superpermutations of the conjectured minimal length. For n ≤ 4, this formula gives the empty product (and thus a value of 1), which agrees with the fact that minimal superpermutations are unique in these cases. However, the number of distinct superpermutations then grows extremely quickly with n: for n = 5, 6, 7, 8, there are at least 2, 96, 8153726976, and approximately 3×1050 superpermutations of the conjectured minimal length. The 2 such superpermutations in the n = 5 case are as follows (each superpermutation has length 153 and is written on two lines):
12345123415234125341235412314523142531423514231542312453124351243152431254312
1345213425134215342135421324513241532413524132541321453214352143251432154321
and
12345123415234125341235412314523142531423514231542312453124351243152431254312
1354213524135214352134521325413251432513425132451321543215342153241532145321
Similarly, a text file containing all 96 known superpermutations of the expected minimal length 873 in the n = 6 case can be viewed here. It is unknown, however, whether or not these superpermutations are indeed minimal or if there are even more superpermutations of the conjectured minimal length.
References
- D. Ashlock and J. Tillotson. Construction of small superpermutations and minimal injective superstrings. Congressus Numerantium, 93:91–98, 1993.
- N. Johnston. Non-uniqueness of minimal superpermutations. Discrete Mathematics, 313:1553–1557, 2013.
Other Random Links Related to This Problem
- A180632 – the main OEIS entry for this problem
- Permutation Strings – a short note written by Jeffrey A. Barnett about this problem
- Generate sequence with all permutations – a stackoverflow post about this problem
- What is the shortest string that contains all permutations of an alphabet? – a mathexchange post about this problem
- The shortest string containing all permutations of n symbols – an XKCD forums post that I made about this problem a couple years ago
is a quantum state that can be written as an elementary tensor:
of mutually orthogonal product states with the property that no other product state is orthogonal to every member of
.
for arbitrary
), but for simplicity we stick with the bipartite (i.e.,
) case in this blog post.
, the only UPBs that exist are trivial in this sense – they consist of a full set of
states. We are more interested in UPBs that contain fewer vectors than the dimension of the Hilbert space (since, for example, these UPBs can be used to construct bound entangled states [
and
, and let![|\phi_j\rangle:=\tfrac{1}{N}[\cos(2\pi j/5),\sin(2\pi j/5),h]\text{ for }0\leq j\leq 4. |\phi_j\rangle:=\tfrac{1}{N}[\cos(2\pi j/5),\sin(2\pi j/5),h]\text{ for }0\leq j\leq 4.](http://www.njohnston.ca/wp-content/latex/f12/f12293de78945326dc279ddc4b0f3db2-ffffff-000000-0.png)
is a UPB:
.
are mutually orthogonal (and thus form a product basis). To verify that there is no product state orthogonal to every member of
‘s form a linearly independent set (verification of this claim is slightly tedious, but nonetheless straightforward). Thus there is no state
that is orthogonal to more than 2 of the
is orthogonal to more than 2 + 2 = 4 members of
must have cardinality at least
. To see this, suppose for a contradiction that there existed a UPB
or fewer product states. Then we could construct another product state that is orthogonal to
members of
and another
members of
, for a total of
[
and at least one of
or
is odd.
product states in
th colour if and only if the two corresponding product states are orthogonal on the 
. Unextendibility is a bit more difficult to determine, but nonetheless a useful technique for constructing UPBs is to first choose a colouring of the edges of
. We construct the orthogonality graph by arranging
or less from each other via a black edge. All other edges are coloured red. For example, in the
case, this gives the orthogonality graph above. In the
case, this gives the orthogonality graph below.
arbitrarily, then pick
randomly subject to the constraint that it is orthogonal to
be a finite-dimensional Hilbert space over
or
(the fields of real and complex numbers, respectively). If we let
be a norm on 
) and the norm induced by the inner product is the unique norm that is its own dual. Similarly, if
is the
, where
satisfies
.
has an equivalent characterization as an infimum, and we use this characterization to provide a simple derivation of several known (but perhaps not well-known) formulas for norms such as the operator norm of matrices.
be a bounded set satisfying
and define a norm 

.
. Secondly, every norm on
and
then
. It follows that
whenever
be another norm satisfying
whenever 
, so by taking duals we see that
, as desired.
. Our goal now is to show that: (1)
whenever
will then follow from the first paragraph of this proof.
if and only if
are both straightforward (try them yourself!). Fix
and let
,
be decompositions of
with
for all i, satisfying
and
. Then
whenever
), we simply write
, which gives the single coefficient
, so
.
for all
for all i, then
, which completes the proof.
, where
and
are themselves finite-dimensional Hilbert spaces, then one often considers the 

and
are duals of each other is simply Theorem 1 in the case when S is the set of product vectors:
to denote the dimension of
be an orthonormal basis of
then the norm 
is the i-th coordinate of 
, the space of
complex matrices with the 


. If we let
, then Theorem 1 provides the following alternate characterization of the operator norm:
. Then
with the property that
for all unitary matrices
):
.
and
be unitary, then
. It follows that
, so
and
with each
and
unitary. Then
, again with the usual Hilbert–Schmidt inner product. If we let
or 

has the given form, but it’s only a couple lines – consider it an exercise for the interested reader.
is entangled if and only if
(I use the above duality relationship to provide an alternate proof of this fact in [4, Theorem 6.1.5]). On the other hand, the norm
characterizes positive linear maps of matrices and was the subject of [5, 6].
is defined by
, where
is the usual norm on linear maps defined by
and
is the
[1]. The completely bounded norm is particularly useful when thinking of
and
is typically denoted
. For properties of the completely bounded and diamond norms, see [1,2,3].
and
such that
for all 
for all
and
, and computing
is trivial. The following example demonstrates the usage of these scripts in this case, via a completely positive map
with four (essentially random) Kraus operators:
, where
is the standard basis of
and
are the operators with matrix representation in the standard basis with a one in the
-entry and zeroes elsewhere). It is known that the completely bounded and diamond norms of the n-dimensional transpose map are both equal to n, which can be verified in small dimensions as follows:
defined by
, where
is the following unitary matrix:
, the smallest closed disc containing its eigenvalues has diameter
, so
. This result can be verified as follows:
Recent Comments