The Original I Ching
esenfr
← all experiments
⟳ · De Bruijn B(2,6)

The De Bruijn snake

The 64 hexagrams in a ring of 64 bits

Slide the window of six around the ring and check that no hexagram ever repeats.

There is a ring of exactly 64 yin/yang lines with an astonishing property: every window of 6 consecutive positions is a different hexagram. Sliding the window one position at a time, the 64 hexagrams each appear exactly once. It is the whole book compressed to the limit: 64 hexagrams in 64 bits, with nothing wasted. And it is not unique: there are 2²⁶ such rings; this one is the canonical one (the lexicographically minimal), built with the algorithm of Fredricksen and Maiorana (1978), while the object itself goes back to de Bruijn (1946).

64
bits in the ring
64/64
distinct windows ✓
2²⁶
= 67,108,864 rings
1/64
hexagrams covered
position 0/63
000000
2. Kūn
000000

the window reads 6 consecutive bits; going all the way around the ring, the 64 hexagrams pass by, each one once

Coverage: every position, a new hexagram

The 64 squares are the 64 hexagrams (in Fu Xi order). Sliding the window lights them one by one, without repeating: once the loop is complete, all 64 are there.