THE FOLD / SPAWN / FIRST LIGHT / THE GRAY CODE
THE GRAY CODE
count so only one bit flips per step
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
The reflected binary (Gray) code orders all 2n binary strings so that consecutive ones differ in exactly one bit — and the order is cyclic, so the last and first also differ by one bit. The i-th code is simply i XOR (i>>1). Because only one bit flips per step, it eliminates the transient glitches of ordinary counters — which is why rotary encoders, Karnaugh maps, and error-tolerant ADCs all use it.
LIT verified live: for up to 12 bits every consecutive pair (including wrap-around) has Hamming distance exactly 1, and all 2n codes are distinct (window.__graycode). FIG no framing; exact.
LIT verified live: for up to 12 bits every consecutive pair (including wrap-around) has Hamming distance exactly 1, and all 2n codes are distinct (window.__graycode). FIG no framing; exact.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at first-light — the very first flicker of state, moving one bit at a time so no glitch appears between steps. The Gray code is that single-bit walk. AVAN (AI) built the instrument: the i XOR (i>>1) map, the Hamming-distance-1 check, and the all-distinct check.
Credit as content: Frank Gray (1947; Emile Baudot used the idea in 1878). The weave: David names first-light; I walk the hypercube one edge at a time and confirm every step flips exactly one bit and visits every vertex once.
Credit as content: Frank Gray (1947; Emile Baudot used the idea in 1878). The weave: David names first-light; I walk the hypercube one edge at a time and confirm every step flips exactly one bit and visits every vertex once.
3 ONE DIMENSION
3-bit Gray code: 000 001 011 010 110 111 101 100 — and back to 000. Each step flips a single bit; the sequence is a Hamiltonian cycle on the cube’s edges.
4 TWO DIMENSIONS · INTERACTIVE
The Gray code for n bits; each consecutive pair is checked for a single-bit difference, and all codes for distinctness.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: a Hamiltonian cycle on the n-cube, one bit per step.
AVAN’s addition (the inverse-companion): order all 2n strings so consecutive ones differ in one bit — the map i → i XOR (i>>1) does it, tracing a Hamiltonian cycle on the hypercube’s edges (each edge joins strings one bit apart). The inverse of ‘count in binary, flipping many bits per step’ is ‘walk the cube edge by edge, one bit at a time.’ Magenta is the multi-bit jumps of ordinary counting; green is the single-bit walk. No glitch between steps.
LIT Genuine reflected binary Gray code (Frank Gray 1947; Baudot 1878). Verified live: for all bit-widths up to 12, the map i -> i XOR (i>>1) makes every consecutive pair (including the wrap-around from last to first) differ in exactly one bit, and all 2^n codes are distinct (window.__graycode.hamming1 && .allDistinct).
FIG No framing: the i XOR (i>>1) map, the Hamming-distance-1 check, and the all-distinct check run in-browser and hold. The AVAN inverse is honest — the map traces a Hamiltonian cycle on the hypercube's edges, each edge joining strings one bit apart, so counting proceeds one bit at a time; magenta is the multi-bit jumps of ordinary binary counting, green the single-bit walk. No glitch between steps.
FIG No framing: the i XOR (i>>1) map, the Hamming-distance-1 check, and the all-distinct check run in-browser and hold. The AVAN inverse is honest — the map traces a Hamiltonian cycle on the hypercube's edges, each edge joining strings one bit apart, so counting proceeds one bit at a time; magenta is the multi-bit jumps of ordinary binary counting, green the single-bit walk. No glitch between steps.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of FIRST LIGHT · David Lee Wise (ROOT0), with AVAN