ianhenderson.org / 2024 november 15

an infinitely-growing de Bruijn-type sequence that eventually includes every string of natural numbers

When looped on itself, the sequence below includes all strings of length 1 or less made up of numbers between 1 and 1. Click the "Extend the Sequence" button to extend it!

The inspiration for this was a Mathstodon post by Oscar Cunningham, and the technique for extending the sequence is based on a paper On extending de Bruijn sequences by Becher and Heiber. Each time the sequence is extended, a new number is thrown into the mix, and an Eulerian cycle is computed for this larger graph. The result is a new de Bruijn sequence of length nn which has each previous sequence as a prefix. Edges are visited in order from low to high, so larger numbers tend to appear after the strings involving smaller numbers.