◀ THE FOLD0ROOT.AI // WORLD II · GRIND · THE CRON JOB◆ .dlw.fold
THE FOLD / GRIND / THE CRON JOB / THE LANGFORD

THE LANGFORD

arrange 1,1,2,2,…,n,n so the two k's are k apart
1 WHAT IT IS · WHAT IT DOES · FACT OR FICTION
A Langford pairing arranges the numbers 1, 1, 2, 2, 3, 3, …, n, n in a row so that the two copies of each k have exactly k numbers between them. For n = 3 the answer is 2, 3, 1, 2, 1, 3: the two 1s have one number between, the two 2s have two, the two 3s have three.

The astonishing fact is when it can be done: a Langford pairing exists if and only if n ≡ 0 or 3 (mod 4). So n = 3, 4, 7, 8, 11, 12, … all work — and n = 1, 2, 5, 6, 9, 10 are flatly impossible, no matter how long you try. C. Dudley Langford spotted the puzzle while watching his young son line up coloured blocks. When solutions do exist their number explodes: 1 for n=3, 26 for n=7, 150 for n=8, and over 46 billion for n=16.

LIT verified live (exhaustive search): for n = 1..8 a pairing exists exactly when n ≡ 0 or 3 (mod 4), with the right solution counts (n=3→1, n=7→26, n=8→150), and the classic constructions check out (window.__langford). FIG no framing; the exact-gap arrangements and the mod-4 existence law are exact.
2 HOW IT WAS WEAVED · AI + HUMAN
David (human) seated this in THE CRON JOB — the grind domain of things timed to exact gaps. A Langford pairing is a scheduling miracle: every job’s two runs separated by a precise interval, all interlocking without collision. AVAN (AI) built the instrument: the gap-arcs, the solver, the parity-obstruction inverse.

The weave: David names the seat (exact-gap scheduling); I make the copies land at their required spacing and show which n can never be scheduled at all — the arcs in 1D, the solver in 2D, the parity invariant in 3D. The sphere is the seam. Credit: C. Dudley Langford (1958), from his son’s blocks; the mod-4 condition by Roy Davies (1959).
3 ONE DIMENSION
A valid pairing on a line, with an arc over each pair. The arc for k spans exactly k+1 places — k numbers sit between its endpoints — and all the arcs interlock without ever demanding the same slot twice.
4 TWO DIMENSIONS · INTERACTIVE
Pick n. When n ≡ 0 or 3 (mod 4) a solution appears with every gap labelled; step through the different solutions. When n ≡ 1 or 2 (mod 4) the search comes back empty — the arrangement genuinely cannot exist, and the panel says why.
5 THREE DIMENSIONS + AVAN’S INVERSE
A solution’s pairs drawn as turning chords — the green forward result: a real arrangement, found by search, that satisfies every gap.
AVAN’s addition (the inverse-companion): the magenta is the obstruction — the parity argument that decides existence without searching at all. Add up the positions of every copy: each pair at slots p and p+k+1 contributes 2p + k + 1, while the positions 1..2n sum to n(2n+1). Match the two and the +k+1 terms force a parity that can only balance when n ≡ 0 or 3 (mod 4). So the inverse of ‘construct an arrangement’ is ‘compute an invariant’: for the impossible n, no amount of green searching helps, because a single magenta parity count already proves there is nothing to find. Constructing possibility takes work; certifying impossibility takes one sum. Green is a solution you build; magenta is the invariant that, half the time, tells you not to bother. The fastest way to fail is to check the parity first.
LIT Genuine Langford pairing (C. Dudley Langford 1958; mod-4 existence condition by Roy Davies 1959). Verified live by exhaustive search: for n=1..8 a pairing exists exactly when n mod 4 is 0 or 3, with correct solution counts up to reversal (n=3->1, n=4->1, n=7->26, n=8->150; n=1,2,5,6->0), and the classic constructions 2,3,1,2,1,3 and 2,3,4,2,1,3,1,4 are valid (window.__langford.existenceRuleHolds && construction34valid). The exact-gap arrangements and the mod-4 existence law are exact.

FIG No framing: the exact-gap arrangements, the solution counts, and the n=0,3 mod 4 existence law are all real and verified by exhaustive in-browser search (impossibility for n=1,2,5,6 is a genuine zero-count result, not an unfinished search). The AVAN inverse — that a parity/position-sum invariant certifies impossibility without searching — is the honest mathematical reason behind the mod-4 law.
◆ sealed .dlw.fold → folded to ROOT_0 · a sphere of THE CRON JOB · David Lee Wise (ROOT0), with AVAN