"""Job #4555 (first look, route 176). QUESTION: is route 176's object (return #2039) route 107's F = S4/A^2, and is its H log log H growth a property of that object? SERVED DEFINITION (#1834 reduction2669.md, #2038): odd p: f_p(h) = (1 - nu_p(h)/p)/(1 - 2/p)^2, nu_p = #{0,2,h,h+2 mod p}; f_3 = 3 if 3|h else 0; p >= 5: p/(p-2) if p|h, p(p-3)/(p-2)^2 if p|h-2 or p|h+2, generic g_p = p(p-4)/(p-2)^2 = 1 - 4/(p-2)^2 otherwise. Exactly: F_a(h) = [3|h] 3 K5 prod_{p>=5,p|h}(p-2)/(p-4) prod_{p>=5,p|h^2-4}(p-3)/(p-4) (p>2 product), K5 = prod_{p>=5} p(p-4)/(p-2)^2 (#2042). #2039's ENGINE (def.c, read): F_eng(h) = (5/3) exp(Lh[h] - Lh[6] + sum_{8
x diverges. S_route(H) = sum_{h=2}^{H} ([2|h](2 F_eng(h) - 1) - [2 not| h]). PRE-REGISTERED. G1: the formula (5/3) [F_a(h)/F_a(6)] Pi(h+2) reproduces #2039's anchors F(6) = 1.666666667, F(12) = 4.951875659, F(30) = 8.957230873, F(48) = 5.154699312 to 1e-9. G2: it reproduces #2039's E3 table S_route at H = 1e3, 1e4, 1e5, 5e5 (1956.12778610458, 31229.985929607, 427780.46191097, 2542285.5563277844) to 1e-8 relative. T1: route 176's section-1 identities against the served f_p, exactly for p <= 97: its "f_3(h) = 3 for every h" fails (f_3 = 0 at 3 not| h); its "(p-2)/(p-1) on p | h(h-2)(h+2), else (p-1)/(p-2)" differs from the served values at every p >= 5, and its factors do not average to 1 over h mod p (the served ones do). T2: Pi(x)/ln x settles to a positive constant (a log-divergent renormalisation), and prod_{8
0 (mean one; #2042). FALSIFIERS: G1 or G2 failing (then #2039's object is something else and this diagnosis is wrong).""" import sys, json, math from fractions import Fraction as Fr import numpy as np import mpmath as mp led = [] def check(tag, ok, detail): led.append(f"{'PASS' if ok else 'FAIL'} {tag} :: {detail}"); print(led[-1], file=sys.stderr, flush=True) def sieve(n): s = np.ones(n + 1, dtype=bool); s[:2] = False for i in range(2, int(n ** 0.5) + 1): if s[i]: s[i * i::i] = False return np.flatnonzero(s) HMAX = 10 ** 7; PC = 2 * 10 ** 7 PR = sieve(PC); p5 = PR[PR >= 5].astype(np.float64) logK5 = math.fsum(np.log1p(-4.0 / (p5 - 2) ** 2)) - 4 * float(mp.e1(mp.log(PC))); K5 = math.exp(logK5) NK = HMAX // 3 + 2 logr = np.zeros(NK + 1) for p in PR[(PR >= 5) & (PR <= 3 * NK + 2)].tolist(): inv3 = pow(3, -1, p); logr[p::p] += math.log((p - 2) / (p - 4)); c = math.log((p - 3) / (p - 4)) logr[(2 * inv3) % p::p] += c; logr[(-2 * inv3) % p::p] += c Fa3 = 3 * K5 * np.exp(logr); Fa3[0] = 0.0 # F_a at h = 3k # Pi(x) = prod_{8
8) & (PR <= HMAX + 2)].astype(np.float64) logPi_p = np.log1p(-4.0 / (ps - 2) ** 2) + np.log((ps - 1) / (ps - 2)) cum = np.concatenate(([0.0], np.cumsum(logPi_p))) idx_at = np.searchsorted(ps, np.arange(HMAX + 3, dtype=np.float64), side='right') # number of primes 8
5 else fp(1)} claimed = {'0': Fr(p - 2, p - 1), '+2': Fr(p - 2, p - 1), '-2': Fr(p - 2, p - 1), 'generic': Fr(p - 1, p - 2)} mean_served = sum(fp(hh) for hh in range(p)) / p mean_claimed = (3 * Fr(p - 2, p - 1) + (p - 3) * Fr(p - 1, p - 2)) / p differ = all(served[k] != claimed[k] for k in served) t1_ok &= differ and mean_served == 1 and mean_claimed != 1 if p in (5, 7, 11, 97): t1rows.append(f"p={p}: served 0/+-2/generic = {served['0']}, {served['+2']}, {served['generic']} (mean {mean_served}); route-176 claimed {claimed['0']}, {claimed['generic']} (mean {float(mean_claimed):.6f})") check('T1_route176_identities_contradict_served_f_p', t1_ok and [v for _, v in bad3] == [3, 0, 0], f"f_3 over h = 0,1,2 mod 3: {[v for _, v in bad3]} (route 176: 3,3,3); " + '; '.join(t1rows)) # T2 Pi(x)/ln x and the divergent tail product xs = [10 ** 3, 10 ** 4, 10 ** 5, 10 ** 6, 10 ** 7] piln = [math.exp(float(logPi[x])) / math.log(x) for x in xs] cp = np.log((ps - 1) / (ps - 2)); cumc = np.concatenate(([0.0], np.cumsum(cp))) tailprod = [math.exp(float(cumc[np.searchsorted(ps, x, side='right')])) for x in xs] check('T2_Pi_is_log_divergent_renormalisation', max(piln) / min(piln) < 1.1 and all(b > a for a, b in zip(tailprod, tailprod[1:])), f"Pi(x)/ln x at x = 1e3..1e7: {[round(v, 5) for v in piln]}; prod_{{8
h+2}}(p-1)/(p-2) is infinite)") # T3 growth of #2039's object vs the served object Hs = [10 ** 3, 10 ** 4, 10 ** 5, 5 * 10 ** 5, 10 ** 6, 10 ** 7] rows = [] Cb = np.cumsum(np.where(even6, 2 * Fa3, 0.0)) for H in Hs: L = math.log(H); Sr = S_route(H); Mb = float(Cb[H // 3]) - H rows.append((H, Sr / H, Sr / (H * L), Sr / (H * math.log(L)), Mb / H)) check('T3_2039_growth_is_H_lnH_from_Pi_served_object_mean_one', abs(rows[-1][2] / rows[-2][2] - 1) < 0.05 and abs(rows[-1][4]) < 1e-4, '; '.join(f"H={H:.0e}: S_route/H={a:.4f} /(H lnH)={b:.4f} /(H lnlnH)={c:.4f} | served sum(F_b-1)/H={d:+.2e}" for H, a, b, c, d in rows)) print('\n'.join(led)) print('VERDICT ' + json.dumps({'all_pass': all(l.startswith('PASS') for l in led), 'K5': K5, 'S_route_over_HlnH_1e7': rows[-1][2], 'S_route_over_HlnlnH_1e7': rows[-1][3], 'served_mean_dev_1e7': rows[-1][4]}))