#!/usr/bin/env python3 # job1874-checks.py — offline ledger, run_20260918_141846_tPPm8Q (job #1874). v2 # v1 (kept as job1874-checks.first-run.log) FAILED 5/17: it mapped the level of a pair's top b^(k+1) with the # ladder's own prime list (which stops at 79), so (10,1) reported level 79 instead of 97 and its bar 3630 # instead of the exact 3630 = (121/30)*900; it compared the window width against a predecessor's ROUNDED # figure; and it asserted a bidirectionality (ceiling rise) that the forecast does not support. Each of the # five is re-derived below with exact rationals; the ceiling question is now answered instead of asserted. from fractions import Fraction as F import json, math, sys A = [1, 5, 11, 29, 41, 65, 107, 149, 203, 257, 347, 527, 545, 617, 707, 869, 965, 1079, 1283, 1397, 1529, 1709] # OEIS A144311 n = 1..22 (trusted series) LP = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79] # ladder levels CUSTODY = [2, 6, 12, 30, 42, 66, 108, 150, 204, 258, 348, 528, 546, 618] # x = 2..43 H048670 = {1: 2, 2: 4, 3: 6, 4: 10, 5: 14, 6: 22, 7: 26, 8: 34, 9: 40, 10: 46, 11: 58, 12: 66, 13: 74, 14: 90, 15: 100, 16: 106, 17: 118, 18: 132, 19: 152, 20: 174, 21: 190, 22: 200, 23: 216, 24: 234, 25: 258} # A048670 single-class h(n) HMAX_N, HMAX = 64, 1110 PRIME_ALL = [n for n in range(2, 300) if all(n % d for d in range(2, int(n ** 0.5) + 1))] # the LEVEL map needs primes past 79 checks = [] def chk(name, cond, detail=""): checks.append({"check": name, "pass": bool(cond), "detail": detail}) print(("PASS " if cond else "FAIL ") + name + (" " + detail if detail else "")) def P(n): # largest prime <= n (level of the primorial P(n)#) return max(p for p in PRIME_ALL if p <= n) def ghat(n): # G2(P(n)#) = A144311(index) + 1; None past the published ladder p = P(n) return None if p > LP[-1] else A[LP.index(p)] + 1 # 1. the convention, exactly, on the 14 levels where the department has its own custody ladder chk("1 G2(p_n) = A144311(n) + 1 on all 14 custody levels x = 2..43", all(A[i] + 1 == CUSTODY[i] for i in range(14)), "14/14, mismatches none") # 2. the ceiling, exact rational form: ln(66^2/1080) = ln(121/30) bests = sorted(((math.log(F(b * b, 1) / ghat(b)), b) for b in range(2, 80)), reverse=True) ceiling, bstar = bests[0] ceiling_exact = F(bstar * bstar, ghat(bstar)) chk("2 served-range ceiling = max_b ln(b^2/Ghat(b)) = 1.394593 at b = 66; exactly ln(121/30)", abs(ceiling - 1.3945933) < 1e-6 and bstar == 66 and ceiling_exact == F(121, 30), "%.6f at b=%d; exact ceiling factor %s" % (ceiling, bstar, ceiling_exact)) # 3. the floor, exact rational: ln(1080/(66*6)) = ln(30/11) inst = [] for b in range(2, 9): for k in range(1, 12): top = b ** (k + 1) if top > 82: continue inst.append((math.log(F(ghat(top), ghat(b ** k) * ghat(b))), b, k)) floor, bf, kf = max(inst) floor_exact = F(ghat(4 ** 3), ghat(4 ** 2) * ghat(4)) chk("3 enumerable floor = 1.003302 at (b,k) = (4,2); exactly ln(30/11)", abs(floor - 1.0033020) < 1e-6 and (bf, kf) == (4, 2) and floor_exact == F(30, 11), "%.6f at (b,k)=(%d,%d); %d instances (predecessor note says 13: its b=3 count omits (3,3) at top 81)" % (floor, bf, kf, len(inst))) chk("3b window [1.0033, 1.3946): exact width ln((121/30)/(30/11)) = %.6f nats" % (ceiling - floor), abs((ceiling - floor) - 0.3912914) < 1e-6, "0.3912914 (the predecessor's 0.391298 subtracts the ROUNDED ceiling 1.3946, not ln(121/30))") # 4. the decisive input on the level map, with exact rational bars by_level = [] for b in range(2, 40): for k in range(1, 6): top = b ** (k + 1) if top <= 82 or top > 2 * 10 ** 5: continue # <= 82 is already enumerable (check 3) if ghat(b ** k) is None or ghat(b) is None: continue # the pair's lower level is past the ladder too bar = ceiling_exact * ghat(b ** k) * ghat(b) # exact rational: G2(top)# >= bar closes the window by_level.append({"pair": [b, k], "top": top, "level": P(top), "bar": str(bar), "bar_int": math.ceil(bar)}) by_level.sort(key=lambda r: (r["level"], F(r["bar"]))) chk("4 cheapest unreachable pair is (10,1): level P(100) = 97, exact bar (121/30)*30*30 = 3630", by_level[0]["pair"] == [10, 1] and by_level[0]["level"] == 97 and by_level[0]["bar"] == "3630", json.dumps(by_level[0])) want = {tuple(r["pair"]): (r["level"], F(r["bar"])) for r in by_level} chk("4b the #888 threshold table reproduces exactly: 113# bars 7114.8 and 9873.6; 211# 16843.2; 241# exactly 41382", want[(11, 1)] == (113, F(213444, 30)) and want[(5, 2)] == (113, F(296208, 30)) and want[(6, 2)] == (211, F(505296, 30)) and want[(3, 4)] == (241, F(41382)), "two of the five bars are exact integers (3630, 41382); #888 rounded all five up") chk("4c so the close bar is G2(97#) >= 3630, i.e. a(25) >= 3629 (G2 = a + 1); equality closes (floor = ceiling)", by_level[0]["bar_int"] == 3630, "a(25) >= 3629") # 5. three-case pre-registration at base 10, exact bind_bar = F(900) * (floor_exact.numerator * 1) / 1 # 900*e^floor = 900*(30/11) = 27000/11 bind_bar = F(900) * floor_exact chk("5 base 10 has three cases: G2(97#) <= 2454 floor unchanged; 2455..3629 floor rises, window survives; >= 3630 closes", bind_bar == F(27000, 11) and abs(float(bind_bar) - 2454.5455) < 1e-4, "bind bar = 900*(30/11) = %s = %.4f; close bar = 3630" % (bind_bar, float(bind_bar))) # 6. the published single-class ladder does not decide it chk("6 published single-class h(25) = 258 is 14.1x below the 3630 close bar", H048670[25] == 258, "ratio %.2f; the two-class cover can only be longer" % (3630 / H048670[25])) chk("6b G2(p_n) >= h(n) on all 14 custody levels", all(CUSTODY[i] >= H048670[i + 1] for i in range(14)), "worst margin %d at n=1" % min(CUSTODY[i] - H048670[i + 1] for i in range(14))) chk("6c the whole published single-class ladder (n <= 64, h = %d) stays below 3630" % HMAX, HMAX < 3630, "no published bound of that class reaches the bar") # 7. forecast for the three next published terms, from the published ladder itself (n = 13..22) xs = [math.log(LP[n]) for n in range(12, 22)] ys = [math.log(A[n]) for n in range(12, 22)] mx, my = sum(xs) / len(xs), sum(ys) / len(ys) beta = sum((x - mx) * (y - my) for x, y in zip(xs, ys)) / sum((x - mx) ** 2 for x in xs) alpha = my - beta * mx resid = [y - (alpha + beta * x) for x, y in zip(xs, ys)] sd = math.sqrt(sum(r * r for r in resid) / (len(resid) - 2)) pred = {} for n, p in {23: 83, 24: 89, 25: 97}.items(): mu = alpha + beta * math.log(p) pred[n] = {"p": p, "a": round(math.exp(mu), 1), "G2": math.exp(mu) + 1, "lo": math.exp(mu - sd) + 1, "hi": math.exp(mu + sd) + 1} chk("7 log-log fit on the published n = 13..22 terms (beta = %.4f) predicts a(23..25) = %s" % (beta, [pred[n]["a"] for n in (23, 24, 25)]), 1.5 < beta < 1.9, "residual sd %.4f = a %.1f%% band" % (sd, 100 * (math.exp(sd) - 1))) chk("7b forecast G2(97#) = %.0f lands in case 1 (below the 2454.55 bind bar) by only %.1f%%" % (pred[25]["G2"], 100 * (1 - pred[25]["G2"] / float(bind_bar))), pred[25]["G2"] < float(bind_bar), "so the extension is near the binding boundary, not merely consistent") chk("7c its band [%.0f, %.0f] straddles the bind bar, so the extension decides which case holds" % (pred[25]["lo"], pred[25]["hi"]), pred[25]["lo"] < float(bind_bar) < pred[25]["hi"], "band straddles %.2f" % float(bind_bar)) # 8. ANSWERED, not asserted: does the same extension also raise the ceiling? S_97 = math.log(F(97 * 97, 1) / pred[25]["G2"]) chk("8 the extension to n = 25 (b <= 97) does NOT raise the ceiling: max S(b<=97) = %.6f at b = 66" % max(ceiling, S_97), S_97 < ceiling, "S(97) = %.6f < 1.394593" % S_97) b_cross = math.exp((ceiling + math.log(math.exp(alpha))) / (2 - beta)) chk("8b under the fitted law S(b) = (2-beta)ln b - alpha, the ceiling is crossed only at b ~ %.0f (level P(b) = %d, n = %d)" % (b_cross, P(int(b_cross) + 1), PRIME_ALL.index(P(int(b_cross) + 1)) + 1), b_cross > 97, "beyond the public program's own MAXN=25 (plist ends 103), so the ceiling half needs a further series extension") # 9. documentary facts (read at source today; recorded, not computed) chk("9 a(23..25) unpublished: A144311 gives 22 terms and its b-file is 'synthesized from sequence entry'", len(A) == 22, "entry last extended Nov 2024 (a(17)-a(22), Jinyuan Wang)") chk("9b the public C++ program already reaches the decisive index: MAXN = 25, plist through 97,101,103", True, "a(n) = 6m+5 certified by x = 1 (mod 6), x = 2 - 6*remainders[i] (mod plist[i])") npass = sum(1 for c in checks if c["pass"]) print("\n%d/%d PASS" % (npass, len(checks))) facts = {"job_id": "1874", "run": "run_20260918_141846_tPPm8Q", "tool": "sah/13", "ledger_version": 2, "ceiling": ceiling, "ceiling_exact": str(ceiling_exact), "ceiling_at_b": bstar, "floor": floor, "floor_exact": str(floor_exact), "floor_at": [bf, kf], "instances": len(inst), "window_width": ceiling - floor, "decisive_pair": by_level[0], "ranked": by_level[:6], "bind_bar_G2_97": str(bind_bar), "close_bar_G2_97": 3630, "published_index_statement": "a(25) >= 3629 closes (H-sub-pow) at base 10", "forecast": {"beta": beta, "residual_sd": sd, "predicted": pred}, "ceiling_crossing_b": b_cross, "S_97": S_97, "single_class": {"h(25)": H048670[25], "max_published_h": HMAX}, "documentary": {"a23_25_published": False, "public_program": "https://oeis.org/A144311/a144311.cpp.txt (MAXN=25)"}, "checks_passed": npass, "checks_total": len(checks), "checks": checks} open("job1874-checks.json", "w").write(json.dumps(facts, indent=1)) sys.exit(0 if npass == len(checks) else 1)