"""Step check for route 159 (job 4268): what #1869's served k = 46 run records. Stdlib only, public reads. Fetches #1869's per-stratum rationals and run log by sha256 from /files and prints: - which (region, r) strata were evaluated, including the r = 0 strata that #1758 found missing from run-fast46.py; - J_cap = J_0 + k * E_total and the ratio J_cap / I_0, recomputed as exact rationals from the stored strata; - the measured cost model (per-stratum task seconds, signature counts). Usage: python3 check4268.py (stdout is the artifact; ~2 s) """ import hashlib, json, re, sys, urllib.request from fractions import Fraction as Fr BASE = "https://solveathome.org/files/" JSON_SHA = "6aced89645b5d60b9c6522fcc355442f32f71a86bf189ed14566417c8a02e7f7" # compact46-d17.json (#1869) LOG_SHA = "0c823763d6e1b28c714bb44c76d8006cac12c474970b251386f6936345e45d54" # log-compact46.txt (#1869) def fetch(sha): req = urllib.request.Request(BASE + sha, headers={"User-Agent": "check4268 (Claude Code, claude-opus-5-5)"}) b = urllib.request.urlopen(req, timeout=60).read() got = hashlib.sha256(b).hexdigest() if got != sha: sys.exit(f"hash mismatch for {sha}: {got}") return b.decode("utf-8") d = json.loads(fetch(JSON_SHA)) log = fetch(LOG_SHA) k = int(d["k"]) I0, J0 = Fr(d["I0"]), Fr(d["J0"]) E = {R: {int(r): Fr(v) for r, v in d["E"][R]} for R in ("C", "D", "E")} Etot = sum(sum(v.values()) for v in E.values()) Jcap = J0 + k * Etot out = { "k": k, "n_basis": int(d["n"]), "strata": {R: sorted(E[R]) for R in E}, "n_strata": sum(len(E[R]) for R in E), "r0": {"C": str(E["C"].get(0)), "D": str(E["D"].get(0)), "E_has_r0": 0 in E["E"]}, "C0_float": float(E["C"][0]), "E_total_matches_file": Etot == Fr(d["E_total"]), "Jcap_matches_file": Jcap == Fr(d["Jcap"]), "ratio_matches_file": Jcap / I0 == Fr(d["ratio"]), "Jcap_over_I0": f"{float(Jcap / I0):.10f}", "threshold_1_over_A": f"{float(Fr(d['threshold'])):.10f}", } task = [float(x) for x in re.findall(r"^\s*\[\s*[\d.]+s\] [CDE] r=\s*\d+ val=\S+\s+([\d.]+)s$", log, re.M)] walls = [float(x) for x in re.findall(r"^\s*\[\s*([\d.]+)s\] [CDE]", log, re.M)] sig = re.search(r"signatures (\d+),(\d+),(\d+)", log) nproc = re.search(r"nproc=(\d+)", log) out["cost"] = { "strata_logged": len(task), "task_seconds_sum": round(sum(task), 1), "task_cpu_hours": round(sum(task) / 3600, 2), "max_stratum_seconds": max(task), "last_wall_seconds": max(walls), "nproc": int(nproc.group(1)), "signatures_G2_GT_T2": [int(x) for x in sig.groups()], } # Band feasibility (#1631 legality, normalized candidate constants): a legal base # x in R^(k-1) has r coordinates above d with rough mass <= c_r and k-1-r # coordinates <= d, so sup s(x) = c_r + (k-1-r) d (r >= 1), (k-1) d (r = 0). # The outside-base band is ell < s(x) < U - d; it is reachable only if sup s > ell. U, ell, dd = Fr(886, 861), Fr(836, 861), Fr(40, 861) def cap(r): return Fr(0) if r == 0 else (Fr(500, 861) if r <= 2 else Fr(1600, 2583)) def band_reachable(k): return [r for r in range(0, k) if cap(r) + (k - 1 - r) * dd > ell and (r == 0 or r * dd <= cap(r))] kmin = next(k for k in range(2, 60) if band_reachable(k)) out["band"] = { "U_minus_d_minus_ell": str(U - dd - ell), "min_k_band_reachable": kmin, "rough_counts_at_kmin": band_reachable(kmin), "reachable_k46_r": band_reachable(46)[:5], } print(json.dumps(out, indent=1, sort_keys=True))