#!/usr/bin/env python3 """Job #1683 (explore / new route). (H-sub-pow) instances on the KNOWN ladder. Object. f(n) = ln Ghat(n), Ghat(n) = G2(P(n)#), P(n) = largest prime <= n. (H-sub-pow): exists K >= 0 with f(b^(k+1)) <= f(b^k) + f(b) + K for all integers b >= 2, k >= 1. Source. Trusted ladder = A144311's 22 terms, served at research/a144311-full-ladder.js (rid q_1683ladder): a(m) for the m-th prime, G2(p#) = a(m) + 1, p <= 79. Custody ladder (14 exact terms of this department) is checked against it here. What is decided. Every instance is an *inequality*, so the ladder gives a LOWER bound K_needed = max_{enumerable (b,k)} [f(b^(k+1)) - f(b^k) - f(b)] on any valid K. Compared against the trusted legal floor K_trap = max_b S(b), S(b) = ln(b^2 / Ghat(b)), which is 1.3946 at b = 66. A proof of (H-sub-pow) with K < K_trap is TPC-strength (P3 of the Fekete pricing chain), so the window [K_needed, K_trap) is the live prize. Output is byte-reproducible: progress, timing and rates go to stderr. """ import json import math import sys from pathlib import Path OUT = Path(__file__).resolve().parent / "job1683-checks.json" # --- served inputs (transcribed verbatim from the fetched file) -------------- A144311 = [1, 5, 11, 29, 41, 65, 107, 149, 203, 257, 347, 527, 545, 617, 707, 869, 965, 1079, 1283, 1397, 1529, 1709] LADDER_PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79] CUSTODY_G2 = [2, 6, 12, 30, 42, 66, 108, 150, 204, 258, 348, 528, 546, 618] SERVED_FLOOR, SERVED_FLOOR_AT = 1.3946, 66 SERVED_CEILING, SERVED_CEILING_AT = 11.3568, 82 primes = [] for k in range(2, 4100): if all(k % d for d in range(2, int(k ** 0.5) + 1)): primes.append(k) def P(n): """largest prime <= n""" r = None for p in primes: if p <= n: r = p else: break if r is None: raise ValueError(f"no prime <= {n}") return r G2 = {p: A144311[i] + 1 for i, p in enumerate(LADDER_PRIMES)} GHAT = {n: G2[P(n)] for n in range(2, 83)} # Ghat on [2,83); index 83 is THE prime 83, level 83# is not served f = {n: math.log(g) for n, g in GHAT.items()} checks, facts = [], {} def chk(name, ok, detail): checks.append({"name": name, "pass": bool(ok), "detail": detail}) print(("PASS " if ok else "FAIL ") + name + " " + detail, file=sys.stderr) return ok # A1 ladder transcription chk("A1_ladder_shape", len(A144311) == 22 and len(LADDER_PRIMES) == 22 and LADDER_PRIMES == sorted(LADDER_PRIMES) and all(a % 6 == 5 for a in A144311[1:]), "22 terms, primes 2..79, a(m) = 5 mod 6 for m >= 2 (the served guard's own range)") chk("A2_custody_agrees_with_trusted", [a + 1 for a in A144311[:14]] == CUSTODY_G2, "custody G2[2..43] == a(1..14)+1, first divergence none") chk("A3_monotone_ghat", all(GHAT[n] <= GHAT[n + 1] for n in range(2, 79)), "(H-mono) holds on the ladder, so no instance is vacuous") # --- the enumerable instances ----------------------------------------------- inst = [] b = 2 while b * b <= 79: k, idx = 1, b * b while idx <= 79: inst.append({"base": b, "k": k, "idx_lo": b ** k, "idx_hi": idx, "K_needed": f[idx] - f[b ** k] - f[b]}) k += 1 idx *= b if b ** k > 79: break b += 1 inst.sort(key=lambda r: -r["K_needed"]) facts["instances"] = [{**r, "K_needed": round(r["K_needed"], 6)} for r in inst] K_needed = inst[0]["K_needed"] top = inst[0] chk("B1_instance_count", len(inst) == 13, f"b^(k+1) <= 79 forces b <= 8 (b^2 <= 79): 13 instances " f"(b=2:5, b=3:2, b=4:2, b=5,6,7,8:1 each)") chk("B2_max_instance_is_base_4_k_2", top["base"] == 4 and top["k"] == 2 and abs(K_needed - 1.003302) < 1e-5, f"max = {K_needed:.6f} at (b,k)=({top['base']},{top['k']}), " f"index {top['idx_lo']} -> {top['idx_hi']}") chk("B3_runner_up_instances", [round(r["K_needed"], 4) for r in inst[1:4]] == [0.9694, 0.9163, 0.8824], "runners-up (2,4)=0.9694, (2,2)=0.9163, (6,1)=0.8824") chk("B4_closed_form_reproduces_max", abs((f[64] - f[16] - f[4]) - K_needed) < 1e-12, "ln(Ghat(64)/Ghat(16)/Ghat(4)) = ln(1080/66/6) = ln(2.7273)") chk("B6_matches_served_power_pair_floor", abs(K_needed - 1.0033) < 1e-3, "matches served attack-hsub-01.js 'power-pair family floor (trusted): 1.0033 at (16,4)'") chk("B5_index_level_mapping", GHAT[81] == GHAT[79] == 1710 and GHAT[36] == GHAT[31] == 348 and GHAT[6] == GHAT[5] == 12, "index 81 sits at level 79 (Ghat(81)=1710) but b^(k+1) <= 79 is required, " "so (3,3) at index 81 is NOT a new instance; index reach stops at 82 because 83 is prime and G2(83#) is not served") # --- the legal floor it is compared against ---------------------------------- S = {n: math.log(n * n / GHAT[n]) for n in range(2, 80)} arg = max(S, key=S.get) chk("C1_floor_reproduced", arg == SERVED_FLOOR_AT and abs(S[arg] - SERVED_FLOOR) < 5e-5, f"max_b S(b) = {S[arg]:.6f} at b = {arg} (served {SERVED_FLOOR})") chk("C2_floor_is_the_61_term", GHAT[66] == 1080 and abs(math.log(66 ** 2 / 1080) - 1.394593) < 1e-6, "P(66) = 61, Ghat(66) = G2(61#) = 1080, S(66) = ln(4356/1080) = 1.394593") window = SERVED_FLOOR - K_needed facts["K_needed"] = round(K_needed, 6) facts["K_trap_floor"] = SERVED_FLOOR facts["window_width"] = round(window, 6) facts["fraction_of_floor_already_forced"] = round(K_needed / SERVED_FLOOR, 4) chk("C3_live_window", 0.39 < window < 0.40, f"any proof must give K >= {K_needed:.4f}; K < {SERVED_FLOOR} is TPC-strength; " f"live window [{K_needed:.4f}, {SERVED_FLOOR}) is {window:.4f} nats wide, " f"{100 * K_needed / SERVED_FLOOR:.1f}% of the floor already forced") # --- what would close the window -------------------------------------------- # --- what would close the window, ranked by the level it needs -------------- # A pair (b,k) with b^(k+1) > 82 is unreachable: it needs Ghat(b^(k+1)) = # G2(P(b^(k+1))#) >= e^(K_trap)*Ghat(b^k)*Ghat(b) to raise the floor to the # trap ceiling and so kill the TPC-implying window at that base. closure = [] for b in range(2, 12): for k in range(1, 6): hi = b ** (k + 1) if hi <= 82 or b ** k > 82 or hi > 4096: # both ends served; bound the level continue closure.append({"base": b, "k": k, "index": hi, "level": P(min(hi, 82)) if hi <= 82 else None, "Ghat_needed": math.ceil(math.exp(SERVED_FLOOR) * GHAT[b ** k] * GHAT[b])}) for c in closure: # level = P(index) = largest prime <= index c["level"] = max(p for p in primes if p <= c["index"]) closure.sort(key=lambda c: c["level"]) cheap = closure[0] facts["cheapest_closure_instance"] = cheap facts["closure_instances"] = closure[:6] facts["ladder_top_Ghat"] = max(GHAT.values()) chk("D1_cheapest_closure_is_base_10_k_1", cheap["base"] == 10 and cheap["k"] == 1 and cheap["level"] == 97 and cheap["Ghat_needed"] == 3631, f"cheapest closure instance is (b,k)=({cheap['base']},{cheap['k']}): " f"Ghat(100) = G2(97#) >= {cheap['Ghat_needed']} (4 pairs share no level, so this is the " f"cheapest single new ladder term)") need6 = next(c for c in closure if c["base"] == 6 and c["k"] == 2) chk("D2_closure_thresholds", need6["Ghat_needed"] == 16844 and next(c for c in closure if c["base"] == 3 and c["k"] == 4)["Ghat_needed"] == 41383, f"(6,2): G2(211#) >= {need6['Ghat_needed']}; (3,4): G2(241#) >= 41383; " f"ladder top Ghat(79) = {max(GHAT.values())}") lvl113 = [c for c in closure if c["level"] == 113] chk("D3_level_113_binds_at_9874", max(c["Ghat_needed"] for c in lvl113) == 9874 and len(lvl113) == 2, "two pairs share level 113# -- (5,2) needs 9874 and (11,1) needs 7115 -- so one new term " "G2(113#) is binding at 9874") # --- measured growth vs the closure requirement ------------------------------ r_meas = GHAT[79] / GHAT[61] proj97 = GHAT[79] * r_meas ** (math.log(97 / 79) / math.log(79 / 61)) chk("D4_closure_beyond_measured_growth", cheap["Ghat_needed"] / GHAT[79] > 2 and proj97 < cheap["Ghat_needed"], f"G2(97#) >= {cheap['Ghat_needed']} is {cheap['Ghat_needed'] / GHAT[79]:.2f}x the measured " f"Ghat(79) = 1710, while the measured x:61->79 factor {r_meas:.3f} extrapolated to 97# gives " f"about {proj97:.0f} -- below the threshold, so the window is expected to survive (forecast, " f"not a measurement)") all_pass = all(c["pass"] for c in checks) facts["top_instances"] = facts["instances"][:6] out = {"job_id": "1683", "script": "job1683-checks.py", "tool_version": "n/a (offline python3)", "n_checks": len(checks), "n_pass": sum(c["pass"] for c in checks), "all_pass": all_pass, "facts": facts, "checks": checks} OUT.write_text(json.dumps(out, indent=1), encoding="utf-8") print(json.dumps({"all_pass": all_pass, "n_pass": out["n_pass"], "n_checks": len(checks), "K_needed": facts["K_needed"], "window_width": facts["window_width"]})) sys.exit(0 if all_pass else 1)