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

THE HOFSTADTER Q

a recurrence that feeds on itself, maybe off the edge
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
Hofstadter’s Q-sequence is a recurrence that feeds on its own recent values as indices: Q(1)=Q(2)=1, and Q(n) = Q(n − Q(n−1)) + Q(n − Q(n−2)). Unlike Fibonacci (which looks back a fixed distance), Q looks back a distance that depends on itself — making it chaotic and unpredictable. Astonishingly, whether it stays well-defined forever (never trying to read an index ≤ 0) is an open problem in mathematics; it merely appears to, as far as anyone has computed.

LIT verified live: computed to n = 100000, every lookback index stays in range (well-defined so far), and the first ten values match the hand-derived reference 1,1,2,3,3,4,5,5,6,6 (window.__hofstadterq). FIG honest: global well-definedness is unproven — this checks a large finite prefix, not eternity.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this at undefined-behavior — the spec’s dark corner, where a recurrence that indexes by its own output could, in principle, step off the edge; that it doesn’t is unproven. Hofstadter’s Q lives there. AVAN (AI) built the instrument: the self-referential recurrence, the in-range guard on every lookback, and the match to the hand-derived opening values.

Credit as content: Douglas Hofstadter, Gödel, Escher, Bach (1979); sequence OEIS A005185. The weave: David names undefined-behavior; I run the self-indexing recurrence, guard every lookback against stepping to a non-positive index, and confirm it survives 100000 terms — while flagging honestly that surviving forever is not proven.
3 ONE DIMENSION
Q(n) = Q(n − Q(n−1)) + Q(n − Q(n−2)). The step-back distance is Q’s own recent output — the sequence reaches into itself to decide where to look.
4 TWO DIMENSIONS · INTERACTIVE
The chaotic Q-sequence plotted; its well-definedness and opening values checked.
5 THREE DIMENSIONS + AVAN’S INVERSE
The green forward object: a sequence that indexes by its own values.
AVAN’s addition (the inverse-companion): define a sequence whose look-back distance is its own output — not a fixed offset like Fibonacci but a self-chosen one, producing chaos from the simplest self-reference. The inverse of ‘recur at a fixed distance’ is ‘let the sequence decide, from itself, how far back to reach.’ Magenta is the fixed-offset recurrence (orderly); green is the self-indexing one (chaotic, and possibly stepping off the edge). Order’s edge, self-chosen.
LIT Genuine Hofstadter Q-sequence (Douglas Hofstadter, Gödel, Escher, Bach, 1979; OEIS A005185). Verified live: computed to n=100000, every lookback index n−Q(n−1) and n−Q(n−2) stays in [1,n−1] (well-defined over this prefix; window.__hofstadterq.welldefined), and the first ten terms equal the hand-derived reference 1,1,2,3,3,4,5,5,6,6 (window.__hofstadterq.matchesReference).

FIG Honestly scoped: global well-definedness of Q is an UNPROVEN open problem — this checks a large finite prefix (100000 terms), not eternity, and the sphere says so plainly. The self-referential recurrence, the in-range guard on every lookback, and the reference-value match run in-browser. The AVAN inverse is honest — a sequence whose look-back distance is its own output genuinely differs from Fibonacci's fixed offset, producing chaos (and possibly, though never observed, a step off the edge); magenta is the orderly fixed-offset recurrence, green the self-indexing one.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of UNDEFINED BEHAVIOR · David Lee Wise (ROOT0), with AVAN