#!/usr/bin/env node 'use strict'; // job #185 (explore): arithmetic consistency of three sealed pre-registrations, before any of their target // measurements exists. Pure recomputation from the numbers printed in the pre-registrations themselves. // (1) research/history/staging/attack-kstar-01-prereg.md: derived run census vs the registered N_k curves // (2) research/history/staging/var41-prereg.md: the derived sigma(41) and z(41) bands, u(41) // (3) research/history/staging/shadow-prereg.md: the frozen B_x(y) candidates and the declared noise floor // Deterministic, no randomness, no data outside those files. Elapsed to stderr. const t0 = Date.now(); // ---------------- (1) K* pre-registration ---------------- console.log('(1) Q-kstar-prereg: hist[l] = N_l - 2 N_{l+1} + N_{l+2}, N_k = 0 beyond the listed curve'); const rows = [ { step: '13#->29#', Kstar: 10, claimedMaxRuns: 6, N: [105221160, 29114520, 6942634, 1470674, 285422, 52048, 9456, 1712, 270, 36, 0] }, { step: '13#->31#', Kstar: 17, claimedMaxRuns: 2, N: [3691273410, 1208132640, 357506328, 98048374, 25570726, 6426266, 1601992, 403958, 103170, 25738, 5568, 1180, 296, 80, 18, 6, 2, 0] }, { step: '17#->31#', Kstar: 13, claimedMaxRuns: 2, N: [2524470300, 607806150, 128515868, 25793636, 5037414, 929548, 167144, 29148, 4894, 710, 138, 22, 6, 0] }, ]; for (const r of rows) { const N = k => (k >= 1 && k <= r.N.length ? r.N[k - 1] : 0); const listedK = r.N.length - 1; // the curve runs k = 1..K*+1 with N_{K*+1} = 0 const hist = []; for (let l = 1; l <= listedK; l++) hist[l] = N(l) - 2 * N(l + 1) + N(l + 2); const neg = hist.map((h, l) => [l, h]).filter(([l, h]) => l >= 1 && h < 0); // linear check: N_k = sum_{l>=k} (l-k+1) hist[l] let linearOk = true; for (let k = 1; k <= listedK; k++) { let s = 0; for (let l = k; l <= listedK; l++) s += (l - k + 1) * hist[l]; if (s !== N(k)) linearOk = false; } const kstarFromCurve = Math.max(...r.N.map((v, i) => (v >= 1 ? i + 1 : 0))); console.log(` ${r.step}: listed k = 1..${r.N.length}; K* from curve = ${kstarFromCurve} (registered ${r.Kstar}); N_{K*} = ${N(r.Kstar)}, N_{K*+1} = ${N(r.Kstar + 1)}`); console.log(` hist[l], l = 1..${listedK}: ${hist.slice(1).join(', ')}`); console.log(` negative hist entries: ${neg.length ? JSON.stringify(neg) : 'none'}; linear check reproduces every N_k: ${linearOk}; sum_l hist[l] (maximal runs) = ${hist.slice(1).reduce((a, b) => a + b, 0)}`); console.log(` maximal ${r.Kstar}-runs: from the curve hist[${r.Kstar}] = ${hist[r.Kstar]}; the pre-registration's derived sentence says ${r.claimedMaxRuns} -> ${hist[r.Kstar] === r.claimedMaxRuns ? 'CONSISTENT' : 'INCONSISTENT'}`); } const C2true = 348 / 66; console.log(` stakes: 348/66 = ${C2true.toFixed(4)}; 18/(348/66) = ${(18 / C2true).toFixed(3)}; 19.2455 - 18 = ${(19.2455 - 18).toFixed(4)}`); // ---------------- (2) Var(41) pre-registration ---------------- console.log('(2) Q-var41: derived quantities from the registered r band'); const E = 303627067641.7, S = 256725962834, W41 = 304250263527210, y41 = 17442769; const sig = x => Math.sqrt(x * E); console.log(` u(41) = ln W / ln y = ${(Math.log(W41) / Math.log(y41)).toFixed(10)} (sealed text: 2.0000005)`); console.log(` sigma(41) at r = 0.4024: ${sig(0.4024).toFixed(1)}; band from r in [0.4013, 0.4040]: [${sig(0.4013).toFixed(0)}, ${sig(0.4040).toFixed(0)}] (sealed: 349,540, [349,140, 349,880]; correction fixes 349,542 only)`); console.log(` z(41) central ${((S - E) / sig(0.4024)).toFixed(1)}; band [${((S - E) / sig(0.4013)).toFixed(0)}, ${((S - E) / sig(0.4040)).toFixed(0)}] (correction: -134,179, [-134,363, -133,913])`); const lnW = Math.log(W41), llW = Math.log(lnW); console.log(` separations at z = 41: refit-9 ${((0.6108 - 0.729 / llW) - (0.4454 - 1.534 / lnW)).toFixed(5)}, frozen-8 ${((0.6106 - 0.729 / llW) - (0.4435 - 1.509 / lnW)).toFixed(5)}`); // ---------------- (3) kill-shadow pre-registration ---------------- console.log('(3) Q-shadow-prereg: B_x(y) = (1/y^2) int_{y^2}^{2y^2} rho(ln x/ln y) dx, rho(u) = (e^gamma omega(u))^2 on [2,3], omega(u) = (1+ln(u-1))/u'); const GAM = 0.5772156649015329; const rho = u => { const w = (1 + Math.log(u - 1)) / u; return Math.pow(Math.exp(GAM) * w, 2); }; function Bx(y) { // Simpson in t = x / y^2 over [1, 2] const L = Math.log(y), n = 20000; let s = 0; for (let i = 0; i <= n; i++) { const t = 1 + i / n, u = 2 + Math.log(t) / L, c = (i === 0 || i === n) ? 1 : (i % 2 ? 4 : 2); s += c * rho(u); } return s / (3 * n); } function Bu(y) { // flat average in u over [2, 2 + ln2/ln y] const w = Math.LN2 / Math.log(y), n = 20000; let s = 0; for (let i = 0; i <= n; i++) { const u = 2 + w * i / n, c = (i === 0 || i === n) ? 1 : (i % 2 ? 4 : 2); s += c * rho(u); } return s / (3 * n); } const sealed = { 23: [0.873491, 0.865981], 97: [0.851659, 0.846009], 401: [0.839217, 0.834695], 997: [0.833670, 0.829665], 2999: [0.828512, 0.824994], 10007: [0.824182, 0.821079] }; const primes = []; { const M = 20000, c = new Uint8Array(M + 1); for (let i = 2; i <= M; i++) if (!c[i]) { primes.push(i); for (let j = i * i; j <= M; j += i) c[j] = 1; } } const fair = y => { let d = 0.5; for (const p of primes) { if (p > y) break; if (p > 2) d *= (p - 2) / p; } return d; }; console.log(` rho(2) = e^{2 gamma}/4 = ${rho(2).toFixed(6)} (sealed y -> infinity: 0.793055)`); for (const y of [23, 97, 401, 997, 2999, 10007]) { const bx = Bx(y), bu = Bu(y), N = fair(y) * y * y; console.log(` y = ${String(y).padEnd(5)} B_x ${bx.toFixed(6)} (sealed ${sealed[y][0]}) B_u ${bu.toFixed(6)} (sealed ${sealed[y][1]}) fair density ${fair(y).toExponential(4)}, N = ${N.toFixed(0)}, 1/sqrt(N) = ${(100 / Math.sqrt(N)).toFixed(2)}%`); } console.log(' declared floor in the sealed text: ~17% (23), ~8% (97), ~3.5% (401), ~1.1% (997), ~0.15% (10007); tolerance 0.011'); console.error(`elapsed ${((Date.now() - t0) / 1000).toFixed(1)} s`);