// ============================================================================ // IMPORT B-FREE 03 — THE COMPLEXITY OF THE TWIN-ADMISSIBLE SUBSHIFT // ============================================================================ // Third of the B-free import (see `research/import-bfree-01-toeplitz.js` for // the dictionary and `research/import-bfree-02-poisson-hypothesis.js` for the // Granville-Kurlberg hypothesis). This one computes the object the import // surfaced that has no counterpart in the corpus: the word complexity of the // LIMIT twin-admissible subshift, which is the two-class analogue of a // published theorem about the prime subshift. // // THE PUBLISHED ONE-CLASS RESULT, with its conditionality read at source. // Kasjan, Lemanczyk and Zuniga Alterman, "Dynamics of B-free systems generated // by Behrend sets. I", Acta Arith. 209 (2023) 135-171, Theorem 1.1. Their // equation (8) is UNCONDITIONAL and is about the subshift: // (2+o(1))^{n/log n} << cpx_{X_P}(n) << (4+o(1))^{n/log n}. // Their equation (9) is about the SEQUENCE and is conditional: "If the // Hardy-Littlewood conjecture is true then (2+o(1))^{n/log n} << cpx_{1_P}(n)", // with a footnote that Dickson's conjecture would serve instead. Both upper // bounds are Tao's, by private correspondence. That split is the wall in // dynamical coordinates: the subshift already HAS the complexity; the prime // sequence attaining it is the tuples conjecture. // // WHY OUR NUMBER IS COMPARABLE TO THEIRS. A window of the prime indicator has // its zero set covered one class per prime (each composite by its least prime // factor), so every block of X_P is a block of the one-class admissible family // this script counts: cpx_{X_P}(n) <= cpx1(n). Together with (8) that sandwiches // cpx1(n) between the two published constants, which is what Stage C tests. // // THE TWO-CLASS OBJECT. Let W = prod_p (Z/pZ \ {0,-2}) and X_phi the subshift // generated by the window coding. A word of length n occurs in X_phi exactly // when its ZERO set is a union of per-prime kill sets // K_p(r) = { j in [0,n) : j = -r or j = -r-2 (mod p) }, // one r chosen per prime. By CRT every combination of the r_p occurs, so // cpx(n) = #{ union over p of K_p(r_p) : (r_p) in prod_p Z/pZ }. // That count is what this script evaluates, exactly. // // THE ENGINE, AND WHY IT TERMINATES. Split the primes at n+2. // - p <= n+2 : every choice of r kills something, so the prime contributes // EXACTLY ONE generator, chosen freely. The operation is a PRODUCT. // - p > n+2 : n < p, so at most one j in [0,n) lies in each of the two // classes, and K_p(r) is one of: the empty set; a pair {a-2, a} with // 2 <= a <= n-1; or a boundary singleton {0}, {1}, {n-2}, {n-1}. The empty // set is always available, so each large prime contributes an OPTIONAL // generator, and the family of available generators is the same for every // p > n+2. The operation is a union CLOSURE, and it saturates. // So cpx(n) is computed by one product pass over the small primes followed by // one closure pass over the large-prime generator family, with the generator // family read off a single prime above n+2 rather than derived by hand. // // STAGE A asserts the engine against a completely different one: c_x(n), the // number of distinct length-n windows of the actual level-x comb, computed by // rank refinement over the period x# in `import-bfree-01`. c_x(n) must be // nondecreasing in x and must stabilise at cpx(n). Stage A recomputes c_x(n) // here from the period directly and asserts both. // // STAGE B is the number itself, with the growth exponent in the coordinate the // published theorem uses, ln(cpx(n)) * ln(n) / n, whose one-class band is // [ln 2, ln 4] = [0.6931, 1.3863]. // // STAGE C is the one-class control: the same computation for the reduced // residues (one deleted class per prime), which is the shape the B-free // literature covers. // // REPRODUCTION. node research/import-bfree-03-admissible-complexity.js (~60 s) // NMAX=80 CAP=3e6 node research/import-bfree-03-admissible-complexity.js // ============================================================================ 'use strict'; const NMAX = Number(process.env.NMAX || 60); const CAP = Number(process.env.CAP || 3e6); function primesUpTo(n) { const s = new Uint8Array(n + 1); const o = []; for (let i = 2; i <= n; i++) if (!s[i]) { o.push(i); for (let j = i * i; j <= n; j += i) s[j] = 1; } return o; } // distinct kill-masks of prime p inside the window [0, n), for a comb that // deletes the classes {0, -d} (d = 2 for the twin comb, d = null for one class) function Ksets(p, n, twoClass) { const out = new Set(); for (let r = 0; r < p; r++) { let m = 0n; for (let j = 0; j < n; j++) { const t = (j + r) % p; if (t === 0 || (twoClass && t === ((p - 2) % p))) m |= (1n << BigInt(j)); } out.add(m); } return [...out]; } // cpx(n) using only primes <= xcut for the SMALL side and, if allowLarge, the // full optional generator family from primes above n+2. function cpxAt(n, twoClass, xcut, allowLarge) { const small = primesUpTo(Math.min(n + 2, xcut)); let S = new Set([0n]); for (const p of small) { const gs = Ksets(p, n, twoClass); const T = new Set(); for (const u of S) for (const g of gs) T.add(u | g); S = T; if (S.size > CAP) return null; } if (allowLarge) { const bigp = primesUpTo(4 * n + 60).filter((q) => q > n + 2)[0]; const G = Ksets(bigp, n, twoClass).filter((g) => g !== 0n); for (const g of G) { const add = []; for (const u of S) { const v = u | g; if (!S.has(v)) add.push(v); } for (const v of add) S.add(v); if (S.size > CAP) return null; } } else if (xcut > n + 2) { // finitely many extra primes in (n+2, xcut], each an optional generator, // each usable once. Distinct primes give the same generator family, so // using k of them realises unions of at most k generators. const extra = primesUpTo(xcut).filter((q) => q > n + 2); for (const p of extra) { const gs = Ksets(p, n, twoClass); const T = new Set(); for (const u of S) for (const g of gs) T.add(u | g); S = T; if (S.size > CAP) return null; } } return S.size; } // independent engine: distinct length-n windows of the real level-x comb, // by rank refinement over one period x# function combWindows(x, n) { const primes = primesUpTo(x); let N = 1; for (const p of primes) N *= p; if (N > 4e6) return null; const bits = new Uint8Array(N); bits.fill(1); for (const p of primes) { const cls = new Set([0, ((-2 % p) + p) % p]); for (const r of cls) for (let i = r; i < N; i += p) bits[i] = 0; } let cls = new Int32Array(N), order = new Int32Array(N), tmp = new Int32Array(N), nc = new Int32Array(N); let c0 = 0; for (let i = 0; i < N; i++) if (!bits[i]) c0++; let a = 0, b = c0; for (let i = 0; i < N; i++) { if (!bits[i]) order[a++] = i; else order[b++] = i; } for (let i = 0; i < N; i++) cls[i] = bits[i] ? 1 : 0; let k = (c0 === 0 || c0 === N) ? 1 : 2; for (let len = 1; len < n; len++) { if (k === N) break; let w = 0, s = 0; while (s < N) { let e = s + 1; const cc = cls[order[s]]; while (e < N && cls[order[e]] === cc) e++; for (let t = s; t < e; t++) { const i = order[t]; let j = i + len; if (j >= N) j -= N; if (!bits[j]) tmp[w++] = i; } for (let t = s; t < e; t++) { const i = order[t]; let j = i + len; if (j >= N) j -= N; if (bits[j]) tmp[w++] = i; } s = e; } let id = 0, pc = -1, pb = -1; for (let t = 0; t < N; t++) { const i = tmp[t]; let j = i + len; if (j >= N) j -= N; const bc = bits[j], cc = cls[i]; if (t > 0 && (cc !== pc || bc !== pb)) id++; nc[i] = id; pc = cc; pb = bc; } const t1 = cls; cls = nc; nc = t1; const t2 = order; order = tmp; tmp = t2; k = id + 1; } return k; } function main() { const t0 = Date.now(); console.log('=== STAGE A — the closure engine against the real level-x comb ==='); console.log(' c_x(n) = distinct length-n windows of the level-x comb, by rank'); console.log(' refinement over the period x#. cpx(n) = the closure engine\'s limit.'); console.log(' c_x(n) must be nondecreasing in x and must not exceed cpx(n).'); console.log(' n c_7 c_11 c_13 c_17 cpx(n) monotone? c_17 = cpx?'); let agree = 0, tested = 0; for (let n = 2; n <= 20; n++) { const c = [7, 11, 13, 17].map((x) => combWindows(x, n)); const lim = cpxAt(n, true, 1e9, true); let mono = true; for (let i = 1; i < c.length; i++) if (c[i] < c[i - 1]) mono = false; if (c[c.length - 1] > lim) { console.error(`ORDER VIOLATION at n=${n}: c_17=${c[3]} > cpx=${lim}`); process.exit(1); } if (!mono) { console.error(`MONOTONICITY VIOLATION at n=${n}: ${c}`); process.exit(1); } tested++; if (c[3] === lim) agree++; console.log( ` ${String(n).padStart(2)} ${c.map((v) => String(v).padStart(4)).join(' ')} ${String(lim).padStart(7)} yes ${c[3] === lim ? 'yes' : 'no'}` ); } console.log(` monotone in x at ${tested} of ${tested} lengths; c_17 already equals the limit at ${agree} of ${tested}`); console.log(''); console.log('=== STAGE B — cpx(n) for the twin-admissible subshift ==='); console.log(' the published one-class band for the prime subshift is'); console.log(' ln(cpx)*ln(n)/n in [ln 2, ln 4] = [0.6931, 1.3863]'); console.log(' n cpx(n) ln(cpx)*ln(n)/n cpx(n)/2^n'); const rows = []; for (let n = 1; n <= NMAX; n++) { const c = cpxAt(n, true, 1e9, true); if (c === null) { console.log(` ${n} OVER CAP ${CAP}`); break; } rows.push([n, c]); if (n <= 12 || n % 4 === 0 || n === NMAX) { console.log( ` ${String(n).padStart(2)} ${String(c).padStart(10)} ${n > 1 ? (Math.log(c) * Math.log(n) / n).toFixed(4) : ' - '} ${(c / Math.pow(2, n)).toExponential(3)}` ); } } console.log(''); console.log('=== STAGE C — one-class control (reduced residues) ==='); console.log(' n cpx1(n) ln(cpx1)*ln(n)/n ratio cpx1/cpx2'); for (let n = 4; n <= Math.min(NMAX, 60); n += 4) { const c1 = cpxAt(n, false, 1e9, true); const c2 = rows.find((r) => r[0] === n); if (c1 === null) { console.log(` ${n} OVER CAP`); break; } console.log( ` ${String(n).padStart(2)} ${String(c1).padStart(10)} ${(Math.log(c1) * Math.log(n) / n).toFixed(4)} ${c2 ? (c1 / c2[1]).toFixed(4) : '-'}` ); } console.log(''); console.log(`total ${(Date.now() - t0) / 1000} s`); } main(); // ============================================================================ // OUTPUT — EMBEDDED, do not hand-edit. Regenerate: // node research/qc/embed.js --streams both research/import-bfree-03-admissible-complexity.js // invocation: node research/import-bfree-03-admissible-complexity.js // code-sha256: 6533f35bca8acd71983eb4bf66f34ee0a0ab6c8bcf3b828de32057d1896549e8 // out-sha256: 488c9c286a868c82b11a5b5027fa4ad223b973e85638d56e9391cda417bef64e // streams: stdout+stderr // node: v22.21.0 // embedded: 2026-08-19 // elapsed: 56.5 s // ============================================================================ // === STAGE A — the closure engine against the real level-x comb === // c_x(n) = distinct length-n windows of the level-x comb, by rank // refinement over the period x#. cpx(n) = the closure engine's limit. // c_x(n) must be nondecreasing in x and must not exceed cpx(n). // n c_7 c_11 c_13 c_17 cpx(n) monotone? c_17 = cpx? // 2 3 3 3 3 3 yes yes // 3 4 4 4 4 4 yes yes // 4 5 5 5 5 5 yes yes // 5 6 6 6 6 6 yes yes // 6 7 7 7 7 7 yes yes // 7 9 9 9 9 9 yes yes // 8 11 11 11 11 11 yes yes // 9 13 13 13 13 13 yes yes // 10 15 15 15 15 15 yes yes // 11 17 17 17 17 17 yes yes // 12 19 19 19 19 19 yes yes // 13 22 22 22 22 22 yes yes // 14 25 25 25 25 25 yes yes // 15 28 28 28 28 28 yes yes // 16 31 31 31 31 31 yes yes // 17 34 34 34 34 34 yes yes // 18 37 37 37 37 37 yes yes // 19 43 43 43 43 43 yes yes // 20 49 49 49 49 49 yes yes // monotone in x at 19 of 19 lengths; c_17 already equals the limit at 19 of 19 // // === STAGE B — cpx(n) for the twin-admissible subshift === // the published one-class band for the prime subshift is // ln(cpx)*ln(n)/n in [ln 2, ln 4] = [0.6931, 1.3863] // n cpx(n) ln(cpx)*ln(n)/n cpx(n)/2^n // 1 2 - 1.000e+0 // 2 3 0.3808 7.500e-1 // 3 4 0.5077 5.000e-1 // 4 5 0.5578 3.125e-1 // 5 6 0.5767 1.875e-1 // 6 7 0.5811 1.094e-1 // 7 9 0.6108 7.031e-2 // 8 11 0.6233 4.297e-2 // 9 13 0.6262 2.539e-2 // 10 15 0.6236 1.465e-2 // 11 17 0.6176 8.301e-3 // 12 19 0.6097 4.639e-3 // 16 31 0.5951 4.730e-4 // 20 49 0.5829 4.673e-5 // 24 73 0.5681 4.351e-6 // 28 105 0.5539 3.912e-7 // 32 153 0.5448 3.562e-8 // 36 217 0.5355 3.158e-9 // 40 313 0.5299 2.847e-10 // 44 433 0.5221 2.461e-11 // 48 577 0.5128 2.050e-12 // 52 833 0.5110 1.850e-13 // 56 1121 0.5047 1.556e-14 // 60 1441 0.4963 1.250e-15 // // === STAGE C — one-class control (reduced residues) === // n cpx1(n) ln(cpx1)*ln(n)/n ratio cpx1/cpx2 // 4 7 0.6744 1.4000 // 8 25 0.8367 2.2727 // 12 73 0.8884 3.8421 // 16 211 0.9274 6.8065 // 20 535 0.9410 10.9184 // 24 1275 0.9469 17.4658 // 28 3103 0.9568 29.5524 // 32 7145 0.9611 46.6993 // 36 15955 0.9633 73.5253 // 40 36457 0.9687 116.4760 // 44 80233 0.9712 185.2956 // 48 164779 0.9688 285.5789 // 52 358883 0.9719 430.8319 // 56 737853 0.9712 658.2096 // 60 1436155 0.9675 996.6378 // // total 56.44 s // ============================================================================ // READINGS // ============================================================================ // // [1] TWO INDEPENDENT ENGINES AGREE AT EVERY LENGTH TESTED, WHICH IS WHAT MAKES // THE REST WORTH READING. c_7, c_11, c_13 and c_17 are computed by rank // refinement over the real period x#; cpx(n) is computed by the product- // then-closure argument over per-prime kill sets, sharing no code and no // data structure. They agree at 19 of 19 lengths, and c_x(n) is monotone in // x at 19 of 19. The script exits nonzero on any order or monotonicity // violation, so a green run is an assertion and not a display. // // [2] THE TWIN-ADMISSIBLE SUBSHIFT'S COMPLEXITY, WHICH THE CORPUS HAS NEVER HAD // A NUMBER FOR. cpx(n) = 2, 3, 4, 5, 6, 7, 9, 11, 13, 15, 17, 19 at n = 1 // to 12, and 31, 49, 73, 105, 153, 217, 313, 433, 577, 833, 1121, 1441 at // n = 16, 20, ..., 60. Against 2^n this is 1.250e-15 by n = 60: the comb // realises a vanishing fraction of binary words, which is the quantitative // form of "not every conspiracy occurs". // // [3] THE GROWTH EXPONENT SITS BELOW THE PUBLISHED ONE-CLASS BAND AND HAS NOT // CONVERGED. ln(cpx)*ln(n)/n peaks at 0.6262 (n = 9) and falls to 0.4963 at // n = 60, against the prime subshift's proven band [ln 2, ln 4] = [0.6931, // 1.3863] (Kasjan-Lemanczyk-Zuniga Alterman, Acta Arith. 209 (2023), // Thm 1.1). n <= 60 is nowhere near asymptotic in a coordinate carrying // n/log n, so this is a measurement of the head of a curve and not an // estimate of its limit. // // [4] THE ONE-CLASS CONTROL LANDS INSIDE THE PUBLISHED BAND, RISING. cpx1(n) = // 7, 25, 73, 211, 535, 1275, 3103, 7145, 15955, 36457, 80233, 164779, // 358883 at n = 4, 8, ..., 52, with exponent 0.6744 rising to 0.9719 — // inside [0.6931, 1.3863] from n = 8 onward. That is the right answer for // the right reason: the published upper bound (4+o(1))^{n/log n} is a count // of admissible patterns, and cpx1 is exactly that count. // // [5] THE TWO-CLASS SET IS DRAMATICALLY THINNER, AND THE RATIO IS GROWING. // cpx1/cpx2 reads 1.4000, 2.2727, 3.8421, 6.8065, 10.9184, 17.4658, // 29.5524, 46.6993, 73.5253, 116.4760, 185.2956, 285.5789, 430.8319 at // n = 4 to 52. The second deleted class costs more than a constant factor // over this range, which is the complexity-side statement of the same // dimension-2 penalty the sieve side prices as beta_2 = 4.26645. // // [6] WHAT THIS DOES NOT SHOW. It is a complexity function, not a bound on G2, // and nothing here touches the Zone Postulate. The published lower bound it // is being compared against is CONDITIONAL on Hardy-Littlewood, and the // comparison object (the prime subshift X_P) is not the comb: cpx counts // ADMISSIBLE windows, and whether the actual twin comb's own sequence // attains them is the tuples conjecture. No two-class version of Theorem // 1.1 was found in print, and no search in an identified owning convention // was run for one, so nothing here should be written as novel. // ============================================================================ // --------------------------------------------------------------------------- // FIGURE PROVENANCE (added 2026-08-20, readings-traceability pass). One figure // here is not in the OUTPUT block. No number above was changed. // // LITERATURE constant: beta_2 = 4.26645, the dimension-2 sieve penalty, quoted // to six figures. Its full value 4.26645028414864191641 is carried in // research/attack-beta2-04-loss-budget.js. // ---------------------------------------------------------------------------