Aniate

Open source combinatorics solvers

Superpermutations

A superpermutation on n symbols is a string that contains every ordering of the symbols as n consecutive letters. The shortest possible length is known only up to six symbols, and the best known strings for larger n are listed on the Superpermutation Almanac. Aniate set two successive records for fourteen symbols, W-0110 and W-0111, on 16 and 17 November 2026.

Symbols
14
Word
W-0111
Orderings
87,178,291,200
Above the lower bound
13,638,472
As text
94 GB
As a Detour file
454 KB

Length of W-0111

W-0111 · Kabir Murjani · 17 November 2026

Every ordering in one string

The string 123121321 holds all six orderings of three symbols. Its windows of three letters are 123, 231, 312, 121, 213, 132 and 321, and only 121 is not an ordering. Each new ordering is reached by a step that appends between one and n letters. A step of one letter moves the first symbol to the end, so n − 1 such steps pass through every rotation of a cycle. A step of two letters exchanges two neighbouring symbols of the cycle, and longer steps change it further. A string is short when most of its steps take one letter.

In the diagram each small ring holds the n rotations of one cycle. The rings are grouped by the position of the largest symbol, those groups by the position of the next largest, and so on outward. The string is written one letter at a time.

Letters
0
Orderings
0
Last step
–
Extra letters
0
Shortest possible
–

  • One letter
  • Two letters
  • Three letters
  • Four or more
Symbols

Usage

The solver is installed with pip install 'aniate[fast]', which adds numba and makes the search between fifty and a hundred times faster. Without numba it runs as plain Python and gives the same answers.

from aniate import superpermutations

word = superpermutations(5)                                # 153 letters, the shortest possible
print(word.text)                                           # 0123401230...

superpermutations(6, start="random")                       # a search from a random order
superpermutations.check(word)                              # every window scanned

superpermutations.improve(word, seconds=60)                # a shorter word, when one is found
superpermutations.improve("W-0111.detour", seconds=600)    # the same, for a Detour file

superpermutations.write(word, "word.detour")               # the Almanac's format
superpermutations.read("W-0111.detour")                    # the letters of a Detour file

Inputs

InputDefaultDescription
nrequiredNumber of symbols, from 1 to 10. Larger words are improved from their Detour files
startthe recursive construction"random" for the orderings in a random order, or a word to begin from
secondsn!/20, at most ten minutesTime for the search. None is run from the construction unless it is set
seed0Random seed for the search
outbeside the given fileFor improve on a Detour file: where to write a shorter word

Outputs

FieldDescription
word.textThe superpermutation, written with the symbols 0, 1, 2 ...
word.lengthIts number of letters
word.startThe length of the string the search began from
word.shortestThe shortest possible length, where it is proved
check(word)The orderings found, the number missing, and the windows that repeat one
improve(path)The length of the improved Detour word, the letters saved, and the file written
© 2026 Kabir Murjani