#!/usr/bin/env python3 """Job #2720 -- the published two ladders in one unit, and the offset price they imply. Inputs are the PUBLISHED terms, typed in with their sources (no network, no search): A144311 (the project's fixed-shift two-class ladder; a(n) = 6*R_n + 5 for n > 1): https://oeis.org/A144311 (fetched 2026-09-26; a(8)-a(16) Alekseyev 2009, a(17)-a(22) Jinyuan Wang 2024) A288815 (the free paired ladder of Ziller-Morack, a(n) = 6*A072753(n) + 6 for n >= 3): https://oeis.org/A288815 (fetched 2026-09-26; Ziller-Morack arXiv:1706.00317, 1706.03668) Outputs: ladder_price.json and ladder_price.out (LF only). Nothing is computed beyond exact integer arithmetic on the published terms; no new count is regenerated. """ import json import os import sys sys.stdout.reconfigure(encoding="utf-8", errors="replace") HERE = os.path.dirname(os.path.abspath(__file__)) A144311 = [1, 5, 11, 29, 41, 65, 107, 149, 203, 257, 347, 527, 545, 617, 707, 869, 965, 1079, 1283, 1397, 1529, 1709] # n = 1..22 A288815 = [2, 6, 18, 30, 66, 150, 192, 258, 366, 450, 570, 708, 894, 1044, 1284, 1422, 1656, 1902, 2190, 2460, 2622] # n = 1..21 # the project's map: a = 6R + 5 (the rung is the largest covered run; A144311 == 5 mod 6 for n > 1) Rf = {} for n, a in enumerate(A144311, 1): if n == 1: continue assert (a - 5) % 6 == 0 and a % 6 == 5, (n, a) Rf[n] = (a - 5) // 6 # the free paired ladder in the same rung unit: A288815(n) = 6*A072753(n) + 6 Rw = {} for n, a in enumerate(A288815, 1): if n < 3: continue assert (a - 6) % 6 == 0, (n, a) Rw[n] = (a - 6) // 6 out = {"sources": {"A144311": "https://oeis.org/A144311 (2026-09-26)", "A288815": "https://oeis.org/A288815 (2026-09-26)"}, "R_fixed": {str(k): v for k, v in sorted(Rf.items())}, "R_free": {str(k): v for k, v in sorted(Rw.items())}, "price": {}, "checks": {}} # the record's inequality direction: the fixed shift is one of the free family's offsets common = sorted(set(Rf) & set(Rw)) bad = [n for n in common if A144311[n - 1] > A288815[n - 1] - 1] out["checks"]["fixed_within_free_published"] = { "criterion": "A144311(n) <= A288815(n) - 1 (the fixed shift is one member of the free family)", "n_common": len(common), "violations": bad} assert not bad, bad for n in common: af, aw = A144311[n - 1], A288815[n - 1] out["price"][str(n)] = { "rung_fixed": Rf[n], "rung_free": Rw[n], "rung_gap": Rw[n] - Rf[n], "rung_ratio": round(Rw[n] / Rf[n], 4), "value_ratio": round(aw / (1 + af), 4), } # the record's own in-house price series (route 40 / return #675's event #1861, and route 40's text: # x = 5, 7, 11, 13, 17 -> 1.5000, 1.0000, 1.5714, 2.2727, 1.7778). If the record's price is the ratio of # the two published ladders, the same five values must come out of published terms alone. RECORD_PRICE = {3: 1.5000, 4: 1.0000, 5: 1.5714, 6: 2.2727, 7: 1.7778} for n, v in RECORD_PRICE.items(): got = round(A288815[n - 1] / (1 + A144311[n - 1]), 4) assert abs(got - v) <= 5e-5, (n, got, v) out["checks"]["reproduces_record_price"] = { "criterion": "A288815(n)/(1 + A144311(n)) equals the record's in-house price at x = 5, 7, 11, 13, 17", "record": RECORD_PRICE, "match": True, "note": "exact reproduction from published terms alone; the record's own values are the five in-house" " census points of route 40 (return #675)"} lines = ["job #2720 -- the two published ladders in one unit (exact integer arithmetic, published terms only)", "", "n p_n A144311 R_fixed A288815 R_free gap R_free/R_fixed A288815/(1+A144311)", "--- ----- -------- ------- -------- ------- ---- --------------- --------------------"] primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73] for n in range(3, 22): p = primes[n - 1] pf = out["price"][str(n)] if str(n) in out["price"] else None if n in Rf: lines.append("%-3d %-5d %-8d %-7d %-8d %-7d %-4d %-15.4f %-8.4f" % ( n, p, A144311[n - 1], Rf[n], A288815[n - 1], Rw[n], Rw[n] - Rf[n], Rw[n] / Rf[n], A288815[n - 1] / (1 + A144311[n - 1]))) else: lines.append("%-3d %-5d %-8d %-7d %-8d %-7d" % (n, p, A144311[n - 1], Rf[n], A288815[n - 1], Rw[n])) lines += ["", "reading: the rung-unit ratio is flat at ~1.71-1.77 over the last five published levels" " (n = 17..21) after rising from ~1.35 at n = 12; the difference grows with the rung.", "cross-check: the value ratio reproduces route 40's five in-house price points (x = 5, 7, 11, 13, 17" " -> 1.5000, 1.0000, 1.5714, 2.2727, 1.7778) exactly, so the record's price is this published-ladder" " ratio and the table extends it from 5 to 19 levels (n = 3..21) with no compute.", "scope: published terms only; A144311 stops at n = 22 and A288815 at n = 21, so the project's" " n = 23 rung has no published free companion.", "note: A144311(n) <= A288815(n) - 1 is the record's own direction (the fixed shift is one member" " of the free family). It is verified here on the published range n <= 21; where the free term is" " published it would give an upper bound for the project's ladder, and that range ends one level" " BEHIND the project's frontier, so this return uses it as a cross-check only."] with open(os.path.join(HERE, "ladder_price.json"), "w", encoding="utf-8", newline="\n") as fh: json.dump(out, fh, indent=1, ensure_ascii=False) fh.write("\n") with open(os.path.join(HERE, "ladder_price.out"), "w", encoding="utf-8", newline="\n") as fh: fh.write("\n".join(lines) + "\n") print("\n".join(lines))