# Closing co-layered measurement at n=12 (2026-11-04) # mean h^Col(12) = 307294.33 (-0.030% vs closure); rho_mass(12) = 2.84767564; # n*(12) = 5.68408488 vs 1/2 + 2*rho_mass/ln3 = 5.68413214; Delta = -4.7e-5. # Pipeline: full odd-character spectrum R_chi = L'/L(0,chi) by FFT along the # primitive root 2 (conductor-exact), intrinsic weights c_{v_p(j)} |B_{1,chi}|^2. # Verification chain: Sigma_new(2) = -18.8201 (ledger digit-exact); # mean h^Col(6) = 24.2425 (closure 24.29); rho_mass(6,7,8) = 2.830, 2.841, 2.845. import numpy as np, math from scipy.special import gammaln def layer_R(c): f = 3**c; phi = 2*3**(c-1) idx = np.empty(phi, dtype=np.int64); v = 1 for e in range(phi): idx[e] = v; v = (v*2) % f S = np.fft.fft(gammaln(idx.astype(np.float64)/f)) B = np.fft.fft(idx.astype(np.float64))/f js = np.arange(1, phi, 2) return js, (-math.log(f) - S[js]/B[js]).real, B[js] def c_v(v): return 3*3*(3**(v+1)-1)/4.0 def H(n): tot = 0.0 for c in range(1, n+1): js, R, B1 = layer_R(c) keep = [k for k, j in enumerate(js) if j % 3 != 0] w = c_v(n - c) * np.abs(B1[keep])**2 tot += float(np.dot(-R[keep] - 0.5*math.log(3**c), w)) return tot def rho_mass(n): M = 4*3**(n-1)-3; S = 0.0 for c in range(1, n+1): js, R, B1 = layer_R(c) keep = [k for k, j in enumerate(js) if j % 3 != 0] rho = R[keep] + math.log(3**c) w = (c_v(n-c) - c_v(n-1-c)) * np.abs(B1[keep])**2 S += float(np.dot(rho, w)) return 2*S/M/3**(n-1) for n in (2, 6, 12): Hn = H(n) sig = Hn - (H(n-1) if n > 1 else 0.0) M = 4*3**(n-1)-3 rm = rho_mass(n) lp = math.log(3) nstar = n - 4*(sig/M)/(3**(n-1)*lp) print("n=%2d Sigma_new=%14.4f mean=%12.4f rho_mass=%.8f n*=%.8f Delta=%+.2e" % (n, sig, sig/M, rm, nstar, nstar - (0.5 + 2*rm/lp)))