#!/usr/bin/env python3 """Numeric evaluation of the two constants of the identification step, job #4472. 1. C_chi of recon-0830-smooth-aps.md sec.3.1a, both forms, and the record's elementary lower bound 809/2400. 2. the Harper arXiv:2412.19644v1 Theorem 1 range on the cell's dictionary, to locate exactly which part of the modulus range the nearest printed BDH-type theorem reaches. Writes outputs/job4472/check_chi.json and prints a short report. """ import json import math import os import sys from fractions import Fraction sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) import window_kernel as wk # noqa: E402 HERE = os.path.dirname(os.path.abspath(__file__)) def primes_upto(n): s = bytearray([1]) * (n + 1) s[0:2] = b"\x00\x00" for i in range(2, int(n ** 0.5) + 1): if s[i]: s[i * i::i] = bytearray(len(s[i * i::i])) return [i for i in range(n + 1) if s[i]] def main(): ps = primes_upto(2_000_000) # L(1,chi) by its 7-blocks: converges like 1/j^2 blocks = [float(v) for v in wk.block_values(400000)] l_one = math.fsum(blocks) c1 = wk.c_chi_product(ps) c2 = wk.c_chi_euler_factor_form(l_one, ps) lower = float(wk.C_CHI_LOWER_BOUND) out = { "first_block": float(wk.block_first_value()), "all_blocks_positive_to": len(blocks), "L_1_chi7": l_one, "C_chi_product_form_p_to_2e6": c1, "C_chi_euler_factor_form_p_to_2e6": c2, "record_lower_bound_809_over_2400": lower, "one_sixth_C_chi_sq": (1.0 / 6.0) * min(c1, c2) ** 2, "bound_holds": lower <= min(c1, c2), "lower_bound_exceeds_one_third": lower > 1.0 / 3.0, "harper_range": {}, } # Harper Thm 1 range on the cell: N = L/d, Q = d, need sqrt(2N) < d <= N for L in (9699690, 223092870): dH = (2.0 * L) ** (1.0 / 3.0) d40 = L ** 0.4 out["harper_range"]["L=%d" % L] = { "d_lower_sqrt2N": dH, "d_upper_L_2_5": d40, "log_range_covered_fraction": (math.log(d40) - math.log(dH)) / math.log(d40), "covered": wk.harper_range_holds(L / dH, dH), "uncovered_at_d_small": not wk.harper_range_holds(L / (dH / 2), dH / 2), } with open(os.path.join(HERE, "check_chi.json"), "w", encoding="utf-8") as fh: json.dump(out, fh, indent=1, sort_keys=True) print(json.dumps(out, indent=1, sort_keys=True)) assert out["bound_holds"], "the record's lower bound must be below the evaluated constant" assert out["one_sixth_C_chi_sq"] > 0.0 return 0 if __name__ == "__main__": sys.exit(main())