"""Test, on the tiles computed by nq_tile.js, the criterion 2q - 2 > G2(T_x) => no gap of T_x qualifies mod q => nq = 0 => L(T_x,q) = 1 => Q_L == 0 for L >= 2 which makes the Tail-Count Transport inequality's loose and alternation-refined forms the SAME function of theta at that fold. Inputs job978/nq-.json (nq_tile.js; the served engine's tile, D = prod_{5<=p<=x}(p-2)) G2 ladder research/G2-STATE.md (n = 1..14), reproduced by G2 in each file measured thresholds return #161 (job #32), "where each column reads 1" Output: the criterion table, the closed-form check on the smallest qualifying value, the threshold comparison, and every dip. Deterministic: no clock. """ import json import os # --- published inputs ------------------------------------------------------ # return #161 (job #32, zemaj), section "Where each column reads 1": # the smallest prime from which L(T_x, p) = 1 and stays 1 (through p <= 1009). PSTAR = {5: 11, 7: 11, 11: 23, 13: 37, 17: 59, 19: 71, 23: 107, 29: 127} # research/G2-STATE.md, the custody ladder G2(x#) (x = 5..29), reproduced by the # engine's own tile here: G2_LADDER = {5: 12, 7: 30, 11: 42, 13: 66, 17: 108, 19: 150, 23: 204, 29: 258} def predicted_min(q): """The record's closed form (research/kappa-not-L.md): the qualifying set is three APs mod 6q and its smallest element is 2q-2 (q = 1 mod 6) or 2q+2 (q = 5 mod 6).""" return 2 * q - 2 if q % 6 == 1 else 2 * q + 2 def main(): print("TILE GATES (engine D = prod_{5<=p<=x}(p-2); G2 from the record's ladder)") tiles = {} # preferred input: the single combined artefact; fallback: one file per tile combined = None for cand in ("nq-tiles.json", "job978/nq-tiles.json"): if os.path.exists(cand): combined = json.load(open(cand, encoding="utf-8")) break for x in (5, 7, 11, 13, 17, 19, 23, 29): d = None if combined is not None: d = combined.get("x=%d" % x) if d is None: for cand in ("nq-%d.json" % x, "job978/nq-%d.json" % x): if os.path.exists(cand): d = json.load(open(cand, encoding="utf-8")) break if d is None: print(" x=%2d MISSING" % x) continue tiles[x] = d print(" x=%2d D=%-14d G2=%-4d record G2=%-4d %s" % ( x, d["D"], d["G2"], G2_LADDER[x], "OK" if d["G2"] == G2_LADDER[x] else "MISMATCH")) print("\nCRITERION: 2q-2 > G2 => nq = 0 (and the closed form's smallest value)") violations, closed_form_bad, closed_form_skips = [], [], 0 rows = [] for x, d in sorted(tiles.items()): G2 = d["G2"] for q, nq, mq in zip(d["primes"], d["nq"], d["minQ"]): if q <= x: continue crit = (2 * q - 2 > G2) pm = predicted_min(q) rows.append((x, q, G2, nq, mq, crit, pm)) if crit and nq != 0: violations.append((x, q, G2, nq)) if nq > 0 and mq is not None: if mq % (6 * q) not in (pm, (4 * q + 2) % (6 * q), 0): closed_form_bad.append((x, q, mq, pm)) if mq != pm: closed_form_skips += 1 print(" rows tested: %d" % len(rows)) print(" criterion violations (2q-2 > G2 but nq > 0): %d %s" % (len(violations), violations[:6])) print(" qualifying values outside the closed form's three APs: %d %s" % (len(closed_form_bad), closed_form_bad[:4])) print(" folds where the smallest qualifying value is NOT the predicted 2q-/+2: %d" % closed_form_skips) print("\nTHRESHOLD: the least prime q>x above which nq stays 0 (through q<=%d)" % max(d["qmax"] for d in tiles.values())) print(" x G2 q_c(x)=least prime with 2q-2>G2 nq-threshold #161 p*(x) last q with nq>0") for x, d in sorted(tiles.items()): G2 = d["G2"] primes = [q for q in d["primes"] if q > x] nq = {q: n for q, n in zip(d["primes"], d["nq"]) if q > x} # least prime above which nq is 0 for every larger prime in the range thr = None for i, q in enumerate(primes): if all(nq[qq] == 0 for qq in primes[i:]): thr = q break qc = next(q for q in primes if 2 * q - 2 > G2) lastnz = max([q for q in primes if nq[q] > 0], default=None) print(" %3d %4d %4d %4s %4d %4s" % (x, G2, qc, thr, PSTAR.get(x, -1), lastnz)) print("\nDIPS (nq = 0 at q but nq > 0 at some larger prime in range)") for x, d in sorted(tiles.items()): G2 = d["G2"] primes = [q for q in d["primes"] if q > x] nq = {q: n for q, n in zip(d["primes"], d["nq"]) if q > x} dips = [q for i, q in enumerate(primes) if nq[q] == 0 and any(nq[qq] > 0 for qq in primes[i + 1:])] print(" x=%2d G2=%3d dips: %s (criterion allows dips only for 2q-2 <= G2, i.e. q <= %s)" % (x, G2, dips, (G2 + 2) // 2)) for q in dips: print(" q=%3d predicted smallest qualifying value %3d <= G2=%d -> value absent from the gap set" % (q, predicted_min(q), G2)) if __name__ == "__main__": main()