// The localized single-kill claim. See research/LOCALIZED-GAP.md. // // PRIOR ART: the mechanism is Holt and Rudd 2014, Lemma 3.1 of arXiv:1408.6002, // in the ONE-class setting ("the minimum span between fusions is 2p"). The // two-class form below needs the extra mod-3 step and is not in their work. // // CLAIM (elementary): no two twin slots are 2 apart, because s, s+2, s+4 would // cover all residues mod 3. Kills by p sit in classes {0, -2} mod p, which are // 2 apart. So any interval SHORTER THAN p-2 contains at most ONE kill. // Consequence: a new gap of length < p-2 merges at most TWO old gaps, so // M(T_p, Y) <= maxsum_2(T_x, Y) whenever the new gaps stay under p-2. // // On the full tile this is vacuous: G2 ~ 0.6x^2 >> p. In the head it is the // generic case. This script measures where it turns on and whether it holds. const N = Number(process.argv[2] || 3e7); const K = Number(process.argv[3] || 3); function primesUpTo(n) { const s = new Uint8Array(n + 1); const out = []; for (let i = 2; i <= n; i++) if (!s[i]) { out.push(i); for (let j = i*i; j <= n; j += i) s[j] = 1; } return out; } const XMAX = Math.floor(Math.pow(N, 1 / K)); const ladder = primesUpTo(XMAX); const rough = new Uint8Array(N + 3).fill(1); rough[0] = 0; // slot list of the current level up to Y function slots(Y) { const out = []; for (let r = 1; r < Y; r++) if (rough[r] && rough[r + 2]) out.push(r); return out; } function maxsum(list, m, Y) { // max sum of m consecutive gaps, left end < Y let best = 0; for (let i = 0; i + m < list.length; i++) { if (list[i] >= Y) break; const s = list[i + m] - list[i]; if (s > best) best = s; } return best; } console.log('x\tp\tY=p^K\t\tM(x,Y)\tms2(x,Y)\tM(p,Y)\tp-2\tM N) break; const before = slots(Y + 4096); // level x for (let j = p; j <= N + 2; j += p) rough[j] = 0; // fold p in const after = slots(Y + 4096); // level p const M_old = maxsum(before, 1, Y); const ms2_old = maxsum(before, 2, Y); const M_new = maxsum(after, 1, Y); // max kills inside a single new gap const killed = new Set(before.filter(s => s % p === 0 || (s + 2) % p === 0)); let maxKills = 0; for (let i = 0; i + 1 < after.length; i++) { if (after[i] >= Y) break; let c = 0; for (const s of killed) if (s > after[i] && s < after[i + 1]) c++; if (c > maxKills) maxKills = c; } const on = M_new < p - 2; if (on && maxKills > 1) viol1++; if (on && M_new > ms2_old) viol2++; if (on && firstOn === null) firstOn = x; rows++; if (x > 40) console.log(`${x}\t${p}\t${Y.toExponential(2)}\t${M_old}\t${ms2_old}\t\t${M_new}\t${p-2}\t${on?'YES':'no '}\t${maxKills}\t\t${M_new<=ms2_old?'ok':'FAIL'}`); } console.log(`\n# folds tested: ${rows}`); console.log(`# condition M(new) < p-2 first satisfied at x = ${firstOn}`); console.log(`# violations of "at most 1 kill per new gap when M(new)