"""verify_drop2.py — independent re-verification of the drop >= 2 witness found by probe_drop.py. Claim to check: P=30, p=11, R={7,13,19,23} K*(30, {7,13,19,23}) = 12 K*(330, {7,13,19,23}) = 10 (330 = 30*11) drop = 12 - 10 = 2. Independence: this file re-derives K* with a direct, naive full-period enumeration (different from probe_drop.py's phase-shift index): list every slot r in [0, M), M = P * prod(R), that is twin-admissible mod P, mark it killed if some q in R divides r or r+2, then find the longest cyclic run of consecutive slots (adjacent in the sorted slot list, with wraparound across the period M). All integer arithmetic. """ from math import gcd, prod def direct_Kstar(P: int, R: list[int]) -> tuple[int, list[int], int]: """Return (K*, witness_run, M). Brute force over the full period.""" R = list(R) M = P * prod(R) # sorted list of twin-admissible slots mod P, lifted to [0, M) slots = [] for k in range(prod(R)): base = k * P for r in range(P): if gcd(r, P) == 1 and gcd(r + 2, P) == 1: slots.append(base + r) killed = [] for r in slots: kd = any(r % q == 0 or (r + 2) % q == 0 for q in R) killed.append(kd) # longest cyclic run of True among the slot list (wrap once) n = len(slots) best = cur = 0 best_start = 0 cur_start = 0 for idx in range(2 * n): i = idx % n if killed[i]: if cur == 0: cur_start = idx cur += 1 if cur > best and cur <= n: best = cur best_start = cur_start else: cur = 0 if best == 0: return 0, [], M witness = [slots[(best_start + j) % n] for j in range(best)] return best, witness, M def check_admissible(r: int, P: int) -> bool: return gcd(r, P) == 1 and gcd(r + 2, P) == 1 def killed_by(r: int, R: list[int]) -> list[int]: return [q for q in R if r % q == 0 or (r + 2) % q == 0] def main() -> None: R = [7, 13, 19, 23] for P, label in ((30, "A_30"), (330, "A_330")): K, wit, M = direct_Kstar(P, R) print(f"K*({P}, {R}) = {K} (full period M = {M})") print(f" witness run (length {len(wit)}): {wit}") # verify witness validity: consecutive in A_P, each killed by R, each admissible ok = True # consecutive in A_P means: no admissible slot strictly between consecutive entries for a, b in zip(wit, wit[1:]): if not (check_admissible(a, P) and check_admissible(b, P)): ok = False print(f" NOT admissible: {a} or {b}") between = any(check_admissible(x, P) for x in range(a + 1, b)) if between: ok = False print(f" gap [{a},{b}] contains an admissible slot") kb = killed_by(a, R) if not kb: ok = False print(f" {a} not killed by R") else: assert killed_by(b, R), f"{b} not killed" # wraparound adjacency (last -> first across M) # witness is a contiguous cyclic block; check first/last within one period print(f" witness validity: {'OK' if ok else 'FAIL'}") print(f" killers per slot: {[killed_by(x, R) for x in wit]}") print() print("drop = K*(30,R) - K*(330,R) =", direct_Kstar(30, R)[0] - direct_Kstar(330, R)[0]) if __name__ == "__main__": main()