// Job #576 (prior-art hunt for return #161). Independent recomputation of L(T_x,p), T5..T23. // // CRITERION (derived, then cross-checked against the project's own closed form below): // slot killed by the fold at p <=> t ≡ 0 or -2 (mod p) // two consecutive slots at distance g are both killed <=> g ≡ 0, +2 or -2 (mod p) // so, since every gap is a multiple of 6, // L(T_x,p) = 1 + (longest run of consecutive QUALIFYING gaps of T_x, cyclically), // a gap being qualifying when g mod p ∈ {0,2,p-2}. // Only gaps g <= G2(T_x) can qualify, and the smallest qualifying gap is 2p∓2 — the // project's own closed form {2p-2,4p+2,6p} (p≡1 mod 6) / {2p+2,4p-2,6p} (p≡5 mod 6). // // Run: node lruns3.mjs 'use strict'; function isPrime(n){ if(n<2) return false; for(let d=2;d*d<=n;d++) if(n%d===0) return false; return true; } // all t mod W with t ≢ 0 and t ≢ -2 (mod p) for every p <= x, by CRT expansion function admissibleResidues(x){ const ps=[]; for(let p=2;p<=x;p++) if(isPrime(p)) ps.push(p); let list=[0], M=1; for(const p of ps){ const out=[], bad0=0, bad1=(p-2)%p; for(let i=0;ia-b); const D=list.length, g=new Int32Array(D); for(let i=0;iG2) G2=g[i]; return { x, W, D, first:list[0], g, G2 }; } function L(T,p,cyclic){ const D=T.D, g=T.g; const q=new Uint8Array(D); for(let i=0;iq[((i%D)+D)%D]; let start=0; for(let i=0;ibest)best=c; } else c=0; } return best+1; } console.log('== the smallest qualifying gap, vs the project closed form =='); for(const p of [11,13,17,19,23,29,31,37,41,43,47]){ const q=[]; for(let g=6;g<=600;g+=6) if(g%p===0||g%p===2||g%p===p-2) q.push(g); const cf = p%6===1 ? [2*p-2,4*p+2,6*p] : [2*p+2,4*p-2,6*p]; console.log(` p=${p} (p mod 6 = ${p%6}): first qualifying gaps ${q.slice(0,6).join(',')} closed form ${cf.join(',')} ${q.slice(0,3).join(',')===cf.join(',')?'MATCH':'CHECK'}`); } console.log('\n== tiles: W, D, G2 (project ladder: T7=30 T11=42 T13=66 T17=108 T19=150 T23=204) =='); const tiles={}; for(const x of [5,7,11,13,17,19,23]){ const T=gapWord(x); tiles[x]=T; console.log(` T${x}: W=${T.W} D=${T.D} first=${T.first} G2=${T.G2}`); } console.log('\n== thresholds: smallest p0 with L(T_x,q)=1 for every prime q in [p0,1009] =='); const want={5:11,7:11,11:23,13:37,17:59,19:71,23:107,29:127}; let seam=0, entries=0; for(const x of [5,7,11,13,17,19,23]){ const T=tiles[x]; let p0=null, lastBad=-1, maxL=1, arg=null; const seen=[]; for(let p=x;p<=1009;p++){ if(!isPrime(p)) continue; const Lc=L(T,p,true), Ll=L(T,p,false); entries++; if(Lc!==Ll) seam++; if(Lc>maxL){ maxL=Lc; arg=p; } if(Lc>1) lastBad=p; if(p<=110) seen.push(`${p}:${Lc}`); } const primes=[]; for(let p=x;p<=1009;p++) if(isPrime(p)) primes.push(p); p0 = lastBad>0 ? primes.find(p=>p>lastBad) : primes[0]; const ok = want[x]===undefined?'n/a':(want[x]===p0?'MATCH':`DIFFERS (want ${want[x]})`); console.log(` T${x}: p0=${p0} [${ok}] max L=${maxL} at p=${arg}`); console.log(` sweep to p=110: ${seen.join(' ')}`); } console.log(`\n seam (cyclic vs linear): ${seam} disagreements in ${entries} entries [#161 claims 0]`); console.log('\n #161: T5 from 11; T7 from 11; T11 from 23; T13 from 37; T17 from 59; T19 from 71; T23 from 107; T29 from 127'); console.log(' #161: "T23 dip to 1 at p=71,73 and return to 2 at 79 to 103"; diagonal 2,1,2,2,2,3,2,4');