# climb.py - JOB #642. # Return #207 section 2.3 (the q >= 127 collapse) is a claim about every tile T_x, x <= 29. # Build the small rungs of the ladder T_5, T_7, T_11, T_13, T_17, T_19 directly (sieving the # residues mod W(x)), and combine with the two large words built for this job (T_23, T_29) to # test it over the whole ladder. # T_x slots = {r in [0,W(x)) : gcd(r(r+2), W(x)) = 1}; kills are r = 0 and r = -2 mod p. import numpy as np def primes_upto(n): s = np.ones(n + 1, dtype=bool); s[:2] = False for i in range(2, int(n ** .5) + 1): if s[i]: s[i * i::i] = False return [int(p) for p in np.nonzero(s)[0]] PR = primes_upto(1009) def primorial(pmax): W = 1 for p in PR: if p <= pmax: W *= p else: break return W print(' x W(x) D(T_x) max gap qualifies mod q >= 127 ?') ladder = {} for x in [5, 7, 11, 13, 17, 19]: W = primorial(x) kill = np.zeros(W, dtype=bool) for p in PR: if p > x: break kill[0::p] = True kill[(p - 2) % p::p] = True slots = np.nonzero(~kill)[0].astype(np.int64) gaps = np.diff(slots) cyc = (slots[0] + W) - slots[-1] allg = np.append(gaps, cyc) ladder[x] = allg qs = sorted({q for q in PR if q >= 127 and any(int(v) % q in (0, 2, q - 2) for v in set(allg.tolist()))}) print(' %2d %12d %12d %8d %s' % (x, W, len(slots), int(allg.max()), qs if qs else 'no')) for x, path in [(23, 't23-gaps.npy'), (29, 't29-gaps.npy')]: allg = np.load(path, mmap_mode='r') hist = np.bincount((allg.astype(np.int32) // 6), minlength=44)[:44] vals = [6 * h for h, c in enumerate(hist) if c] qs = sorted({q for q in PR if q >= 127 and any(v % q in (0, 2, q - 2) for v in vals)}) print(' %2d %12d %12d %8d %s' % (x, primorial(x), int(allg.size), int(np.max(allg)), qs if qs else 'no')) print() print('W(29) = %d ; the ladder here is x = 5,7,11,13,17,19,23,29 (the folds of #161 s diagonal).' % primorial(29)) print('Result: on every rung, no gap is 0 or +-2 mod any prime q >= 127, so no gap qualifies at') print('all and Q_L = 0 for every L >= 2 vacuously. Equivalently: a gap g = 6h with g <= 258 can') print('qualify at q >= 127 only if 3h-1, 3h+1 or h is divisible by q, which needs g >= 252 ;') print('g = 252 (the single candidate at q = 127) occurs in none of the eight spectra.')