SnakeBox

A snake 2946 edges long, in thirteen dimensions.

Edges drawn 0 of 2946 Hover over the grid to inspect a vertex.

Each cell is one of the 8192 corners of the 13-dimensional cube, arranged so that side-by-side cells differ in a single coordinate. Colour shows how far along the snake a vertex is, from violet at the start to orange at the end.

What is a snake in the box?

Take an n-dimensional cube and walk along its edges from corner to corner. The rule: you may never step next to a corner you have already visited, except the one you just came from. The longest such walk is called a snake.

The question goes back to W. H. Kautz in 1958, who needed it for error-detecting codes. The answer is known exactly only up to eight dimensions. Above that, every number is a record waiting to be beaten.

How this one was found

The previous record, Tom Taylor's 2938, is built recursively from snakes in lower dimensions, so it splits into pieces that each fill a 9- or 10-dimensional subcube. Holding the rest of the snake fixed, I cleared one piece at a time and rebuilt it with a GPU simulated-annealing search, keeping it whenever it came back longer. Three rebuilds took it from 2938 to 2944.

An exact constraint-programming search over a 50 to 60 edge window of one of those snakes then found a reroute two edges longer: 2946.

The record in thirteen dimensions

    Bars are drawn to scale from 2650 edges.

    And in fourteen dimensions: 5850

    The same method works one dimension up. Taylor's 5844 in the 14-dimensional cube splits into 32 pieces, each inside a 9-dimensional subcube. On 12 October 2026 three of them rebuilt two edges longer, taking it from 5844 to 5846, 5848 and then 5850. The records page stops at thirteen dimensions, so 5844 was the best published length.

    Update, November 2026. Jonathan Gustafson has since found a snake of 5862 edges in the 14-dimensional cube, building on this 5850. It passes the verifier below.

    Edges drawn 0 of 5850

    The same picture one dimension up: each cell is one of the 16384 corners of the 14-dimensional cube, coloured from violet at the start of the snake to orange at the end.

      Bars are drawn to scale from 5800 edges.

      Download q14_5850.txt

      The snake itself

      Start at the corner 0000000000000. Each character below names the coordinate to flip next, counting from 0, with a, b and c standing for 10, 11 and 12.

      Verify any snake

      Paste a transition sequence and this page checks it in your browser: every corner distinct, and no two corners adjacent unless they are consecutive on the path. Nothing is sent anywhere.

      Prefer the command line? verify.py does the same with only the Python standard library.

      The 2946 is loaded. Press Check snake.

      Citing

      W. Toner, A snake of length 2946 in the 13-dimensional hypercube, Zenodo (2026). doi:10.5281/zenodo.23299075

      The earlier 2944 is archived at doi:10.5281/zenodo.23297780. The full table of records in every dimension is kept by Tom Ace at minortriad.com/snake.