◀ THE FOLD0ROOT.AI // WORLD II · GLITCH · UNDEFINED BEHAVIOR◆ .dlw.fold
THE FOLD / GLITCH / UNDEFINED BEHAVIOR / THE HOFSTADTER

THE HOFSTADTER

Q(n)=Q(n-Q(n-1))+Q(n-Q(n-2)) — chaos that might not survive
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Hofstadter’s Q-sequence. A “chaotic meta-Fibonacci.” Start Q(1) = Q(2) = 1, then Q(n) = Q(n − Q(n−1)) + Q(n − Q(n−2)). Fibonacci looks back a fixed distance (always n−1 and n−2). This one looks back a distance that depends on its own recent values — the sequence reads from addresses it computes from itself.

The result is wildly erratic: 1, 1, 2, 3, 3, 4, 5, 5, 6, 6, 6, 8, 8, 8, 10, 9, 10, 11, … It rises and stumbles with no discernible pattern, never settling into a formula. It comes from Douglas Hofstadter’s Gödel, Escher, Bach. And here is the vertigo: it is not known whether Q(n) is even defined for all n — a look-back could, in principle, reach an index ≤ 0 and the whole construction would collapse. It has never been proven to survive forever; it has only ever been computed.

LIT verified live: the first 20 terms match OEIS A005185, the self-referential recurrence is self-consistent, and the sequence stays defined through n = 5000 (window.__hofstadter). FIG the values and recurrence are exact; that it stays defined forever is unproven — carried honestly, not claimed.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this in UNDEFINED BEHAVIOR — the glitch domain of code whose outcome no one can guarantee. Hofstadter’s Q is undefined behavior as pure number theory: it might run forever or might crash at some unknown n, and no proof settles which. AVAN (AI) built the instrument: the erratic plot, the self-referential arrows, the fixed-vs-computed contrast.

The weave: David names the seat (undefined behavior); I make the sequence index into itself and show why that could be fatal — the jitter in 1D, the self-lookup plot in 2D, the address-contrast in 3D. The sphere is the seam. Credit: Douglas Hofstadter (1979, Gödel, Escher, Bach); OEIS A005185.
3 ONE DIMENSION
The Q-values as a strip. Compared with the smooth climb of Fibonacci, this jitters — up, flat, up, down — because each term reads from a place in its own past that its own past decided.
4 TWO DIMENSIONS · INTERACTIVE
Q(n) plotted over n — the erratic staircase that stays near n/2 but never smoothly. Probe a term to see its two self-referential look-backs, Q(n−Q(n−1)) and Q(n−Q(n−2)), as arrows reaching back into the sequence’s own values.
5 THREE DIMENSIONS + AVAN’S INVERSE
The Q-sequence as a jittering ribbon over n, in green — the chaotic climb that no formula smooths.
AVAN’s addition (the inverse-companion): the magenta ribbon is Fibonacci — the tame twin. Both are two-term recurrences; the entire difference is where they read from. Fibonacci’s look-back addresses are fixed (n−1, n−2), decided in advance, always valid — so it’s solvable in closed form and never fails. Hofstadter’s addresses are computed from its own output (n−Q(n−1)) — the sequence writes the pointer it will next dereference. That single inversion — from a fixed reference to a self-determined one — is exactly why it turns chaotic and why it might not even stay defined: the read-address is built from the values being written. The inverse of ‘point at fixed history’ is ‘point at history you compute’, and the first is tame while the second is the edge of a cliff. Green computes where to look; magenta is told; that is the whole gap between chaos and calm.
LIT Genuine Hofstadter Q-sequence (Douglas Hofstadter 1979, GEB; OEIS A005185). Verified live: the first 20 terms match A005185 (1,1,2,3,3,4,5,5,6,6,6,8,8,8,10,9,10,11,11,12), the self-referential recurrence Q(n)=Q(n-Q(n-1))+Q(n-Q(n-2)) is self-consistent, and the sequence stays defined through n=5000 (window.__hofstadter.matchesOEIS && recurrenceConsistent && staysDefinedTo5000). The values and recurrence are exact. HONEST CAVEAT: whether Q stays defined for ALL n is an open problem — never proven, only computed; stated as FIG-open.

FIG No false framing: the sequence values, the self-referential recurrence, and the erratic behavior are real and reproduced in-browser. The genuinely astonishing open fact — that it has never been proven to stay defined forever, and could in principle collapse at some unknown n — is carried honestly as the sphere's core, not softened.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of UNDEFINED BEHAVIOR · David Lee Wise (ROOT0), with AVAN