// *** The old runFor() was REFUTED 2026-08-16; its replacement was itself // incomplete and was replaced again 2026-09-25 (finding #550, review #341 of // return #1038): the 2026-08-16 scanner restarted a broken run from (last, r) // only, which undercounts when the run tail has already fixed the residue pair. // See the note on runFor() below. *** // research/a3-08-adjacent-pairs.js found the same bug independently and agrees // on the corrected diagonal L = 2, 1, 2, 2, 2, 3, 2, 4 at folds 7..31. That // file also carries an exact O(D) alternative (the kill graph, section [4]), // which returns the whole run SPECTRUM rather than only its maximum, and its // section [8] holds the corrected off-diagonal sweep out to p = 127. // Any L number quoted from this file BEFORE 2026-08-16 is unsafe. // // How does L, the longest adjacent-kill run, grow? // L(T_x, p) = longest run of consecutive slots of T_x whose residues mod p // occupy at most two values differing by 2. O(D) per prime, so we can sweep. 'use strict'; const okPair = (a, b, p) => { if (a === b) return true; const d = Math.abs(a - b); return d === 2 || d === p - 2; }; function runFor(S, p) { // CORRECTED 2026-08-16 (found by attacks A4 and A5 independently). The previous // scanner compared each new residue against the FIRST element of the current // 2-set instead of the immediately preceding element, so a, a+2, a-2 scored as // a run of 3. It OVERCOUNTED: fold 29 on T23 read 3 where the truth is 2, with // an exhaustive killable-triple count of 0. Same bug as research/killrun.js. // Corrected diagonal: L = 2, 1, 2, 2, 2, 3, 2, 4 at folds 7..31; L is NOT // monotone, it dips at 29. The whole off-diagonal sweep this file prints was // affected and is regenerated by rerunning. // // CORRECTED AGAIN 2026-09-25 (finding #550, review #341 of return #1038). That // scanner still UNDERCOUNTED: when a run broke, it restarted from the pair // (last, r) only, i.e. it assumed the new run's two residues are the two most // recent slots, so a tail that has already fixed the pair was lost. On // 10,12,12,14,14 it scored 3 where the truth is 4 (the run 12,12,14,14). // Replaced by the two-state DP, O(1) per slot: U = longest run ending here // whose residues lie in {r, r+2}, D = longest one whose residues lie in // {r-2, r} (residues mod p), each extended from the previous slot's state that // names the same 2-set. Both are >= 1, since a single residue lies in both. let best = 0, U = 0, D = 0; for (let i = 0; i < S.length; i++) { const r = S[i] % p, prev = i > 0 ? S[i - 1] % p : -1; const up = (r + 2) % p, dn = (r - 2 + p) % p; const nU = 1 + Math.max(prev === r ? U : 0, prev === up ? D : 0); const nD = 1 + Math.max(prev === r ? D : 0, prev === dn ? U : 0); U = nU; D = nD; if (U > best) best = U; if (D > best) best = D; } return best; } // qualifying-gap fraction: gaps = 0, +-2 mod p function qualFrac(S, W, p) { const n = S.length; let c = 0; for (let i = 0; i < n; i++) { const g = (i + 1 < n ? S[i + 1] : S[0] + W) - S[i]; const m = g % p; if (m === 0 || m === 2 || m === p - 2) c++; } return c / n; } const primesTo = n => { const s = new Uint8Array(n + 1), o = []; for (let i = 2; i <= n; i++) if (!s[i]) { o.push(i); for (let j = i * i; j <= n; j += i) s[j] = 1; } return o; }; let P = 30, slots = Float64Array.from([11, 17, 29]); const tiles = []; for (const p of [7, 11, 13, 17, 19, 23]) { const D = slots.length, keep = new Float64Array(D * (p - 2)); let n = 0; for (let k = 0; k < p; k++) for (let i = 0; i < D; i++) { const r = slots[i] + k * P; if (r % p !== 0 && (r + 2) % p !== 0) keep[n++] = r; } P *= p; slots = keep; tiles.push({ x: p, W: P, S: slots }); } const PR = primesTo(400); console.log(' L(T_x, p) for a sweep of folding primes p. D = census of T_x, lnD in brackets.\n'); let head = ' p '; for (const t of tiles) head += `| T${String(t.x).padEnd(2)} (lnD=${Math.log(t.S.length).toFixed(1)}) `; console.log(head); for (const p of PR.filter(q => q >= 7 && q <= 200)) { let row = ` ${String(p).padStart(3)} `; for (const t of tiles) row += `| ${String(t.x > p ? '-' : runFor(t.S, p)).padStart(16)} `; console.log(row); } console.log('\n qualifying-gap fraction f (gaps = 0,+-2 mod p), same sweep:\n'); console.log(head); for (const p of PR.filter(q => q >= 7 && q <= 200)) { let row = ` ${String(p).padStart(3)} `; for (const t of tiles) row += `| ${(t.x > p ? '-' : qualFrac(t.S, t.W, p).toFixed(4)).padStart(16)} `; console.log(row); } // ============================================================================ // OUTPUT — EMBEDDED, do not hand-edit. Regenerate: // node research/qc/embed.js research/Lgrowth.js // invocation: node research/Lgrowth.js // code-sha256: 5ec49bf1d70b7a8e98e39a1997527a22b3a089e73836d9979171510896f8519c // out-sha256: fc936db6a635e5f856923357e6113ebeda520a60c60c6b2537c5e75285cc36f4 // body-lines: 93 // streams: stdout // node: v22.23.3 // embedded: 2026-09-25 // elapsed: 32.7 s // ============================================================================ // L(T_x, p) for a sweep of folding primes p. D = census of T_x, lnD in brackets. // // p | T7 (lnD=2.7) | T11 (lnD=4.9) | T13 (lnD=7.3) | T17 (lnD=10.0) | T19 (lnD=12.8) | T23 (lnD=15.9) // 7 | 3 | - | - | - | - | - // 11 | 1 | 2 | - | - | - | - // 13 | 1 | 2 | 2 | - | - | - // 17 | 1 | 2 | 2 | 2 | - | - // 19 | 1 | 2 | 2 | 2 | 2 | - // 23 | 1 | 1 | 2 | 2 | 3 | 4 // 29 | 1 | 1 | 2 | 2 | 2 | 2 // 31 | 1 | 1 | 2 | 2 | 3 | 3 // 37 | 1 | 1 | 1 | 2 | 2 | 2 // 41 | 1 | 1 | 1 | 2 | 2 | 2 // 43 | 1 | 1 | 1 | 2 | 2 | 2 // 47 | 1 | 1 | 1 | 2 | 2 | 2 // 53 | 1 | 1 | 1 | 2 | 2 | 2 // 59 | 1 | 1 | 1 | 1 | 2 | 2 // 61 | 1 | 1 | 1 | 1 | 2 | 2 // 67 | 1 | 1 | 1 | 1 | 2 | 2 // 71 | 1 | 1 | 1 | 1 | 1 | 1 // 73 | 1 | 1 | 1 | 1 | 1 | 1 // 79 | 1 | 1 | 1 | 1 | 1 | 2 // 83 | 1 | 1 | 1 | 1 | 1 | 2 // 89 | 1 | 1 | 1 | 1 | 1 | 2 // 97 | 1 | 1 | 1 | 1 | 1 | 2 // 101 | 1 | 1 | 1 | 1 | 1 | 2 // 103 | 1 | 1 | 1 | 1 | 1 | 2 // 107 | 1 | 1 | 1 | 1 | 1 | 1 // 109 | 1 | 1 | 1 | 1 | 1 | 1 // 113 | 1 | 1 | 1 | 1 | 1 | 1 // 127 | 1 | 1 | 1 | 1 | 1 | 1 // 131 | 1 | 1 | 1 | 1 | 1 | 1 // 137 | 1 | 1 | 1 | 1 | 1 | 1 // 139 | 1 | 1 | 1 | 1 | 1 | 1 // 149 | 1 | 1 | 1 | 1 | 1 | 1 // 151 | 1 | 1 | 1 | 1 | 1 | 1 // 157 | 1 | 1 | 1 | 1 | 1 | 1 // 163 | 1 | 1 | 1 | 1 | 1 | 1 // 167 | 1 | 1 | 1 | 1 | 1 | 1 // 173 | 1 | 1 | 1 | 1 | 1 | 1 // 179 | 1 | 1 | 1 | 1 | 1 | 1 // 181 | 1 | 1 | 1 | 1 | 1 | 1 // 191 | 1 | 1 | 1 | 1 | 1 | 1 // 193 | 1 | 1 | 1 | 1 | 1 | 1 // 197 | 1 | 1 | 1 | 1 | 1 | 1 // 199 | 1 | 1 | 1 | 1 | 1 | 1 // // qualifying-gap fraction f (gaps = 0,+-2 mod p), same sweep: // // p | T7 (lnD=2.7) | T11 (lnD=4.9) | T13 (lnD=7.3) | T17 (lnD=10.0) | T19 (lnD=12.8) | T23 (lnD=15.9) // 7 | 0.6667 | - | - | - | - | - // 11 | 0.0000 | 0.0741 | - | - | - | - // 13 | 0.0000 | 0.0444 | 0.0646 | - | - | - // 17 | 0.0000 | 0.0296 | 0.0485 | 0.0587 | - | - // 19 | 0.0000 | 0.0296 | 0.0404 | 0.0488 | 0.0566 | - // 23 | 0.0000 | 0.0000 | 0.0135 | 0.0224 | 0.0311 | 0.0408 // 29 | 0.0000 | 0.0000 | 0.0081 | 0.0171 | 0.0250 | 0.0307 // 31 | 0.0000 | 0.0000 | 0.0081 | 0.0171 | 0.0251 | 0.0312 // 37 | 0.0000 | 0.0000 | 0.0000 | 0.0029 | 0.0075 | 0.0121 // 41 | 0.0000 | 0.0000 | 0.0000 | 0.0005 | 0.0017 | 0.0034 // 43 | 0.0000 | 0.0000 | 0.0000 | 0.0005 | 0.0017 | 0.0034 // 47 | 0.0000 | 0.0000 | 0.0000 | 0.0010 | 0.0023 | 0.0034 // 53 | 0.0000 | 0.0000 | 0.0000 | 0.0009 | 0.0025 | 0.0041 // 59 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0004 | 0.0010 // 61 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0004 | 0.0010 // 67 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0001 | 0.0003 // 71 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 73 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 79 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 83 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 89 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 97 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 101 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 103 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 107 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 109 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 113 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 127 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 131 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 137 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 139 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 149 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 151 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 157 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 163 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 167 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 173 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 179 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 181 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 191 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 193 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 197 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // 199 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 // ============================================================================ // READINGS // ============================================================================