# A9: the gap-histogram fold rule, as an exact transfer operator *(2026-08-16, u-frame wave. Code, output and numbered readings in `research/a3-09-histogram-operator.js`. Calibration: the operator is DERIVED and then VERIFIED by exact computation at every fold from T5 to T31; the tail law is computed exactly, the asymptotic reading at the end is EXTRAPOLATED and marked.)* ## What was asked A9 asked for the exact evolution of the gap-size histogram under folding, as a transfer operator on count(d), and then for the thing the whole L question turns on: the tail P(gap >= 2p) as a function of x. ## PRIOR ART: the operator is Holt and Rudd 2014 **The transfer operator below is not new.** Fred B. Holt and Helgi Rudd, arXiv:1408.6002 section 5, build the transfer matrix M_J on the cycle of gaps, with its eigenstructure and binomial eigenvectors, in 2014. Their fusions are our kills, their cycle of gaps G(p#) is our tile, and their R1/R2/R3 recursion (Lemma 2.1) is our fold. This note is a rediscovery of that machinery in two-class vocabulary, and nothing in the operator section may be presented as new structure. See `research/PRIOR-ART.md` section "Holt and Rudd". What is not in their corpus is the spacing between consecutive g = 2 occurrences, which is our G2: they restrict to spans |s| < 2p throughout, and a maximum gap leaves that regime. So the head engine of the tail section, and the diagonal it computes, are ours. ## The operator Write the grain of T_p cyclically as g_0, g_1, ... with indices mod D and values summed as integers, so that one full turn adds W. Partial sums from slot i are G_j(i) = g_i + g_{i+1} + ... + g_{i+j-1}, G_0 = 0. A new gap is a maximal run: slot i survives the fold by q, the next L slots die, slot i+L+1 survives, and the new gap has size d = G_{L+1}(i). Then count_q(d) = SUM_{i in [0,D)} SUM_{L >= 0} [ G_{L+1}(i) = d ] * nu_q(g_i, ..., g_{i+L}) with nu_q(g_i, ..., g_{i+L}) = # { a in Z/q : G_j = a or a-2 (mod q) for j = 1..L, a not in {0, 2}, a not in {G_{L+1}, G_{L+1}+2} }. The three conditions are, in order: the interior of the run dies, the left endpoint lives, the right endpoint lives. ### Why it is closed on the gap word alone The fold is usually described copy by copy: copy k deletes the slots whose residue mod q lies in the 2-set {-kw, -kw-2}. That description carries the tile's residues around with it. It is not needed. The folded tile is Z/(qW) and q strikes exactly the positions congruent to 0 or -2 there, so the strike is one uniform rule and the copy index is bookkeeping. Shifting the alignment variable by the residue of the run's left endpoint removes the last trace of absolute position, and every condition becomes a condition on the gaps. That is the misalignment principle in its sharpest form. As k runs over the q copies the shifted alignment a runs over Z/q exactly once, so the operator integrates over all alignments with weight one each. **The new histogram is a function of the old gap word and of q, and of nothing else.** Not of W mod q, not of the tile's residues, not of the copy order. The word itself does depend on W mod q, since that fixes which copy comes next, but the histogram does not. ### The diagonal part is the pair correlation At L = 0 the count is nu_q(g) = q - |{0, 2, g, g+2}| = q-2 if q | g, q-3 if g = +-2 (mod q), q-4 otherwise, which is exactly the adapted pair correlation rho_q(g) that `grain-census.js` already uses. So the operator splits as count_q(d) = rho_q(d) * count_p(d) + (merge terms, L >= 1), verified size by size at every fold. The multiplicity is exact: of the q copies of a given gap, exactly |{0, 2, g, g+2}| in {2, 3, 4} have an endpoint struck, and the rest survive intact. The merge share of the new gaps falls steadily, 22.2%, 17.8%, 13.0%, 11.5%, 9.4%, 7.3%, 6.8% at folds 11 through 31, sitting just above 2/q as it should. ### Why merges are rare, which is the whole point For L >= 1 the candidate set A_L = {a : G_j in {a, a-2} for all j <= L} \ {0, 2} has at most two elements and only shrinks. Nonempty A_L with L >= 2 forces every interior gap of the run to be congruent to 0 or +-2 mod q. Grain gaps are multiples of 6, so the smallest gap that can sit inside a run is about 2q. The merge terms of order L therefore live on runs of L-1 consecutive gaps drawn from the tail above 2q, and the operator's own structure says: **the L question is the tail question, at threshold 2q, and nothing else.** ## Verification Every check in the output is exact, on the nose, no fitting. - The operator reproduces the true fold histogram size for size at T7 -> T11, T11 -> T13, T13 -> T17, T17 -> T19, T19 -> T23 and T23 -> T29, with the mass identity sum_d count_q(d) = D(q-2) holding exactly each time. - Iterated from the T7 word alone, with no sieve, it walks up to T23 and reproduces the glossary censuses at every level, G2 = 42, 66, 108, 150, 204. - Pushed two folds past the enumerable range it gives T29 (D = 214,708,725, G2 = 258) and T31 (D = 6,226,553,025, G2 = 348), both passing sum(d * count(d)) = W. ## The tail, computed rather than extrapolated The operator says what to compute; it does not by itself hand over a closed form. For that we extended the grain-census inclusion-exclusion into a head engine that returns count(d)/D at ANY level, in doubles, with no tile in memory. Two observations make it cheap. Primes q > d have |A_q| = 2m exactly, where m is the number of forced slots, so they contribute a closed factor and only primes q <= d need class bookkeeping. And ratios to D = prod(q-2) are formed factor by factor, so nothing overflows at any level. The engine agrees with the exact enumerated tails at T7, T11, T13, T17, T19, T23, T29 and T31 to 5e-16 absolute, which is round-off. It then gives P(gap >= 2p') along the fold diagonal with no enumeration at all. **The tail collapses, and the law is clean.** Along the fold diagonal P(gap >= 2p') falls from 0.133 at T7 to 2.4e-3 at T139, and ln(1/P(gap >= 2p')) = -0.24 + 1.30 * (2p'/mbar), R2 = 0.993, 31 points with the same slope on the last 23 points alone (1.36, R2 = 0.994). So P(gap >= t) ~ exp( -t / (0.77 * mbar) ). That is confirmed independently at fixed level: fitting ln P(gap >= t) against t over t in [1.5, 3.5] * mbar gives theta/mbar = 0.660, 0.675, 0.701, 0.725, 0.759, 0.758, 0.761 at T23, T29, T31, T41, T53, T71, T97, with R2 from 0.990 to 0.998. The tail is exponential, its scale is a fixed fraction of the mean gap, and that fraction is settling near 0.76. Two different fits, one across levels and one within a level, agree to three percent. **The threshold recedes.** mbar/ln^2 p falls 3.70, 2.85, 2.61, 2.50, 2.49, 2.42 at p = 7, 23, 37, 97, 199, 2003, and it has essentially arrived. The Mertens limit is mbar / ln^2 p -> e^{2 gamma} / (2 C_2) = 2.4026, from the twin-slot density (1/2)*prod_{2= 2p') = 0.20, 0.38, 0.35, 0.31, 0.33, 0.45, 0.31 at T11 through T31, so ln(1/f) = ln(1/tail) + about 1.1. Feeding the tail law into U-FRAME step 6, L ~ ln D / ln(1/f) <= ln D / ln(1/tail) ~ theta(p) * 0.77 * mbar / (2p) ~ 0.4 * mbar, and mbar is polylog, so L is polylog. Measured directly, ln D / ln(1/tail) divided by ln^2 p sits at 0.36, 0.64, 0.68, 0.78, 0.85, 0.79, 0.87, 0.82 at p = 7, 19, 37, 53, 71, 89, 107, 131. It is flat, near 0.8, over the whole range. So the heuristic cap on L is about **0.8 ln^2 p**. **What that is worth, priced against the sharp budget.** The route from L to G2 is U-FRAME section 5a step 3, `G2(new) <= maxsum_{1+L}(old)`, and against the sharp per-fold rate `ln c(p) <= 2 ln p / p` it goes through iff **L <= 0.19 to 0.31 * p / ln p** on average over the ladder (`research/gate-multiplies.md` section 8). A polylog L of 0.8 ln^2 p clears that from about p ~ 800 onward, with the margin then growing like p / ln^3 p. So the tail evidence puts us on the branch the route needs, for the reason the lens was built on: the prime grows linearly while the mean gap grows like ln^2 x, so the threshold 2p walks out into the tail and the tail is exponential. **It does not close the route.** The sum `SUM_{p<=x} L(p)*mbar(p)` is U-FRAME step 4, and step 4 is false: the absorbed neighbour of a record gap is drawn from the same fat tail as the record, not from the mean, and the substitution fails outright at two of seven folds. Any argument here that reaches x^2 through that sum is void. What the tail evidence supports is a branch, and the branch is not a proof: the cap above is a heuristic, and A5 Theorem B's proven bound is `L <= 0.18 p`, linear. **The gap between what is measured and what is proven is a factor 0.58 to 0.95 ln p, and it is the whole of the u-frame branch.** ## Honest limits Three things are exact and three are not, and they should not be confused. Exact: the operator, the fold histograms it produces at every level to T31, and the head engine's count(d)/D, which agrees with enumeration to 5e-16 absolute. Not exact, first: the tail LAW. Exponential decay with scale 0.77 mbar is a fit over p = 7 to 139, not a theorem. The head engine computes the tail exactly at each level, but the level is bounded by the inclusion-exclusion, whose leaf count roughly doubles per prime step; at present cost p = 139 takes 80 seconds and p = 200 is out of reach. Nothing here proves the fit continues. Not exact, and it should not be transported: the tail LAW is fitted on the TILE. Pushed through an extreme-value argument in the localized head it predicts R(1) = M/mbar between 12.0 and 12.6 across the Y = 10^9 scan, against a measured 12.6 to 18.7, mean ratio 1.23. **The head's gap tail is heavier than this fit by 20 to 25 percent**, its own exponential rate being about 1.06/mbar rather than 1.2992/mbar, and that is the unhelpful direction (`research/localized-04-maxsum.md` section 8). Do not use the fit outside the range it was fitted on. Not exact, second: the step from the tail to L. The relation L ~ ln D / ln(1/f) is an independence heuristic, and the measured L (1, 2, 2, 2, 3, 2, 4 at folds 11 to 31) runs far below its cap (1.3, 3.3, 3.5, 5.1, 5.6, 6.7, 7.7). So the tail law bounds L only under that heuristic. It bounds it very comfortably, which is a different claim. Not exact, third, and this one is not an approximation but an error: the sum SUM L * mbar is U-FRAME step 4, and step 4 is FALSE, at two of seven folds by direct check. No conclusion may be routed through it. What the operator does establish outright is the shape of the reduction: no merge of order L can occur without L-1 consecutive gaps congruent to 0 or +-2 mod q, hence all above 2q, so any genuine tail bound at 2p is a genuine bound on merging. The interval difficulty has been pushed into one scalar, P(gap >= 2p), which we can now compute exactly at any level within reach and which is measured to be collapsing. ## Reproduction node --max-old-space-size=8000 research/a3-09-histogram-operator.js 201 s. The deep folds cost 27 s of that, the diagonal sweep the rest, and the last level alone (p = 139) costs 76 s because the inclusion-exclusion roughly doubles per prime step. ## The L diagonal, confirmed here independently The operator gives the run-length spectrum directly, so it settles L without a run finder. For T23 folded by 29 the spectrum stops at L = 2, and direct enumeration over all 29 copies of the folded tile agrees. The diagonal is fold 7 11 13 17 19 23 29 31 L 2 1 2 2 2 3 2 4 so **L is not monotone**: the dip at 29 is a second instance of the dip at 11. This is one of five independent confirmations of that diagonal (A4, A5, A08, A9 here, A10). `research/Lgrowth.js` used to report 3 at fold 29 from the run-finder bug it shared with `research/killrun.js`; both were corrected on 2026-08-16 and it now returns 2, agreeing with the other four confirmations. --- ## The fold-29 slack, localized *Audit, 2026-09-13. Independent producer `certslack-tile.mjs`, attached, and its stdout.* The L diagonal above records the L that *attains* the certificate, not the largest L the qualifying-interior condition admits. On the latter reading the fold 23 -> 29 spectrum reaches L = 3, and that is exactly where the certificate's slack of 12 lives. Recomputed from the twin-slot tile itself - slots `gcd(x,W) = gcd(x+2,W) = 1`, `W = z#` - with the window histogram accumulated exactly rather than sampled: fold 7#->11# 11#->13# 13#->17# 17#->19# 19#->23# 23#->29# slots D 15->135 135->1485 1485->22275 22275->378675 378675->7952175 certificate M 42 66 108 150 204 270 truth G2(new) 42 66 108 150 204 258 (record) slack 0 0 0 0 0 12 `M` = max `G_{L+1}(i)` over windows whose `L-1` interiors qualify mod q reproduces the record's certificate and truth exactly at the five enumerable folds, zero slack, and at fold 29 gives 270 against the independently derived `G2(T29) = 258`. **The two candidate causes, separated.** 1. **The `(q-2)N(theta)` term is inert.** `N(theta) = 0` for every `theta > 204`, the max old gap, so the whole of `RHS` on `theta = 259..270` is the window term, `2*Sum Q_L = 4`. Nothing in the slack comes from the single-gap tail. 2. **Exactly two windows reach 259, and both reach 270:** i = 3207090 L = 3 G_4 = 12 + 60 + 60 + 138 = 270 interior residues mod 29: 12, 14, 16 i = 4745079 L = 3 G_4 = 138 + 60 + 60 + 12 = 270 interior residues mod 29: 22, 24, 26 They are exact reversals of one another. Neither is realizable: `nu_q = 0` for both, and in both the condition that empties the alignment set is **the interiors**, not an endpoint. The interior residue runs step by +2, and a 2-set `{a-2, a}` covers such a run only when its residues alternate between two values; three consecutive +2 steps give three distinct residues, so no `a` serves. That is the walk condition the loose `Q_L` drops, and what the `M_alt` refinement restores. **Held out.** Neither window carries a q-divisible gap, so holding the q-divisible class out of both `RHS` terms changes nothing: `M` stays 270, the slack stays 12. The q-divisible class is not the cause of the fold-29 slack. **Precision note for this document.** The `L = 2` entry for fold 29 in the diagonal above is the attaining L and is correct; the qualifying-interior spectrum itself reaches `L = 3` there, so reading that row as the largest admissible L would be wrong at fold 29. Reproduction: `node --max-old-space-size=6000 certslack-tile.mjs`, 1.7 s, exit 0, stdout byte-identical across runs. Hashes: producer `59974c5beaa1cc1c700a3dfd4afe2ab7cd7a39c866326cbab4a6b4387034dae2`, stdout `459f215932d5445996356adba301d1ee8eb82ab1b0e1eecdd50076c2a66f0777`. --- ## The fold above the table: the certificate at 37, and the local test *Audit, 2026-09-13, second revision from the same session. The ladder above stops at T31.* **1. The local test.** A fold's certificate is exact exactly when its own argmax is realizable, and that is one comparison in the pass that already computes `M`: a window is realizable iff its interior partial-sum residues mod q lie in a 2-set `{a-2, a}` -- equivalently, iff no two consecutive *nonzero* interior steps have the same sign. A drifting run (steps +2, +2) reaches three distinct residues and no `a` serves, which is where the slack lives (the fold-29 section above). Applied at every fold the corpus can reach: fold certificate M record argmax windows realizable verdict 11 -> 13 66 66 6 6 exact 13 -> 17 108 108 8 8 exact 17 -> 19 150 150 8 8 exact 19 -> 23 204 204 4 4 exact 23 -> 29 270 270 2 0 loose (the two phantoms) 29 -> 31 348 348 4 4 exact 31 -> 37 528 528 2 2 exact Every gate reproduces the record's certificate column exactly. **2. The top term, without storing the word.** The fold 31 -> 37 is reachable with this instrument even though `T_31` has 6,226,553,025 gaps -- 6.2 GB as bytes and 12.5 GB as 16-bit, past the 8 GB offered. The fold emits `T_31`'s gaps in sorted order (`x = k*W_29 + s`, ordered by `(k, s)`, and the surviving lifts are 29 of 31 because `x = 0, -2 mod 31` are excluded), a ring of the last `CAP+1 = 129` gaps evaluates every window as it arrives, and one replay of the first 129 gaps -- the ring then holding the word's tail, so negative indices resolve cyclically -- covers the wrap. Memory is O(CAP) beyond the previous tile's slot array. Wall clock **241 s**. Gates on the way: `T_29` `D = 214,708,725`, max gap 258; `T_31` `D = 6,226,553,025`, max gap 348. The certificate at the fold 31 -> 37 is **528**, attained by two windows, `168+222+72+66` and its reverse `66+72+222+168`, both realizable (`nu_q = 1`), interiors `[20,20,18]` and `[29,27,27]`, each inside a 2-set. So the instrument is exact at this fold and reports so by its own test. **3. Cross-reference, not a new number.** `G2(T_37) = 528` is already on the record: `research/oeis-G2-submission.md` line 46 lists the ladder through `... 204, 258, 348, 528`, and line 174 records that term as a "mod-30 lattice walk over 7.42e12 positions (~54 min; slot count matched A059861 = 217929355875 exactly; max gap at r = 544899485411)". This is therefore an independent route to the same value, and a cheaper one by about 13x (241 s against ~54 min), not a new term. What is new is that the *certificate* reaches the top of the record's ladder and stays exact there, which the ladder's own table did not have. Reproduction: `node --max-old-space-size=7000 streamfold.mjs validate` (10 s, six gates) and `node --max-old-space-size=7000 streamfold.mjs big` (241 s, the top term). Producer `8a529985c25f75c2b87abb8eb893207037c2823797b3c3b22a6d8deafe696396`, validate stdout `a3f9c4175d69aad6a3104590713472b98d9bbe49a9321ef8bc73e8f2622765a6`, big stdout `765281abaef1c86dc3f290ec49fb943d57ad07ed818e3ffbd4d451ba0b516708`. --- ## The fold above 37: the certificate at 41, by a parallel traversal *Audit, 2026-09-13, third revision from the same session. The section above stops at the fold 31 -> 37.* **1. What changes, and what does not.** The instrument does not change: the certificate at a fold `p -> q` is a maximum over windows of the OLD word. What changes is reach. The fold `37 -> 41` needs `T_37`'s 217,929,355,875 gaps, never `T_41`'s period: `W_41 = 3.05e14` is 41 times larger, and `research/oeis-G2-submission.md` line 176 prices the `41#` term at about 40 times the 54-minute walk that produced `528`. So the certificate can be asked for at a fold the ladder's own route reaches only by paying that factor. **2. The traversal.** The word is still never stored. It is emitted in sorted order `x = k3*W_31 + k2*W_29 + k1*W_23 + s`, lexicographic in `(k3, k2, k1, s)`, with the three fold filters applied as residue compares against the previous tile's slots (`x = 0`, `-2` mod `29`, `31`, `37` are excluded), so the inner loop is three add-and-compare steps per candidate. A ring of the last 512 gaps evaluates every window as its last gap arrives, and the wrap is one replay of the head with the ring holding the tail, exactly as in the section above. **The parallel decomposition is traversal only.** The task index `t = k3*31 + k2` is lexicographic in the word's own order, so a worker's range of consecutive tasks is a contiguous range of the word. A worker primes its ring by re-emitting the last 130 gaps of the task before its range — only that task's last `k1` slice can supply them, so this costs a few hundred steps and never a sweep — the last worker pushes the closing gap `x_0 + W_37 - x_last` and replays the first 131, which is exactly the single-threaded seam, and the parent takes the max of the workers' certificates, of their `D` counts and of their max gaps. Memory is O(CAP) per worker plus one 32 MB copy of `T_23`'s 7,952,175 slots, shared by all workers. The report is traversal-independent: at 1, 2 and 5 workers the validate run is byte-identical apart from the two lines that name the worker count. **3. Gates, then the certificate.** `D(T_37) = 217,929,355,875`, the same count `oeis-G2-submission.md` line 174 records against A059861 for the `41#` row, and the max gap of `T_37` is **528**, the ladder's twelfth term as line 46 lists it. `x` emitted equals `D`, so no position was dropped or counted twice. Then the fold `37 -> 41`: certificate M = 546 i = 30,994,901,529 L = 3 sum = 546 = 126+84+246+90 nu_41 = 1 interiors mod 41 [3,5,5] i = 106,796,416,602 L = 3 sum = 546 = 126+84+246+90 nu_41 = 1 interiors mod 41 [3,5,5] i = 111,132,939,273 L = 3 sum = 546 = 90+246+84+126 nu_41 = 1 interiors mod 41 [8,8,10] i = 186,934,454,346 L = 3 sum = 546 = 90+246+84+126 nu_41 = 1 interiors mod 41 [8,8,10] LOCAL TEST: 4/4 argmax windows realizable => certificate EXACT at this fold So the certificate reaches **546**, the record's `G2(41#)` (`research/QUESTIONS.md`, row `Q-block-combined-L`), at a fold where the corpus had no certificate before, and the instrument reports its own exactness there: all four argmax windows are realizable, and the window shapes are two mirror pairs. The interior runs `[3,5,5]` and `[8,8,10]` mod 41 sit inside a 2-set exactly as the local test of the section above requires, which is the same structural fact that separated the exact folds from the loose one at `23 -> 29`. **4. Cost, and the honest limits.** Eight worker threads on eight physical cores: 1,808 s wall, about 4.0 CPU-hours, against roughly 4 hours single-threaded. That is above the 2 CPU-hours per assignment this session registered — it was used because my person asked for exactly this parallelisation and granted the machine while it ran, and it is recorded here rather than left implicit. What is **not** claimed: `546` is already on the record, so this is a second and cheaper route to it plus the certificate, not a new term; no exponent, no bound, no rate and nothing about the twin margin or the Zone Postulate follows. The next reachable fold is `41 -> 43`, for which the old word would be `T_41` at 41 times the gaps, i.e. about 20 hours at this speed; the traversal would have to be segmented to disk before that is attempted. *Producer `parfold.mjs` (`765c11e4…`); stdout `parfold-big.out` (`49d0c8b0…`, 1,808 s) and `parfold-validate.out` (`b26fcfb1…`); reader `analyze-fold41.mjs` / `analyze-fold41.out` (`3cf1b174…`).* *This document states current understanding. Superseded claims, retired numbers and the reasons they changed are in [history/CHANGELOG.md](history/CHANGELOG.md), indexed by document.*