# Phase-split diagnostic for route 143 (job 2851). Rebuilt from the recorded abs_majorant.py (return #1457, # sha256 c7599c91...) and the definitions in return #1463; #1463's own split_majorant.py was never uploaded. # # Objects on Z/q, q = x#, t = sieve indicator (dim 1: gcd(n,q)=1; dim 2: gcd(n(n+2),q)=1), window h: # f = S_h - mu = IFFT(T D) (true centred count; S_h(N) = sum_{i= 1 no k certifies # (C_k >= 1); if max|X|/mu < 1, C_k is strictly decreasing in k, so the least k is found by bisection. # Per h and object: k_cert (or null), log C_KMAX, max|X|/mu; domination diagnostics # max_N (|f| - |X|)/mu for X in A, B, abs (positive => X is not a pointwise majorant); g(0)/mu = sum|F|/(q mu). # # PRE-REGISTERED (written before the x = 17, 19 run; taken from #1463's next step): # success: dim 2 - exp_A within 0.2 of exp_true at x = 17 and 19 while exp_B and exp_abs stay above it, # and max g/mu > 1 exactly at the cells with k_abs = null. # failure: exp_A rises with x like exp_B (within 0.05 of exp_B at x = 17 and 19). # exp = log(h_cert)/log x with h_cert = least grid h that certifies; h_up = least grid h from which every # larger grid h certifies (reported separately, since certification need not be monotone in h). # usage: python3 split_majorant2851.py x dim [kmax] [jmin] [jmax] stdout: one JSON object import sys, json, math import numpy as np x, dim = int(sys.argv[1]), int(sys.argv[2]) KMAX = int(sys.argv[3]) if len(sys.argv) > 3 else 64 JMIN = int(sys.argv[4]) if len(sys.argv) > 4 else -6 JMAX = int(sys.argv[5]) if len(sys.argv) > 5 else 12 P = [p for p in range(2, x + 1) if all(p % r for r in range(2, int(p ** 0.5) + 1))] q = math.prod(P) t = np.ones(q, dtype=np.float64) for p in P: t[0::p] = 0 if dim == 2: t[(p - 2) % p::p] = 0 V = t.sum() / q T = np.fft.rfft(t); aT = np.abs(T) c = np.concatenate(([0], np.cumsum(np.concatenate((t, t)), dtype=np.float64))) xi = np.arange(len(T), dtype=np.float64) def logC(a, k): # log sum a^(2k), a = |X|/mu >= 0 la = np.log(a + 1e-300) * (2 * k); m = la.max() return float(m + math.log(np.exp(la - m).sum())) def kcert(a): if a.max() >= 1: return None if logC(a, KMAX) >= 0: return None lo, hi = 1, KMAX # C_hi < 1 if logC(a, 1) < 0: return 1 while hi - lo > 1: mid = (lo + hi) // 2 if logC(a, mid) < 0: hi = mid else: lo = mid return hi hs = sorted({int(round(x * x * 2 ** (j / 2))) for j in range(JMIN, JMAX + 1)}) rows = [] for h in hs: if h >= q: continue S = c[h:h + q] - c[:q]; mu = h * V; f = S - mu F = np.fft.rfft(f) # D = F / T where T != 0; build D explicitly: window indicator transform matching S_h(N)=sum t(N+i) # S = t correlated with 1_[0,h) => F = T * conj(W), W = rfft(1_[0,h)); conj(W)(xi) = sum_{i