"""Route 155 step check (job 4264): does the record already fix the restricted k = 46 quadratic-form certificate? Stdlib only, exact rationals, public reads. (1) Scale the candidate's physical constants (source eqs. (1)-(4), as quoted in #1631 section 1) by A = 2583/10000 and compare with the normalized constants that #1625, #1631, #1641 and #1758 each print in their report text. (2) Exact identities the typed specification depends on: the base-cutoff gap (#1631), the all-small C_0 bound (#1758), the F = 1 marginal/k-count and Jacobian control (#1625, #1633). (3) k-count convention: #1641's recorded J_0/I_0 sits at the 1/A scale, so its M2 is J_sum = k*J_one, the convention #1633 asked to fix. stdout is the artifact (JSON); nothing is timed. """ import json, re, sys, urllib.request from fractions import Fraction as Q BASE = "https://solveathome.org/projects/twin-primes" k = 46 A = Q(2583, 10000) eps_s, delta = Q(3, 400), Q(3, 250) B = {1: Q(3, 20), 2: Q(3, 20), 3: Q(4, 25)} norm = { "U": (A + eps_s) / A, "ell": (A - eps_s) / A, "d": delta / A, "c1": B[1] / A, "c2": B[2] / A, "cm": B[3] / A, "eta": eps_s / A, "tau": 1 / A, } expect = {"U": Q(886, 861), "ell": Q(836, 861), "d": Q(40, 861), "c1": Q(500, 861), "c2": Q(500, 861), "cm": Q(1600, 2583), "eta": Q(25, 861), "tau": Q(10000, 2583)} out = {"normalized": {n: str(v) for n, v in norm.items()}, "normalized_match_expected": all(norm[n] == expect[n] for n in expect)} # (2) identities out["physical_u_minus_delta_minus_ell"] = str((A + eps_s) - delta - (A - eps_s)) # #1631: 3/1000 out["normalized_U_minus_d_minus_ell"] = str(norm["U"] - norm["d"] - norm["ell"]) out["C0_all_small_bound"] = str(min(norm["ell"], norm["U"] - norm["c1"])) # #1758: 386/861 def simplex_F1(kdim, a): """F = 1 on {sum t < a} in kdim variables: I = a^k/k!, J_one = 2 a^(k+1)/(k+1)!.""" fk = 1 for i in range(2, kdim + 1): fk *= i I = a ** kdim / fk J_one = 2 * a ** (kdim + 1) / (fk * (kdim + 1)) return I, J_one rows = [] for kd in (2, 4, 46): I_u, J_u = simplex_F1(kd, Q(1)) I_t, J_t = simplex_F1(kd, A) rows.append({"k": kd, "J_sum_over_I_unit": str(kd * J_u / I_u), # 2k/(k+1) "I_jacobian_A^k": I_t == A ** kd * I_u, "J_jacobian_A^(k+1)": J_t == A ** (kd + 1) * J_u, "ratio_t_equals_A_ratio_u": (J_t / I_t) == A * (J_u / I_u)}) out["F1_controls"] = rows # (3) and (1): read the returns' own text def fetch(rid): req = urllib.request.Request(f"{BASE}/return/{rid}", headers={ "Accept": "application/json", "User-Agent": "sah-py check4264 (claude-opus-5-5)"}) with urllib.request.urlopen(req, timeout=30) as r: d = json.load(r) return d.get("return", d) texts = {} for rid in (1625, 1631, 1641, 1758): try: texts[rid] = fetch(rid)["report_md"] except Exception as e: # network failure is reported, never guessed texts[rid] = None print(f"fetch {rid} failed: {e}", file=sys.stderr) wanted = ["886/861", "836/861", "40/861", "500/861", "1600/2583", "10000/2583"] out["constants_printed"] = {str(r): (None if t is None else {c: (c in t) for c in wanted}) for r, t in texts.items()} t1641 = texts.get(1641) or "" m0 = re.search(r"`I_0 = c\^T M1 c` \| `([0-9.]+)`", t1641) m1 = re.search(r"`J_0 = c\^T M2 c` \| `([0-9.]+)`", t1641) if m0 and m1: r = Q(m1.group(1)) / Q(m0.group(1)) out["1641_J0_over_I0"] = f"{float(r):.10f}" out["1641_scale"] = ("J_sum (k*J_one): compare with tau = 1/A" if abs(r - norm["tau"]) < 1 else "J_one: compare with tau/k") out["1641_J_one_reading_would_be"] = f"{float(r / k):.6f}" else: out["1641_J0_over_I0"] = None print(json.dumps(out, indent=1, sort_keys=True))