#!/usr/bin/env python3 """eh663.py -- how far the printed absolute-value theorems are from (4.9). (4.9) of `research/fixed-endpoint-discrepancy.md` asks, for odd q and a fixed level excess eps' > 0, S = sum_{q <= 2 x^{1/2+eps'} (log x)^{3L}} tau(q)^3 sup_{t<=x} |Delta_q(t; -2)| = o(x/log x). The nearest printed statement is Theorem A of Maynard, *Primes in arithmetic progressions to large moduli I: fixed residue classes* (Mem. AMS 306(1542), 2025), which is a combination of the main results of Bombieri-Friedlander-Iwaniec II (Math. Ann. 277 (1987) 361-393) and III: for a fixed a and delta > 0, with Q = x^{1/2+delta}, sum_{q in [Q,2Q], (q,a)=1} |pi(x;q,a) - pi(x)/phi(q)| <<_a delta^2 x/log x + x (log log x)^{O(1)} / (log x)^3. This script computes, for named log x and eps', what that statement gives when accumulated over the dyadic blocks of the whole level range q <= x^{1/2+eps'}, and compares with the target. Everything here is exact arithmetic on the quoted error terms plus the classical block sums sum_{q in [Q,2Q]} 1/q ~ log 2 (odd q: ~ (log 2)/2) and sum_j j^2 = J(J+1)(2J+1)/6. No randomness, no clock, no float accumulation order. """ import math from fractions import Fraction as F LOG2 = math.log(2) X0 = 10.0 ** 12 # only enters through log x / log log x; printed for scale def block_count(logx, eps): """number of dyadic blocks (each of multiplicative width 2) from x^{1/2} to x^{1/2+eps}""" return eps * logx / LOG2 def theoremA_block(logx, delta, q1=1): """Theorem A's bound for one block, in units of x, with (log log x)^{O(1)} taken as (log log x)^{q1} (q1 = 0 or 1; the statement is O(1)).""" return delta * delta / logx + (math.log(logx) ** q1) / logx ** 3 def accumulated(logx, eps, q1=1): """Theorem A's bound, dyadic blocks summed over the whole range, in units of x.""" J = int(block_count(logx, eps)) + 1 d = LOG2 / logx s1 = sum(0.0 for _ in range(0)) tot1 = sum((j * d) ** 2 / logx for j in range(1, J + 1)) # delta_j^2 x / log x tot2 = J * (math.log(logx) ** q1) / logx ** 3 # x (loglog)^{O(1)}/(logx)^3 return tot1, tot2, tot1 + tot2, J print("== 1. one block: which of the two terms of Theorem A is smaller ==") print(" Theorem A : delta^2 x/log x + x (log log x)^O(1) / (log x)^3") print(" the two terms meet at delta = (log log x)^{O(1)/2} / log x;") for logx in (50.0, 100.0, 300.0): star0 = 1.0 / logx star1 = math.sqrt(math.log(logx)) / logx print(" log x = %-5.0f x = 10^%-5.1f delta* = %.5f (O(1)=0) %.5f (O(1)=1)" % (logx, logx / math.log(10), star0, star1)) print(" so for delta >> 1/log x the delta^2 x/log x term dominates the block and GROWS with delta,") print(" while a single block's trivial bound is only ~ (log 2)/2 * x:") for logx in (100.0,): for delta in (0.001, 0.01, 0.1, 0.25): a1 = theoremA_block(logx, delta, 1) print(" log x=100 delta=%-6.3f Theorem A = %8.5f x trivial block = %6.4f x ratio %8.2f" % (delta, a1, LOG2 / 2, a1 / (LOG2 / 2))) print() print("== 2. accumulated over the whole level range 0 < delta <= eps' ==") print(" (this is what (4.9) needs, since its sum runs over all q up to x^{1/2+eps'})") print(" %-6s %-7s %-6s %-14s %-14s %-12s %-10s" % ("log x", "eps'", "blocks", "sum delta^2 x/logx", "sum log-term", "total (x)", "total/target")) for logx in (100.0, 300.0): for eps in (0.01, 0.1, 0.25): t1, t2, tot, J = accumulated(logx, eps, 1) target = 1.0 / logx print(" %-6.0f %-7.2f %-6d %-14.5f %-14.2e %-12.5f %-10.2f" % (logx, eps, J, t1, t2, tot, tot / target)) print(" target = x/log x (in units of x: 1/log x). A value that does not fall towards 0 as") print(" log x grows is not o(x/log x): the delta^2 term is ~ eps'^3 x /(3 log 2), independent of x.") for logx in (100.0, 300.0, 1000.0): for eps in (0.01, 0.1, 0.25): t1 = sum((j * LOG2 / logx) ** 2 / logx for j in range(1, int(block_count(logx, eps)) + 2)) print(" log x=%-6.0f eps'=%-5.2f leading term = %.6f x eps'^3/(3 log 2) = %.6f x" % (logx, eps, t1, eps ** 3 / (3 * LOG2))) print() print("== 3. the saving (4.9) asks for, measured against the trivial bound ==") print(" trivial per block: sum_{q in [Q,2Q], q odd} x/phi(q) ~ (log 2)/2 * x") print(" over J blocks: ~ eps' log x/2 * x ; the target is o(x/log x), so the required") print(" saving over trivial is ~ eps' (log x)^2/2, and Theorem A delivers, in the best case") print(" (its log term, one block, delta -> 0), x (log log x)^{O(1)}/(log x)^3 -- a saving of") print(" (log x)^3/(log log x)^{O(1)} for ONE block, not over the range.") for logx in (100.0, 300.0): print(" log x=%-6.0f trivial total = %.3f x target = %.5f x required saving = %.1f" % (logx, math.log(2) / 2 * block_count(logx, 0.01) * 0 + (0.5 * LOG2) * block_count(logx, 0.01), 1 / logx, ((0.5 * LOG2) * block_count(logx, 0.01)) * logx)) print() print("== 4. what the tau(q)^3 weight costs (measurement, q odd) ==") N = 10 ** 7 tau = [0] * (N + 1) for i in range(1, N + 1, 1): for j in range(i, N + 1, i): tau[j] += 1 phi = list(range(N + 1)) for p in range(2, N + 1): if phi[p] == p: # p prime for j in range(p, N + 1, p): phi[j] -= phi[j] // p acc3_q = 0.0 acc3_phi = 0.0 ck = [10 ** 4, 10 ** 5, 10 ** 6, 10 ** 7] print(" %-10s %-16s %-16s %-10s %-10s" % ("Q", "sum tau^3/q", "sum tau^3/phi(q)", "/(logQ)^3", "/(logQ)^4")) for q in range(3, N + 1, 2): acc3_q += tau[q] ** 3 / q acc3_phi += tau[q] ** 3 / phi[q] if ck and q >= ck[0]: c = ck.pop(0) l = math.log(q) print(" %-10d %-16.4f %-16.4f %-10.4f %-10.4f" % (q, acc3_q, acc3_phi, acc3_phi / l ** 3, acc3_phi / l ** 4)) print(" tau(q)^3 is (log q)^3 on average: the weight itself costs (log x)^3 on the trivial scale,") print(" before the sup over prefixes is handled, so the unweighted block bounds of sections 1-2") print(" must be applied to the weighted sum at that further cost.") print() print("verdict: Theorem A is an absolute-value, all-moduli theorem at level x^{1/2+delta}, so the") print("sentence 'the absolute-value theorems stop at x^{1/2}' is not true as written; what fails is") print("the SHAPE AND SIZE of its error term over the level range (the delta^2 x/log x term), plus the") print("tau(q)^3 weight, not the existence of a beyond-1/2 absolute-value theorem.")