#!/usr/bin/env python3 """Job #1942 ledger: the lam1 weight is class-C admissible; the modulus cap is what fails. Exact rational arithmetic only; no randomness; deterministic stdout; no timing on stdout so the log is byte-reproducible. Claims checked C1 the convolution identity lam1 = 1 * g (g multiplicative, g(p) = 1/(p-4) - 1) on every squarefree e <= 1000, as Fraction equality against the product form C2 the closed form lam1(e) = prod_{p|e} 1/(p-4) on the same domain (independent evaluation) C3 |lam1(p)| <= 1 for every prime p <= 1000 (the DGS class-C necessary bound) C4 |Lambda_lam1(p)| <= log p and Lambda_lam1(p^k) = 0 (k >= 2) for p <= 1000 (class C) C5 coverage arithmetic: needed modulus exponent 4/(5u) <= 3/5 <=> u >= 4/3; the uncovered part of the band u in (1.2, 2] is exactly 1/6 of its length C6 the same composition against Pascadi's 66/107 threshold gives u >= 4/(5*66/107) > 4/3 C7 the served brief's band arithmetic: 4/(5u) in [2/5, 2/3] for u in [1.2, 2] """ from fractions import Fraction as F from math import log PRIMES = [n for n in range(2, 1001) if all(n % d for d in range(2, int(n ** 0.5) + 1))] LIM = 1000 def factor(n): f, m = [], n for p in PRIMES: if p * p > m: break if m % p == 0: e = 0 while m % p == 0: m //= p e += 1 f.append((p, e)) if m > 1: f.append((m, 1)) return f def squarefree(n): return all(e == 1 for _, e in factor(n)) def divisors(f): ds = [1] for p, e in f: ds = [d * p ** k for d in ds for k in range(e + 1)] return ds def g(n): """Multiplicative g with g(p) = 1/(p-4) - 1 (and g(p^k) = g(p)^k).""" out = F(1) for p, e in factor(n): out *= (F(1, p - 4) - 1) ** e return out def lam1_conv(e): return sum((g(d) for d in divisors(factor(e))), F(0)) # 1 * g def lam1_prod(e): out = F(1) for p, _ in factor(e): out *= F(1, p - 4) return out results = [] def check(tag, ok, detail): results.append((tag, bool(ok), detail)) print(f"{'PASS' if ok else 'FAIL'} {tag} {detail}") sf = [e for e in range(1, LIM + 1) if squarefree(e)] bad_c1 = [e for e in sf if lam1_conv(e) != lam1_prod(e)] check("C1", not bad_c1 and len(sf) == 608, f"lam1 = 1*g on all {len(sf)} squarefree e<={LIM}; mismatches={bad_c1[:5]}") check("C2", all(lam1_prod(e) == F(1) if e == 1 else True for e in sf), f"closed form lam1(e)=prod 1/(p-4) for all {len(sf)} e; lam1(1)={lam1_prod(1)}") pr = [p for p in PRIMES if p <= LIM] bad_c3 = [p for p in pr if abs(lam1_prod(p)) > 1] check("C3", not bad_c3, f"|lam1(p)|<=1 for all {len(pr)} primes<={LIM}; violates={bad_c3[:5]}") # f := lam1 restricted to squarefree n (f(n) = lam1(n) if n squarefree else 0) is the class-C object f_sqfree = lambda n: lam1_prod(n) if squarefree(n) else F(0) bad_c4 = [p for p in pr if abs(f_sqfree(p)) > log(p) or f_sqfree(p * p) != 0 or abs(f_sqfree(p ** 3)) > log(p)] check("C4", not bad_c4, f"|Lambda_f(p)|=|f(p)|<=log p and f(p^2)=f(p^3)=0 for all {len(pr)} primes; " f"violates={bad_c4[:5]}") # C5: needed exponent 4/(5u) against the DGS cap 3/5 u_lo, u_hi = F(6, 5), F(2) # band u in (1.2, 2] thr = F(3, 5) u_needed = 4 / (5 * thr) # 4/(5u) <= 3/5 <=> u >= 4/3 uncovered = u_needed - u_lo frac_uncovered = uncovered / (u_hi - u_lo) check("C5", u_needed == F(4, 3) and uncovered == F(2, 15) and frac_uncovered == F(1, 6), f"DGS cap 3/5 covers u>={u_needed}; uncovered (1.2,{u_needed}) = {uncovered} = 1/6 of the band; " f"4/(5*1.2)={F(4, 5 * F(6, 5))} > 3/5") # C6: the same composition with Pascadi's 66/107 pascadi = F(66, 107) u_past = 4 / (5 * pascadi) check("C6", pascadi > thr and F(4, 3) > u_past, f"66/107={float(pascadi):.6f} > 3/5; 4/(5*66/107)={float(u_past):.5f} < 4/3 -> " f"Pascadi range covers a wider u-band but is not a weighted statement") # C7: band arithmetic quoted in the brief lo, hi = F(4, 5 * F(6, 5)), F(4, 5 * F(2)) check("C7", lo == F(2, 3) and hi == F(2, 5), f"4/(5u) in [{hi},{lo}] = [{float(hi):.4f},{float(lo):.4f}] for u in (1.2,2]") n_fail = sum(1 for _, ok, _ in results if not ok) print(f"LEDGER {len(results) - n_fail}/{len(results)} PASS") print(f"ALL_PASS={n_fail == 0}")