from itertools import product from collections import Counter def run(load,check): rows=[];counts=Counter();fixed=[];allk=[] for j,i,r,n in product(range(8),range(8),range(6),range(2,8)): first=1060+i-j;second=7935+r-i;last=1058+n-r fixed8=(i+r==0 and j+n==2);goodK=all(x%529==0 for x in [first,second,last]) row={'Shem_index':j,'Flood_index':i,'MT_index_offset':r,'SP_Noah_offset':n,'widths':[first,second,last],'fixed8K':fixed8,'allK':goodK} rows.append(row);counts['fixed8K']+=fixed8;counts['allK']+=goodK;counts['both']+=fixed8 and goodK if fixed8:fixed.append(row) if goodK:allk.append(row) check('complete2304 configurations',len(rows)==2304) check('one fixed reflection and four allK',[counts[x] for x in ['fixed8K','allK','both']]==[1,4,0]) check('fixed source opening solution',[(x['Shem_index'],x['Flood_index'],x['MT_index_offset'],x['SP_Noah_offset']) for x in fixed]==[(0,0,0,2)]) check('allK index relations',all(x['Shem_index']==x['Flood_index']+2 and x['MT_index_offset']==x['SP_Noah_offset']==x['Flood_index'] for x in allk)) adjustments=[] for row in allk: i=row['Flood_index'];kappa=-2*i check(f'unique formal correction i{i}',kappa+i+row['MT_index_offset']==0 and kappa-2+row['Shem_index']+row['SP_Noah_offset']==0) adjustments.append({'i':i,'formal_bridge_correction':kappa,'formal_W':6877+kappa,'adopted':False}) check('formal adjustments',sorted(r['formal_bridge_correction'] for r in adjustments)==[-10,-8,-6,-4]) return {'counts':dict(counts),'all2304_rows':rows,'fixed_reflection_solution':fixed,'allK_solutions':allk,'formal_adjustments':adjustments,'constraint_equations':['fixed reflection: i+r=0,j+n=2','allK: j=i+2,r=i,n=i','for common allK row and bridge13K+kappa: kappa=-2i'],'conclusion':'No simultaneous solution in the admitted complete SP source domain at the fixed bridges.'}