# p1check2635.py -- the well-posed reading of Conjecture P1 (route 104, return #1276), measured cheaply so that the triage # can say what the pre-registered EXP-3 would and would not see. S(X) = sum_{n <= X, n in A_P} lambda(n) lambda(n+2) # w(n) e^{2i(Theta_n + Theta_{n+2})} with Theta_n = sum_{k<=n} arctan(1/sqrt k) (Theodorus), A_P = {n odd, gcd(n(n+2), P(19)) = 1}, # and the fibre-blind control S0(X) = the same sum without the lambda product. Weights: w = 1 (rho = 0, the only reading in # which |S(X)| can grow with X) and w = e^{-rho sqrt(n+1)} for rho = 0.01 (the paper's form; bounded by 2/rho^2 + 1). # Reports |S|, |S0|, the number N of admissible terms, and |S|/sqrt(N) (the square-root-cancellation ratio); the paper's # threshold X^{1/2+delta} and its null band X^{1/2} log X are printed alongside. Deterministic; stdout is the artifact. import math, json, sys import numpy as np def liouville_upto(N): spf = np.zeros(N + 1, dtype=np.int64) for i in range(2, int(N ** .5) + 1): if spf[i] == 0: block = spf[i * i::i]; mask = block == 0; block[mask] = i; spf[i * i::i] = block lam = np.ones(N + 1, dtype=np.int8); lam[0] = 0 for n in range(2, N + 1): p = spf[n] if spf[n] else n lam[n] = -lam[n // p] return lam Xmax = 10_000_000; lam = liouville_upto(Xmax + 2) n = np.arange(1, Xmax + 3, dtype=np.int64) theta = np.cumsum(np.arctan(1.0 / np.sqrt(n.astype(np.float64)))) # Theta_n, index n-1 P19 = [3, 5, 7, 11, 13, 17, 19] nn = np.arange(1, Xmax + 1, dtype=np.int64) adm = (nn % 2 == 1) for p in P19: adm &= (nn % p != 0) & ((nn + 2) % p != 0) out = {} for X in (10 ** 6, 10 ** 7): sel = adm.copy(); sel[X:] = False idx = nn[sel] # admissible n <= X phase = np.exp(2j * (theta[idx - 1] + theta[idx + 1])) # Theta_n + Theta_{n+2} a = lam[idx].astype(np.float64) * lam[idx + 2].astype(np.float64) N = int(len(idx)); res = dict(X=X, admissible_terms=N, sqrtX=X ** .5, null_band=X ** .5 * math.log(X), threshold_delta_0_05=X ** .55) for rho in (0.0, 0.01): w = np.exp(-rho * np.sqrt(idx + 1.0)) if rho else np.ones(N) S = (a * w * phase).sum(); S0 = (w * phase).sum() res[f'rho_{rho}'] = dict(abs_S=abs(S), abs_S0=abs(S0), abs_S_over_sqrtN=abs(S) / N ** .5, abs_S0_over_sqrtN=abs(S0) / N ** .5, sum_of_weights=float(w.sum()), weight_bound_2_over_rho2_plus_1=(2 / rho ** 2 + 1) if rho else None) out[str(X)] = res json.dump(out, open('p1check2635.json', 'w'), indent=1) print(json.dumps(out, indent=1))