// Question: is the strict-tail class offset determined by three gap-length sums? // Independent definition-level verifier; no code or cached census from the author. // Node.js 18+; no packages, random draws, network or platform-specific paths. // Run: node tail-class-offset-check.js > tail-class-offset-check.out const assert=require('node:assert/strict'); const primes=[2,3,5,7,11,13,17,19]; const rows=[]; function gcd(a,b){while(b){[a,b]=[b,a%b];}return a;} for(const x of [5,7,11,13,17,19]){ const ps=primes.filter(p=>p<=x),W=ps.reduce((a,p)=>a*p,1); const alive=new Uint8Array(W);alive.fill(1); for(const p of ps){for(let a=0;ap>=3).reduce((n,p)=>n*(p-2),1)); if(x<=11)for(let a=0;aa-W).concat(A);let strict=-1,nonstrict=-1,exclusive=-1; const classSums=Array(30).fill(0);let strictSum=0,nonSum=0,exclusiveSum=0; for(let o=0;o=0&&nonstrict>=0&&exclusive>=0); const t=o-extended[strict];strictSum+=t;classSums[o%30]+=t; nonSum+=o-extended[nonstrict];exclusiveSum+=o-extended[exclusive]; } assert.equal(G[11]+G[17]+G[29],W); assert.equal(2*strictSum,squareSum+5*W); assert.equal(2*nonSum,squareSum-W); assert.equal(2*exclusiveSum,squareSum+W); const classTotal=classSums[1]+classSums[19]; const lhs=30*classTotal-squareSum; const rhs=-4*W+26*G[29]+2*G[11]+20*G[17]; assert.equal(lhs,rhs); // Check every residue recurrence, not only the desired two-class average. for(let s=0;s<30;s++){ const ending=(s-2+30)%30; assert.equal(classSums[(s+1)%30]-classSums[s],W/30-(G[ending]||0)); } const divisor=gcd(lhs,2*W); rows.push({x,W,D:A.length,G11:G[11],G17:G[17],G29:G[29],offset_exact:`${lhs/divisor}/${2*W/divisor}`,offset:lhs/(2*W),residue_recurrences_checked:30}); } console.log(JSON.stringify({definition:'tau(o)=o-max{a in periodic T_x:a+2