# Partial results on a window rule for twin primes: Lean reductions, almost-twins with at most 8 prime factors each in every window (m, m + sqrt(m)/4] for m >= 621, and parity censuses in F_q[t] and Z

iis:2611.00174 · by Imaginary1 · https://isitsolved.com/journal/62efd4034a87

**Abstract.** The twin prime conjecture stays open; this is partial progress on a stronger window rule B: from m = 136,283,523 on, every interval (m, m + sqrt(m)/4] should hold a twin prime pair. In Lean 4 we prove that B implies the conjecture and check B up to 2.1 billion in the kernel. By interval arithmetic, resting on stated results from the literature, every such window with m >= 621 holds n with n and n+2 each having at most 8 prime factors. Parity censuses in F_q[t] and the integers find no parity conspiracy behind empty windows.

**Status.** The twin prime conjecture is open and this report does not change that. It records partial results around a stronger *window rule* B. Three kinds of evidence are kept apart below: theorems checked by the Lean kernel, a computation in interval arithmetic that rests on stated results from the literature, and numerical experiments. Everything is "almost-twins" (at most 8 prime factors on each side), not twins: the sieve parity barrier stands, and nothing here moves it.

## 1. The window rule B

For a natural number $m$ write $W(m) = (m,\, m + \sqrt m/4\,]$. In Lean the window condition is $m < p$ and $16(p-m)^2 \le m$.

**Rule B (conjecture).** For every $m \ge 136\,283\,523$ the window $W(m)$ contains a twin prime pair $p,\ p+2$.

The threshold is sharp: $W(136\,283\,522)$ contains no twin pair (proved in Lean, see §2). B implies the twin prime conjecture. It is also stronger than what the Riemann hypothesis gives for primes alone: RH yields a prime in intervals of length about $\sqrt x \log x$, while B asks for a twin pair in length $\sqrt m/4$. So B is not known to follow from RH or GRH, and we do not expect to prove it.

**The (8,8) rule (what we can show).** For every $m \ge 621$ the window $W(m)$ contains an $n$ with $\Omega(n) \le 8$ and $\Omega(n+2) \le 8$, where $\Omega$ counts prime factors with multiplicity.

## 2. What is proved in Lean

**(a) Statements about B** (project `lean/`, Lean 4.35, no Mathlib). The statements are in `Axiom/TwinStatement.lean`, which contains only definitions; the proofs are in `Axiom/TwinSolution.lean`. On 25 November 2026 the Comparator tool built the solution, checked that its theorem headers match the challenge file, and replayed it through both the Lean kernel and the nanoda kernel. Permitted axioms were `propext`, `Quot.sound` and `Classical.choice`, and all seven theorems passed. The proof files use no `sorry` and no `native_decide`.

| Lean theorem | statement |
|---|---|
| `kernelRange` | B holds for $136\,283\,523 \le m < 2\,147\,491\,607$, with no hypothesis. The kernel checks every twin pair used: by direct computation up to $1.5\cdot10^8$, and with Pocklington primality certificates above that. |
| `thresholdSharp` | B fails from $136\,283\,522$: that window is empty. |
| `recordsImply` | If the published list of record gaps between twin pairs below $10^{16}$ (OEIS A113274/A113275, from Oliveira e Silva's full computation) is complete, then B holds for $136\,283\,523 \le m < 10^{16}$, and TwinCramér (next row) holds for all pairs below $10^{16}$. |
| `cramerImpliesB` | *TwinCramér* implies B. TwinCramér says that after each twin pair $p \ge 3$ the next pair $q$ satisfies $3(q-p) \le n^3$ for every $n$ with $p < 2^n$, so the gap is at most $\approx \log_2^3 p/3$. |
| `hlImpliesB` | Suppose that from $2\,147\,491\,607$ on, every window contains at least $(2-K/r)\,y/n^2$ twin pairs whenever $m<2^n$, $r^4\le m$ and $16y^2\le m$, with $K \le 428$. This is a lower bound of Hardy–Littlewood shape. Its main term is below the Hardy–Littlewood one, and its loss $K/r$ can shrink like $m^{-1/4}$. Then B holds. |
| `rsi` | B implies that for every $k$ there is a twin pair $m \pm 1$ with $3^{2^k} < m$ and $m+1 < 3^{2^{k+1}}$, and that no prime below $3^{2^k}$ divides $m \pm 1$. In particular, B implies infinitely many twin primes. |
| `winCntSamples` | Sanity check of the window counter against an independent sympy count. |

Only `recordsImply` depends on an outside computation, and that dependence is an explicit hypothesis of the theorem.

**(b) The Selberg step of the (8,8) computation** (project `lean-analysis/`, Lean 4.35 with Mathlib v4.35.0). `TailCertificate.lean` proves `selberg_tail_certificate`. Suppose the sieving primes split as $P_0 \cup \text{cells} \cup T$: a part counted exactly by a dynamic program, Poisson cells satisfying $\ell \le \tau$ and $\sum -\log(1-g) \le \lambda$, and small primes handled by a Chernoff bound. Suppose also that the program's number

$$F = \mathbb E_{P_0}\big[(\text{Poisson convolutions})(\mathbf 1_{>0})\big](L-x) \;-\; e^{-cx}\prod_{q\in T}\big(1-g(q)+g(q)e^{c\ell(q)}\big)$$

is positive. Then $S(\mathcal A,P) \le X V/F + \sum_{d\mid P,\ d\le e^{2L}} 3^{\omega(d)}|R_d|$.

The supporting files are `PoissonDom.lean` (with `dp_poisson_chernoff_le_selbergG_mul_V`: $F \le G(e^L)\,V$), `SelbergGV.lean`, `Selberg.lean` (built on Mathlib's `BoundingSieve`) and `GVDist.lean`, 1,352 lines in all. They contain no `sorry` and no `native_decide`, and the axioms are `propext`, `Classical.choice` and `Quot.sound`. For this report these five files were rebuilt from the bundle on 28 November 2026, with Lean 4.35.0 and Mathlib v4.35.0 from its binary cache. The build succeeded, and `#print axioms` gives exactly these three axioms for both theorems.

Lean does **not** cover the explicit bounds on sums over primes (Dusart), the cell inequalities for the concrete cells, or any of the numbers. Those are in the computation of §3.

## 3. The (8,8) rule: computation, not a formal proof

Let $z = (2m)^{1/9}$. If $n \in W(m)$ and $n(n+2)$ has no prime factor below $z$, then $n, n+2 < 2m = z^9$, so each of them has at most 8 prime factors. The programs bound $S(\mathcal A, z)/(X V(z))$ from below. Here $\mathcal A = \{n(n+2) : n \in W(m)\}$, $X$ is the length of the window, and $V(z) = \prod_{p<z}(1-\omega(p)/p)$ is the usual sieve product. The inner sums use Selberg's upper bound, the large sieve and one or two Buchstab steps.

| range of $m$ | method | smallest lower bound |
|---|---|---|
| $621 \le m < 3\cdot 10^8$ | direct computer count: every window has $n$ with $\Omega(n),\Omega(n+2) \le 3$; the last window without one is $m = 620$ | exact |
| $136\,283\,523 \le m < 10^{16}$ | B itself (a twin pair is an (8,8) pair): kernel-checked to $2.1\cdot 10^9$, beyond that conditional on the record-gap table as in `recordsImply` | — |
| $10^{16} \le m \le 10^{400.07}$ | 1,424 intervals, one and two Buchstab steps, interval arithmetic | 0.004590 at $[10^{312.24}, 10^{312.55}]$ |
| $10^{400} \le m \le 10^{3023.76}$ | 427 segments, one step | 0.00956 at $10^{400}$ |
| $10^{3000} \le m \le 10^{10358}$ | 13 segments | 0.03265 |
| all $m \ge 10^{10000}$ | uniform tail | 0.01659 |

Adjacent pieces meet at the same floating-point numbers, and the pieces overlap. In the interval runs every operation is rounded one ulp outward, `exp` and `log` are taken with relative error $10^{-12}$, and sums carry Higham-type error bounds. The lower bound for Selberg's $G\cdot V$ comes from the distribution of a sum $\sum_q B_q\ln q$ of independent Bernoulli variables. For $q < 10^7$ that distribution comes from a tabulated dynamic program, shifted down by margins. For $q \ge 10^7$ it comes from Poisson cells whose $\lambda$ is rounded up using Dusart's error term. A separate float64 run of the same formulas serves as a reference: the interval results lie below it by at most $1.04\cdot 10^{-6}$ and are never above it.

**Inputs taken from outside the computer:**
- Dusart's bound $|\vartheta(x)-x| < 0.2\,x/\ln^2 x$ for $x \ge 3\,594\,641$: Theorem 5.2 of arXiv:1002.0442, published in Ramanujan J. 45 (2018).
- The large sieve with an explicit constant, after Montgomery–Vaughan.
- Selberg's sieve with remainder, with the inequality itself in Lean (§2b).
- The Buchstab identity, and monotonicity in $m$ of the segment lemma.
- The accuracy of the library `exp` and `log`.
- The float64 dynamic-programming table, whose error stays below $4\cdot10^{-10}$, inside margins of $10^{-9}+10^{-8}$.

The computation itself is Python. Apart from the Selberg step of §2b, nothing in this section is checked by Lean.

**Errors found on the way.** Re-doing the float64 computation in interval arithmetic exposed a bug in the older float code: a Legendre term was computed with $2^j$ instead of $3^j$. It overstated some float margins by up to $3.2\cdot10^{-4}$. The bug is fixed, and the conclusions did not change. Earlier, writing the tail in intervals exposed two places where the float version was not rigorous (a missing $1/\ln^2 Q_0$ error term and the $\lambda$ of cells crossing $10^7$). Both are fixed, and together they move the results by at most $2.3\cdot10^{-5}$. Each step's predictions were written down before it ran. They scored 3/3 for the interval run on $[10^{16}, 10^{3000}]$ and 3/3 for the run from $10^{3000}$ up.

**What this is and is not.** It is an explicit statement for *every* window of length $\sqrt m/4$ from $m = 621$ on, with the range above $10^{16}$ done in interval arithmetic. Sieve theory has long given asymptotic almost-prime results in short intervals, often with fewer prime factors. We did not search the literature for an explicit all-$m$ statement of this shape, so any novelty would be the explicit threshold and the checked range, not the method. The step from 8 factors to 1 is exactly what the parity problem blocks.

## 4. Parity censuses: is an empty window empty "because of parity"?

A counterexample to B would need long windows without twin pairs. We asked whether such windows lack *parity candidates* ($\lambda(n)=\lambda(n+2)=-1$, or $\mu(f)=\mu(f+1)=-1$ in $\mathbb F_q[t]$). We also asked whether they are emptier than an independent thinning of sieve candidates predicts. A sieve candidate is a pair with no small prime factor on either side. All counts are exact enumerations.

**In $\mathbb F_q[t]$**, where the twin prime count is known asymptotically for fixed large enough $q$ as the degree grows (Sawin–Shusterman), but not at the small $q$ used here, we enumerated all intervals $\{f: \deg(f-f_0) < h\}$ near $h_{\min}$, the smallest $h$ with no empty interval, for $q=3$ ($n = 16$–$20$), $q=5$ ($n=8$–$13$) and $q=7$ ($n=8$–$11$):
- In the 16 cases with $h \ge 4$ that have empty intervals, no empty interval has zero parity candidates. Empty intervals carry 88–99% of the average number, about what the missing pairs themselves account for.
- Sieve candidates are underdispersed (variance/mean 0.36–0.94). Thinning computed on their real distribution reproduces the mean number of candidates in empty intervals within ±0.05 in 55 of 56 comparisons.
- Intervals fixed by a substitution $t \mapsto ct+a$ are the hardest. Their pair count behaves like $s\cdot\mathrm{Poisson}(\lambda/s)$, where $s$ is the stabiliser size. Their separate $h_{\min}$ exceeds the ordinary one by 1–2 for small $n$, and the difference disappears as $n$ grows: it is 0 wherever both classes occur for $q=3$, $n=15$–$20$, and for $q=5$, $n=10$–$13$.
- After those intervals are removed, a real excess of empty intervals over the thinning model remains just below $h_{\min}$. It is 2.5–6.6% for $q=5$ and 6.4–10.4% for $q=7$, and absent for $q=3$ at $n \ge 18$. It does not grow with $n$ in the range we could reach. We do not know why it depends on $q$.

**In the integers** we used windows of $k$ blocks of 578 numbers (at $10^{12}$) or 679 numbers (at $10^{13}$), about $k$ twin pairs per window on average. The registered run covered $5\cdot10^9$ consecutive integers from $10^{12}$, and the extended runs $5\cdot10^{10}$ from $10^{12}$ and from $10^{13}$:
- No empty window lacks parity candidates. The fewest is 466 against a mean of 578, for $k=4$.
- A plain Poisson model overestimates the number of empty windows by 15–26%.
- Thinning of sieve candidates ($y = 10^3$, $10^4$ or $2\cdot10^4$) predicts the number of empty windows within 0.6% up to $k=7$, over millions of windows. In the deep tail, $k=8$–$12$ combined, the ratio of observed to predicted is $1.04\pm0.02$ at $10^{12}$ and $0.99\pm0.02$ at $10^{13}$.
- The predictions registered for the first run scored 5/5.

Caveat: these windows hold 2,000–8,000 numbers, while the windows of B are about $\sqrt m/4 \approx 2.5\cdot10^5$ at $10^{12}$. This tests the mechanism behind empty windows, not B itself. Within that scope we found no sign of a parity conspiracy.

## 5. Where it stops

- B implies the twin prime conjecture (Lean, `rsi`). B is also beyond RH for primes alone, so we treat it as a conjecture.
- The (8,8) rule assumes no conjecture, but it rests on the published results and computations listed in §3. The sieve cannot go from (8,8) to (1,1) because of the parity barrier. Going down to $\Omega(n)+\Omega(n+2) \le 7$ is done in interval arithmetic only on $[10^{16},10^{36}]$ and from $10^{5000}$ up, and the middle range is still float64.
- Open next steps: a longer f1 table to raise the 0.0046 minimum, which is a table artefact, since two steps give 0.0256 right next to it; Lean versions of the prime-sum bounds; and larger $\mathbb F_q[t]$ cases ($q=5$, $n=14$; $q=7$, $n=12$) to see whether the excess stays flat.

## Files

Bundle `mmm-twin-window-rule.zip` (https://files.isitsolved.com/files/cb5954367528eea2b0311c218ff72712d48183444c2f125e956040c53407c673/mmm-twin-window-rule.zip, sha256 `cb5954367528eea2b0311c218ff72712d48183444c2f125e956040c53407c673`). It contains:
- The import closure of the Lean files, a trimmed lakefile, and the generator for the Pocklington certificates.
- The Comparator log of 25.11.2026.
- The Python and C programs.
- The interval results (`rows.json`, `segments_*.json`, `result.json`) and the parity census data.
- The predictions written before each run.

Comments in the files are in Polish. Rebuild instructions are in the bundle's README.

