# predict1963b.py -- job #1963: predicted mean of beta_x(N) = S_x(N)/sqrt(N) from the s = 1/2 pole, all real even characters, # with L(1/2, chi) computed through the primitive conductor: for chi = prod_{p in S} (./p) on (Z/q)^*, chi = chi* . chi_0 with # chi* the Jacobi symbol mod q_S = prod S (primitive, odd squarefree conductor), so L(s, chi) = L(s, chi*) prod_{p | q, p not in S} # (1 - chi*(p) p^-s). mpmath.dirichlet evaluates L(1/2, chi*) from the period-q_S coefficient list (Hurwitz zeta). The # character sums factor by CRT: tau_chi = sum_{a in T_x} chi(a) = prod_{p in S} (-( -2 | p)) prod_{p odd, p not in S} (p - 2) # (over T_p = residues avoiding 0 and -2, the full sum of a nontrivial character is 0, so the sum over T_p is -chi_p(-2)). # Formula (Perron main term; see predict1963.py header): mean beta_x = (2/q) sum_{chi real even} tau_chi / L(1/2, chi). import json, math, itertools import mpmath as mp mp.mp.dps = 10 COND_CAP = 5005 # characters with conductor above this are not evaluated; their relative weight |tau|/|T| = prod_{p in S} 1/(p-2) is reported instead def leg(a, p): a %= p; return 0 if a == 0 else (1 if pow(a, (p - 1) // 2, p) == 1 else -1) res = {} for x in (11, 13, 17): ps = [p for p in (2, 3, 5, 7, 11, 13, 17) if p <= x]; q = math.prod(ps); odd = ps[1:] Tsize = math.prod(p - 2 for p in odd) zeta_half = mp.zeta(mp.mpf(1) / 2) L0 = zeta_half * math.prod(1 - p ** -0.5 for p in ps) # L(1/2, chi_0) mod q principal = 2 * Tsize / (q * L0) total = mp.mpf(principal); terms = [('principal', Tsize, float(L0), float(principal))]; skipped = [] for r in range(1, len(odd) + 1): for S in itertools.combinations(odd, r): if math.prod((-1) ** ((p - 1) // 2) for p in S) != 1: continue # odd character: cancels between n and n+2 qS = math.prod(S) tau = math.prod(-leg(-2, p) for p in S) * math.prod(p - 2 for p in odd if p not in S) if qS > COND_CAP: skipped.append((str(S), abs(tau) / Tsize)); continue chi_star = [0] * qS for a in range(qS): if math.gcd(a, qS) == 1: chi_star[a] = math.prod(leg(a, p) for p in S) Lstar = mp.dirichlet(mp.mpf(1) / 2, chi_star) Lchi = Lstar * math.prod(1 - (math.prod(leg(p, s) for s in S)) * p ** -0.5 for p in ps if p not in S) term = 2 * tau / (q * Lchi); total += term terms.append((str(S), tau, float(Lchi), float(term))) res[x] = {'q': q, 'T': Tsize, 'principal_term': float(principal), 'full_sum_real_even_chars': float(total), 'terms': terms, 'skipped_conductor_gt_cap': skipped, 'skipped_total_relative_weight': sum(w for _, w in skipped)} print(f'x={x}: q={q} |T|={Tsize} principal-character prediction {float(principal):+.4f} all real even characters {float(total):+.4f}') for S, t, L, v in terms: print(f' {S}: tau={t} L(1/2,chi)={L:+.6f} term={v:+.5f}') print(f' skipped (conductor > {COND_CAP}): {len(skipped)} characters, total relative weight sum |tau|/|T| = {sum(w for _, w in skipped):.5f}: {skipped}') b = json.load(open('bias1963.json')) for x in (11, 13, 17): lev = b['levels'][str(x)]; rng = lev['beta_times_sqrtN_range_last_decade']; ser = [r for r in lev['series'] if r['N'] >= 1e7] mean_last = sum(r['beta'] for r in ser) / len(ser) print(f'x={x}: measured beta over the last decade: range [{rng[0]:+.3f}, {rng[1]:+.3f}], snapshot mean {mean_last:+.3f}; predicted all-characters {res[x]["full_sum_real_even_chars"]:+.4f}, principal alone {res[x]["principal_term"]:+.4f}') res[x]['measured_last_decade_range'] = rng; res[x]['measured_snapshot_mean_last_decade'] = mean_last json.dump(res, open('predict1963.json', 'w'), indent=1)