"""Check the interpolation on captured rounded cells, without running a sieve.""" import re,hashlib from pathlib import Path source=Path(__file__).parent/'evidence/sources/research/import-thinning-03-deepfolds.js' t=source.read_text() print('Source SHA256',hashlib.sha256(source.read_bytes()).hexdigest()) rows=[] for line in t.splitlines(): if re.match(r'//\s+(31|53|101|211|421|1009)\s*\|',line): cells=line[2:].strip().split('|') if len(cells)==11: p=int(cells[0]);u=float(cells[3]);c=float(cells[8]) rows.append((p,u,c)) assert len(rows)==24 us=[.25,.5,.75,.9] grid=[sum(c for p,u,c in rows if p>=101 and u==v)/4 for v in us] def old(u): if u<=0:return 2 if u>=us[-1]:return grid[-1] i=0 while us[i+1]=us[-1]:return grid[-1] i=0 while us[i].01 assert abs(old(.75)-grid[2])>.01 pr=[] for n in range(2,1500): if all(n%p for p in pr if p*p<=n):pr.append(n) pr=[p for p in pr if p>=5] mb={};alpha=1 for p in pr:mb[p]=6*alpha;alpha*=p/(p-2) for u in us: outs=[] for f in [old,fixed]: ac=1 for p in pr:ac*=p/(p-f(u*mb[p]/(6*alpha))) outs.append(alpha/ac) print(f'top u={u:.2f}: old exponent~{outs[0]:.6f}, corrected~{outs[1]:.6f}') print('Values use rounded captured cells, so these are approximate rescoring figures, not new full-precision measurements.') print('All assertions PASS. The source extrapolates the preceding interval and misses grid knots.')