import json from pathlib import Path from collections import Counter N,H=12,5;sets=[{0,1,4,6},{0,1,3,7}];rows=[] for A in sets: pair=[sum((a+d)%N in A for a in A) for d in range(N)] S=[sum((a+h)%N in A for h in range(1,H+1)) for a in range(N)] b=sorted(A);G=max((b[(i+1)%len(b)]-b[i])%N for i in range(len(b))) rows.append({'A':sorted(A),'pair_correlation_counts':pair,'H':H,'S':S,'hist':dict(sorted(Counter(S).items())),'raw_moment_sums':[sum(s**j for s in S) for j in range(1,5)],'G':G,'zero_count':S.count(0)}) assert rows[0]['pair_correlation_counts']==rows[1]['pair_correlation_counts'] assert rows[0]['raw_moment_sums'][:2]==rows[1]['raw_moment_sums'][:2] assert [r['zero_count'] for r in rows]==[1,0] assert [r['G'] for r in rows]==[6,5] Path(__file__).with_name('pair-control.json').write_text(json.dumps({'posthoc_control':True,'purpose':'same pair data need not determine exact maximal gap or void count; not a disproof of a pair-based upper bound or specific CRT structure','rows':rows},indent=2,sort_keys=True)+'\n') print('PASS equal autocorrelations and first two moments, gaps6/5 and void counts1/0')