"""Job #1917 (pursue route 78 rev 2, return #49 `kk-lower-bound`). QUESTION: do the section-2 normalisation and the section-6.4 ledger description hold when re-derived from the definitions, so that the revised revision can quote them? PRE-REGISTERED (from scratch, no producer imported): (1) OEIS A072753 index: a(n) for n = 3..6 = max m such that pairs c_k, d_k mod p_k (k = 3..n, primes 5..p_n) cover every i in [1, m]; expected 2, 4, 10, 24 (entry %S), and 6 a(n) + 6 = 18, 30, 66, 150 = A288815(n) (entry %F, Ziller 2017). (2) h_2(P(p_n)) = paired Jacobsthal (worst even d, pairs {a_p, a_p - d}; gap = covered length + 1) for n = 3, 4 by brute force: expected 18, 30 = A288815(3), (4). (3) G_2(P(p_n)) from the class pair {0, -2}: max cyclic gap of the admissible residues r (r, r+2 both coprime to P) for n = 3..7: expected 12, 30, 42, 66, 108 (review #73), and A144311(n) + 1. (4) Unscaled chain in the served section-2 row is false at n = 3: A072753(3) = 2 < h_2(30) = 18 = 6*2 + 6. (5) Two free classes at p = 2 cover Z: no finite maximal gap when 2 is admitted without restriction. (6) Ledger constants, mpmath 30 digits, M = Meissel-Mertens: C_excl = -2 ln 2 + 2M - 2(1/2 + 1/3) = -2.529966602; C_actual = -2 ln 2 + 2M - 1/2 = -1.363299935; the withdrawn sentence's quantity C_excl + 2(1/2 + 1/3) = -0.863299935; exact rational difference 7/6. (7) Theorem A needs no idempotent: prod_{r in {0,-2}} (n - r) = n(n+2) for every p, so d | n(n+2) iff n in Omega_d for squarefree d; Theorem B's bands have Omega_p depending on p (band 1 {0,-2}, band 2 {0,-2,1,-1}), where F_p via e_p is needed -- checked on the small system p in {5, 7}, bands {5: {0,-2}, 7: {0,-2,1,-1}}: q | F(n) iff n in Omega_q, while the plain product prod_p prod_{r in Omega_p}(n-r) has EXTRA divisibilities (5 | (n-1)(n+1) at n = 1), so the plain product is NOT a valid encoding when Omega varies. FALSIFIERS: any expected value not reproduced.""" import itertools, math, sys, json from fractions import Fraction import numpy as np led = [] def check(tag, ok, detail): led.append(f"{'PASS' if ok else 'FAIL'} {tag} :: {detail}"); print(led[-1], file=sys.stderr, flush=True) PR = [2, 3, 5, 7, 11, 13, 17, 19] def max_covered_run(classes_by_p, P): """covering is periodic mod P: the longest run of consecutive covered integers = longest cyclic gap between uncovered residues minus 1 (a run starting at 1 is a translate of any run, so this is the OEIS 'every i in [1, m]' maximum); returns P if everything is covered""" cov = np.zeros(P, dtype=bool) for p, cs in classes_by_p.items(): for c in cs: cov[c % p::p] = True unc = np.flatnonzero(~cov) if unc.size == 0: return P return int(np.max(np.diff(np.append(unc, unc[0] + P))) - 1) # (1) A072753 by brute force; translation symmetry lets the pair at 5 be fixed to (0,1) or (0,2) a072 = {} for n in range(3, 7): ps = PR[2:n]; P = math.prod(ps); best = 0 choices = [[(0, 1), (0, 2)]] + [list(itertools.combinations(range(p), 2)) for p in ps[1:]] for combo in itertools.product(*choices): best = max(best, max_covered_run(dict(zip(ps, combo)), P)) a072[n] = best check('1_A072753_index_n=3..6', [a072[n] for n in (3, 4, 5, 6)] == [2, 4, 10, 24], f'a(3..6) = {[a072[n] for n in (3,4,5,6)]} (OEIS %S: 2, 4, 10, 24); primes 5..p_n only, covered length; index n counts primes from p_1 = 2') check('1_bridge_6a+6=A288815', [6 * a072[n] + 6 for n in (3, 4, 5, 6)] == [18, 30, 66, 150], f'6a+6 = {[6*a072[n]+6 for n in (3,4,5,6)]} (A288815(3..6) = 18, 30, 66, 150)') # (2) paired Jacobsthal h_2 at P(p_n), n = 3, 4: pairs {a_p, a_p - d}, worst even d h2 = {} for n in (3, 4): ps = PR[:n]; P = math.prod(ps); best = 0 for d in range(0, P, 2): for a in itertools.product(*[range(p) for p in ps]): best = max(best, max_covered_run({p: (ai, ai - d) for p, ai in zip(ps, a)}, P)) h2[n] = best + 1 # Jacobsthal convention: the gap is the covered length + 1 (A288815 and G_2 are gaps; A072753 is a covered length) check('2_h2_paired_Jacobsthal_n=3,4', [h2[3], h2[4]] == [18, 30], f'h_2(30), h_2(210) = {h2[3]}, {h2[4]} as gaps = covered length + 1 (A288815(3), (4) = 18, 30); G_2(210) = h_2(210) = 30') # (3) G_2 from {0,-2} g2 = {} for n in range(3, 8): P = math.prod(PR[:n]); adm = [r for r in range(P) if math.gcd(r, P) == 1 and math.gcd(r + 2, P) == 1] gaps = [(adm[(i + 1) % len(adm)] - adm[i]) % P for i in range(len(adm))]; g2[n] = max(gaps) check('3_G2_from_class_pair_n=3..7', [g2[n] for n in range(3, 8)] == [12, 30, 42, 66, 108], f'G_2 = {[g2[n] for n in range(3,8)]}; A144311(3..7) + 1 = 12, 30, 42, 66, 108; admissible residues mod 30: {[r for r in range(30) if math.gcd(r,30)==1 and math.gcd(r+2,30)==1]}') # (4) the unscaled chain check('4_unscaled_chain_false_at_n=3', a072[3] < g2[3] <= h2[3] == 6 * a072[3] + 6, f'A072753(3) = {a072[3]} < G_2(30) = {g2[3]} <= h_2(30) = {h2[3]} = 6*{a072[3]}+6: the served row "free two-class >= h_2" with A072753 unscaled is false; normalised (x6 + 6) it equals A288815 at every listed n') # (5) two classes at 2 check('5_two_classes_at_2_cover_Z', max_covered_run({2: (0, 1)}, 2) == 2, 'classes {0,1} mod 2 cover every integer: no finite maximal gap without an admissibility restriction at p = 2') # (6) ledger constants try: import mpmath as mp; mp.mp.dps = 30 M = mp.mpf('0.2614972128476427837554268386086958590516') # Meissel-Mertens constant (OEIS A077761) C_excl = -2 * mp.log(2) + 2 * M - 2 * (mp.mpf(1) / 2 + mp.mpf(1) / 3); C_act = -2 * mp.log(2) + 2 * M - mp.mpf(1) / 2; C_wrong = C_excl + 2 * (mp.mpf(1) / 2 + mp.mpf(1) / 3) check('6_ledger_constants', abs(C_excl + 2.529966602) < 1e-8 and abs(C_act + 1.363299935) < 1e-8 and abs(C_wrong + 0.863299935) < 1e-8 and Fraction(-1, 2) - Fraction(-5, 3) == Fraction(7, 6), f'C_excl = {mp.nstr(C_excl, 12)}, C_actual = {mp.nstr(C_act, 12)}, withdrawn-sentence quantity = {mp.nstr(C_wrong, 12)}, rational difference -1/2 - (-5/3) = 7/6 = 1/2 + 2/3; 4 e^(1.3633) A^4 at A = 4.05 = {mp.nstr(4 * mp.e ** -C_act * mp.mpf("4.05") ** 4, 6)}') except ImportError: check('6_ledger_constants', False, 'mpmath missing') # (7) idempotent encoding needed iff Omega_p depends on p def idempotents(ps): P = math.prod(ps); e = {} for p in ps: Q = P // p; e[p] = Q * pow(Q, -1, p) % P # e_p = 1 mod p, 0 mod q != p return P, e ps = [5, 7]; Om = {5: (0, -2), 7: (0, -2, 1, -1)}; P, e = idempotents(ps) ok_idem = all(e[p] % p == 1 and all(e[p] % q == 0 for q in ps if q != p) for p in ps) def F(n): return math.prod(1 - e[p] + e[p] * math.prod(n - r for r in Om[p]) for p in ps) def plain(n): return math.prod(math.prod(n - r for r in Om[p]) for p in ps) inOm = lambda n, q: (n % q) in {r % q for r in Om[q]} bad_F = [(n, q) for n in range(1, 2 * P + 1) for q in ps if (F(n) % q == 0) != inOm(n, q)] bad_plain = [(n, q) for n in range(1, 2 * P + 1) for q in ps if (plain(n) % q == 0) != inOm(n, q)] thmA_ok = all(((n * (n + 2)) % q == 0) == ((n % q) in {0, q - 2}) for q in (2, 3, 5, 7, 11, 13) for n in range(1, 400)) check('7_idempotent_needed_iff_Omega_varies', ok_idem and not bad_F and bool(bad_plain) and thmA_ok, f"e_p congruences hold; q | F(n) iff n in Omega_q on 1..{2*P} (mismatches {len(bad_F)}); the plain product has {len(bad_plain)} wrong divisibilities (first {bad_plain[:3]}); Theorem A: q | n(n+2) iff n in {{0,-2}} mod q for all q <= 13, n < 400: {thmA_ok} -- the multiset {{n(n+2)}} suffices for Theorem A, the F_p form is needed for Theorem B's two bands") print('\n'.join(led)); allp = all(l.startswith('PASS') for l in led) print('VERDICT ' + json.dumps({'all_pass': allp, 'A072753': a072, 'h2': h2, 'G2': g2})) json.dump({'ledger': led, 'A072753': a072, 'h2': h2, 'G2': g2}, open('fresh1917.json', 'w'), indent=1)