#!/usr/bin/env node // job66-anchored-pairs.js (2026-09-11, solveathome job #66, handle Benjaminsen) // QUESTION. On the anchored measure (r uniform on the Natal@5 comb N inside // [0, W), W = x#), which pairs of strike events are EXACTLY independent? // Suen's inequality (Janson 1998, Remark 3) needs a dependency graph in the // strong sense; if no cross-prime pair is exactly independent, the only // admissible graph is the complete one. `history/staging/import-suen.md` §5 // asserts completeness; this script computes it at @11..@23. // Objects from paper/anchored-note.md §1: comb r ≡ 11,17 (mod 30), r mod p ∉ // {0, p−2} for 7 ≤ p ≤ x; y = largest prime ≤ √(W+2); scour primes x < q ≤ y; // A_q^L = {q | r}, A_q^R = {q | r+2}. Independent implementation: multiples of // each q are walked directly (no primality sieve), so L0, R0, S0 come out as // a by-product and are compared with import-suen-01-transfer.js PART A. 'use strict'; function primesUpTo(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;} const LEVELS=(process.argv[2]?process.argv[2].split(',').map(Number):[11,13,17,19,23]); console.log('job66-anchored-pairs: exact pairwise (in)dependence of strike events on the anchored measure'); for(const x of LEVELS){ const t0=Date.now(); const base=primesUpTo(x).filter(p=>p>=7); let W=30; for(const p of base) W*=p; const Nbar=2*base.reduce((a,p)=>a*(p-2),1); const root=Math.floor(Math.sqrt(W+2)); const y=primesUpTo(root).filter(p=>p>2).pop(); const scour=primesUpTo(y).filter(q=>q>x); const K=scour.length; const E=2*K; // slots: r = 30k+11 -> 2k, r = 30k+17 -> 2k+1 const nslot=2*(W/30); const natal=new Uint8Array(nslot); let Ncount=0; for(let k=0;k{const m=r%30; if(m!==11&&m!==17) return -1; const s=2*Math.floor(r/30)+(m===17?1:0); return natal[s]?s:-1;}; // pass 1: count events per slot; marginals const cnt=new Uint8Array(nslot); const marg=new Float64Array(E); const walk=(fn)=>{for(let i=0;i=0) fn(s,2*i); s=slotOf(m-2); if(s>=0) fn(s,2*i+1);} }}; walk((s,e)=>{cnt[s]++; marg[e]++;}); const off=new Int32Array(nslot+1); for(let s=0;s{ev[off[s]+fill[s]++]=e;}); // anchored counts as by-product let L0=0,R0=0,S0=0; for(let s=0;s>1)===(v>>1); const J=joint[u*E+v]; const pr=marg[u]*marg[v]; if(same){within++; if(J!==0) withinNonzero++; continue;} cross++; if(J*Nbar===pr) indep++; if(J===0) zeroJoint++; if(pr>0&&J>0){ const dev=J*Nbar/pr-1; nRatio++; sumAbsDev+=Math.abs(dev); if(dev>0)posDev++; else negDev++; if(Math.abs(dev)>maxDev){maxDev=Math.abs(dev); maxDevPair=[scour[u>>1],(u&1)?'R':'L',scour[v>>1],(v&1)?'R':'L',J,marg[u],marg[v]];} } } // marginal deviation from 1/q let maxMarg=0; for(let e=0;e>1]; const dev=Math.abs(marg[e]*q/Nbar-1); if(dev>maxMarg) maxMarg=dev; } // pairs with q q' <= W (the "nearly independent" regime the proposal's referee names) let smallProd=0, smallIndep=0; for(let i=0;idmaxA) dmaxA=d; } const t2A=-muA+DeltaA*Math.exp(2*dmaxA), t3A=-Math.min(muA*muA/(8*DeltaA), muA/(6*dmaxA), muA/2), t8A=1-Delta0StarA*Math.exp(DeltaStarA); // job #1846 (2026-09-18): the referee of return #22 (review 70, §1) reads Janson's k~A as NOT // excluding members of A, so the product over k~{i,j} is 1/P for BOTH starred quantities. // Nothing else changes: the same DeltaA and DeltaProdA, divided by P2a. const DStarCorr=DeltaA/P2a, D0StarCorr=DeltaProdA/P2a, t8Corr=1-D0StarCorr*Math.exp(DStarCorr); console.log(` CORRECTED (no endpoint exclusion) @${x}: Dstar ${DStarCorr.toFixed(9)} (ms ${DeltaStarA.toFixed(9)}); D0star ${D0StarCorr.toFixed(9)} (ms ${Delta0StarA.toFixed(9)}); Thm8 bracket ${t8Corr.toExponential(6)} (ms ${t8A.toExponential(6)}); Dstar_corr>=Dstar_ms ${DeltaStarA<=DStarCorr}; D0_corr>=D0_ms ${Delta0StarA<=D0StarCorr}; P ${P2a.toFixed(9)}; truth S0/N ${(S0/Nbar).toFixed(6)}`); console.error(`\n@${x}: W=${W} N̄=${Nbar} y=${y} K=${K} events=${E} L0=${L0} R0=${R0} S0=${S0} (${((Date.now()-t0)/1000).toFixed(1)} s)`); console.log(` within-prime pairs ${within}, with nonzero joint count ${withinNonzero} (mutual exclusion holds iff 0)`); console.log(` cross-prime pairs ${cross}: exactly independent ${indep}; joint count zero ${zeroJoint}`); console.log(` prime pairs with q·q' ≤ W: ${smallProd} (×4 event pairs = ${4*smallProd}), of which exactly independent ${smallIndep}`); console.log(` max |P(A∧B)/(P(A)P(B)) − 1| over cross pairs with nonzero joint: ${(100*maxDev).toFixed(2)}% at ${maxDevPair?maxDevPair.slice(0,4).join(' '):'-'} (joint ${maxDevPair?maxDevPair[4]:'-'}, marginals ${maxDevPair?maxDevPair[5]+','+maxDevPair[6]:'-'})`); console.log(` mean |dev| ${(100*sumAbsDev/Math.max(nRatio,1)).toFixed(3)}% over ${nRatio} pairs; positive ${posDev}, negative ${negDev}`); console.log(` max |q·P(A_q)/1 − 1| over events (marginal vs 1/q): ${(100*maxMarg).toFixed(3)}%`); console.log(` Suen inputs, anchored vs ν: μ ${muA.toFixed(5)} vs ${muNu.toFixed(5)} (ratio ${(muA/muNu).toFixed(4)}); Δ (unordered, one event per prime) ${DeltaA.toFixed(4)} vs ν-value ${DeltaNu.toFixed(4)} (ratio ${(DeltaA/DeltaNu).toFixed(4)}); Σ p_i p_j anchored ${DeltaProdA.toFixed(4)}`); console.log(` Suen (complete graph) with anchored inputs: δ=max_i Σ_{j≠i} p_j ${dmaxA.toFixed(5)}; Δ* ${DeltaStarA.toFixed(3)}; Δ₀* ${Delta0StarA.toFixed(3)}; Thm 2 exponent ${t2A>=0?'+':''}${t2A.toFixed(1)}; Thm 3 bound ${Math.exp(t3A).toFixed(5)}; Thm 8 bracket ${t8A.toExponential(2)}; truth S0/N̄ ${(S0/Nbar).toFixed(6)}`); // ---- job #1847 (2026-09-18, attempt e4d74bf0...): RESTRICTED dependency graph ---- // Keep only prime pairs (i,j), i Sum4(i,j) * Nbar === (m_i+m_i')(m_j+m_j') (exact integers) // Restricted bracket (review 70's reading, no endpoint exclusion): // DstarR = sum_{E_R} J_ij / P_ij , D0R = sum_{E_R} p_i p_j / P_ij , // P_ij = prod_{k != i,j : k ~_R i or k ~_R j} (1 - p_k) , bracket = 1 - D0R*exp(DstarR) // Manuscript reading restricted: DstarR_ms = sum J_ij (1-p_i)(1-p_j)/P_ij , // D0R_ms = sum p_i(1-p_i) p_j(1-p_j)/P_ij . { const nonAdj = new Map(); let indepPairs = 0; const indepList = []; for (let i = 0; i < K; i++) for (let j = i + 1; j < K; j++) { const s4 = joint[(2*i)*E+2*j] + joint[(2*i)*E+2*j+1] + joint[(2*i+1)*E+2*j] + joint[(2*i+1)*E+2*j+1]; if (s4 * Nbar === (marg[2*i]+marg[2*i+1]) * (marg[2*j]+marg[2*j+1])) { indepPairs++; indepList.push([scour[i], scour[j], s4]); if (!nonAdj.has(i)) nonAdj.set(i, []); if (!nonAdj.has(j)) nonAdj.set(j, []); nonAdj.get(i).push(j); nonAdj.get(j).push(i); } } let logPall = 0, sumA2 = 0, sumB2 = 0; for (let k = 0; k < K; k++) logPall += Math.log(1 - pa[k]); let DstarR = 0, D0R = 0, DstarRms = 0, D0Rms = 0, maxExcl = 0; for (let i = 0; i < K; i++) for (let j = i + 1; j < K; j++) { const m_i = marg[2*i] + marg[2*i+1], m_j = marg[2*j] + marg[2*j+1]; const s4 = joint[(2*i)*E+2*j] + joint[(2*i)*E+2*j+1] + joint[(2*i+1)*E+2*j] + joint[(2*i+1)*E+2*j+1]; if (s4 * Nbar === m_i * m_j) continue; // exactly independent -> not an edge const ni = nonAdj.get(i) || [], nj = nonAdj.get(j) || []; let ex = 0; for (const k of ni) if (k !== i && k !== j) ex += Math.log(1 - pa[k]); for (const k of nj) if (k !== i && k !== j && !ni.includes(k)) ex += Math.log(1 - pa[k]); const nl = ni.length + nj.length; if (nl > maxExcl) maxExcl = nl; const invM = Math.exp(-(logPall - Math.log(1 - pa[i]) - Math.log(1 - pa[j]) - ex)); const invC = invM / ((1 - pa[i]) * (1 - pa[j])); const J = s4 / Nbar; DstarR += J * invC; // CORRECTED reading (neighbourhood product includes i,j), restricted graph D0R += pa[i] * pa[j] * invC; DstarRms += J * invM; // MANUSCRIPT reading (excludes i,j), restricted graph D0Rms += pa[i] * pa[j] * invM; } const t8R = 1 - D0R * Math.exp(DstarR); const t8Rms = 1 - D0Rms * Math.exp(DstarRms); console.log(`RESTRICTED @${x}: excluded_independent_prime_pairs=${indepPairs} ${JSON.stringify(indepList)} max_nonadj=${maxExcl}`); console.log(`RESTRICTED @${x}: DstarR=${DstarR.toFixed(9)} D0R=${D0R.toFixed(9)} bracket_R=${t8R.toExponential(6)} | complete_corrected Dstar=${DStarCorr.toFixed(9)} D0=${D0StarCorr.toFixed(9)} bracket=${t8Corr.toExponential(6)} | DstarR_ms=${DstarRms.toFixed(9)} D0R_ms=${D0Rms.toFixed(9)} bracketR_ms=${t8Rms.toExponential(6)} manuscript_complete bracket_ms=${t8A.toExponential(6)}`); console.log(`RESTRICTED @${x}: ratio bracket_R/bracket_complete_corrected=${(t8R/t8Corr).toFixed(9)} positive_R=${t8R>0} positive_R_ms=${t8Rms>0}`); } }