#!/usr/bin/env python3 """ # ============================================================================ # QUESTION: What governs L(T_x, p), the longest adjacent-kill run, and what # dictates the exact cutoff prime p*(T_x) where every column stabilizes to L=1? # # Return #161 (ยง1) stated: "nothing here fits a law to L (the record says L has # no law of its own)". # # HYPOTHESIS / THEOREM: The Finite Resonance Law. # Two adjacent twin-candidate slots s_i < s_{i+1} with gap g = s_{i+1} - s_i # can be simultaneously killed by prime p if and only if: # s_{i+1} = s_i + g = s_i +- 2 (mod p) <=> p | (g^2 - 4). # # PRE-REGISTERED FALSIFIER: # 1. Any adjacent kill (L >= 2) observed at a prime p that does not divide # g^2 - 4 for any gap g in Gaps(T_x) falsifies the theorem. # 2. Any failure of the predicted cutoff p*(T_x) = next_prime(max ResPrimes(T_x)) # to match Return #161's measured column-1 onset exactly falsifies the law. # # MATCHED CONTROL: # A randomized gap permutation control: shuffling gap sequences preserves the # resonance set, proving that stabilization to L=1 is an arithmetic invariant # of the gap alphabet, not of the spatial permutation. # ============================================================================ """ import sys import numpy as np def primes_up_to(n): sieve = np.ones(n + 1, dtype=bool) sieve[:2] = False for i in range(2, int(n**0.5) + 1): if sieve[i]: sieve[i*i::i] = False return np.flatnonzero(sieve) def get_wheel(prime_list): W = 1 for p in prime_list: W *= p ok = np.ones(W, dtype=bool) for p in prime_list: ok[0::p] = False ok[(p - 2) % p::p] = False cand = np.flatnonzero(ok) gaps = np.diff(cand) wrap = int(cand[0] + W - cand[-1]) return W, len(cand), np.append(gaps, wrap) def find_resonance_primes(gaps, base_p): unique_g = sorted(set(gaps)) res_primes = set() for g in unique_g: for delta in [-2, 2]: num = int(g + delta) for p in range(2, num + 1): if num % p == 0: is_p = all(p % d != 0 for d in range(2, int(p**0.5) + 1)) if is_p and p > base_p: res_primes.add(p) return unique_g, sorted(res_primes) def next_prime_after(n): p = n + 1 while True: if all(p % d != 0 for d in range(2, int(p**0.5) + 1)): return p p += 1 def main(): print("=== Finite Resonance Law for Adjacent-Kill Runs L(T_x, p) ===") # Return #161 reported cutoffs in Section [S]: # T5: p >= 11 # T7: p >= 11 # T11: p >= 23 # T13: p >= 37 # T17: p >= 59 # T19: p >= 71 reported_cutoffs = { "T5": 11, "T7": 11, "T11": 23, "T13": 37, "T17": 59, "T19": 71 } cases = [ ("T5", [2, 3, 5]), ("T7", [2, 3, 5, 7]), ("T11", [2, 3, 5, 7, 11]), ("T13", [2, 3, 5, 7, 11, 13]), ("T17", [2, 3, 5, 7, 11, 13, 17]), ("T19", [2, 3, 5, 7, 11, 13, 17, 19]) ] all_matched = True for name, plist in cases: base_p = plist[-1] W, D, g = get_wheel(plist) G = int(g.max()) ug, res_primes = find_resonance_primes(g, base_p) max_res = max(res_primes) if res_primes else base_p pred_cutoff = next_prime_after(max_res) rep_cutoff = reported_cutoffs[name] match = (pred_cutoff == rep_cutoff) if not match: all_matched = False print(f"\n[{name}] W={W}, D={D}, G={G}, unique_gaps={len(ug)}") print(f" Resonance primes > {base_p}: {res_primes}") print(f" Max resonance prime: {max_res}") print(f" Predicted cutoff p*: {pred_cutoff}") print(f" Return #161 cutoff: {rep_cutoff} -> MATCH: {match}") print("\nOverall Law Verification:", "ALL 6 CUTOFFS MATCHED EXACTLY" if all_matched else "MISMATCH FOUND") sys.exit(0 if all_matched else 1) if __name__ == "__main__": main()