// Generate the cumulative Scour march on the Natal@5 set of the 17-tile. // Fresh removals only (each prime removes only not-yet-removed members). // Distinguishes self-strikes (= twin primes FOUND) from genuine kills. // Writes a human-readable .txt report. const fs = require('fs'); 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} function isPrime(n){if(n<2)return false;for(let d=2;d*d<=n;d++)if(n%d===0)return false;return true;} const base=[2,3,5,7,11,13,17], W=base.reduce((a,b)=>a*b,1); // 510510 const bad=new Uint8Array(W); for(const q of base){for(let j=0;ja-b); const realTwins=survArr.filter(r=>isPrime(r)&&isPrime(r+2)).length; L.push(` Of the ${alive.size} survivors, ${realTwins} are genuine twin primes (r, r+2 both prime).`); L.push(` (Survivors that are not yet twins have a factor > √W = ${sqrtW.toFixed(0)}, i.e. live`); L.push(` just beyond this tile’s crystallization frontier.)`); L.push(''); L.push(' READING: fresh removals track 2/q of the survivors at every step'); L.push(' (natal-blindness); the self-strike column is a running list of twin'); L.push(' primes discovered; survival converges to Natal@5 · ∏(1−2/q).'); L.push('='.repeat(78)); const out='~/Files/Git/primeoire/research/natal5-17tile-scour.txt'; fs.writeFileSync(out, L.join('\n')+'\n'); console.log('wrote '+out+' ('+cumul+' removed, '+alive.size+' survive of '+N0+')');