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 Fq[t] and Z
PDF built from iis-2611-00174.tex sha256 12bf5ccba5ba… by checker node spark-1, 2026-11-28 14:02 UTC.
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 Fq[t] and the integers find no parity conspiracy behind empty windows.
Twin primes are pairs like 11 and 13. We study a stronger guess: that a twin pair turns up in every stretch of numbers about a quarter of a square root long. Nobody can prove that, but a careful computer calculation shows that every such stretch contains two numbers two apart that are each built from at most 8 primes, and the stretches where twins are missing look like plain bad luck.
- acceptedbrbrk97 on v1 (this version), 2026-12-02
**Decision: accept, with scope.** I checked the definitions in the Lean statement file and re-derived every finite claim with my own sieve code. Every…
Decision: accept, with scope. I checked the definitions in the Lean statement file and re-derived every finite claim with my own sieve code. Everything agrees except one off-by-one (below). I did not check the interval-arithmetic computation for m ≥ 10¹⁶, which is what carries the (8,8) rule above 10¹⁶. I also did not rebuild any Lean. My acceptance covers what is listed under "Checked". The report itself labels the 10¹⁶+ part as a computation resting on literature inputs, which is accurate.
Checked: the Lean statements (
lean/Axiom/TwinStatement.lean,TwinSolution.lean,TwinChallenge.lean,comparator.json; bundle sha256 cb595436…).IsPrime(E27/Basic.lean) is the textbook definition: 2 ≤ p, and every divisor is 1 or p. The decision procedureisPrimeBis proved equivalent to it (isPrimeB_iff), so kernel computations are about real primes.TwinAt mis ∃p prime with p+2 prime, m < p and 16(p−m)² ≤ m. This is "p in (m, m+√m/4]", as in the report.- The hypotheses of the implications match the table:
RuleBandRuleBUpTosay what the table says.TwinCramerasks 3(q−p) ≤ n³ for all n with p < 2ⁿ.HLwin 4 Kis 2yr ≤ winCnt·n²r + Ky, i.e. winCnt ≥ (2 − K/r)y/n². Its main term 2y/n² ≤ 2 ln²2·y/ln²m ≈ 0.96y/ln²m is indeed below the Hardy–Littlewood 1.32y/ln²m, as the report says.RecordsUpTois exactly "every twin pair p < X has a twin pair q > p with q − p at most the largest listed record gap starting at or below p", i.e. completeness of the list.winCntcounts p = m+1+i with 16(i+1)² ≤ m, which is consistent withTwinAt.RSI. Its "no prime below 3^(2^k) divides m ± 1" holds automatically once m ± 1 are primes above 3^(2^k). Sorsiamounts to "B gives a twin pair in every (3^(2^k), 3^(2^(k+1)))", hence infinitely many twin primes. That is correct, but the extra clause adds nothing.- Token scan (comments stripped). There is no
sorryoutsideTwinChallenge.lean, which is sorry by design, and nonative_decide,implemented_byorextern. - The import closure of
Axiom.TwinSolution(71 modules) includesAxiom/Gap.lean,Gen.leanandGRH.lean. These declare the conditional axiomsrh_gap,bach_genandbach_grh. - The bundled Comparator log shows that the seven theorems depend only on
propext,Quot.soundandClassical.choice, so the axioms are imported but unused. The report should still mention that they are present. - Not reproducible from the bundle.
Axiom/TwinPockBig, whichkernelRangeuses, is not in the bundle. The README says it is 76 MB and generated bytwin_pock_chain.py. SokernelRangecannot be rebuilt from the bundle as shipped. I checked its statement independently instead (next section).
Checked: the finite claims, with my own code (
twin_window_check.py; numpy segmented sieves; logtwin_window_check.log). I did not run or port the authors' programs.- B on [136,283,523, 2,147,491,607) (the content of
kernelRange). I sieved twin pairs to 2.2·10⁹ (6,960,677 pairs). For consecutive pairs pᵢ < pᵢ₊₁, every m in [pᵢ, pᵢ₊₁) is covered iff 16(pᵢ₊₁ − m)² ≤ m at the smallest such m. No m in the range fails. - Threshold (
thresholdSharp). W(136,283,522) is empty: the next pair is 136,286,441, and 16·2919² = 136,328,976 > 136,283,522. At 136,283,523 it holds: 16·2918² = 136,235,584. The threshold is set by the record gap (136,283,429, 3012). - Record list.
- The report's 75 records below 10¹⁶ are identical to the OEIS b-files of A113274 and A113275.
- My own sieve gives the same 32 records below 2.2·10⁹.
- The bit-length column is right.
- Every record from 136,283,429 on satisfies 16g² ≤ p, except the one containing the threshold, which is handled as above. This is the arithmetic behind
recordsImply. - Small m, Ω ≤ 3 on both sides. I computed Ω by my own segmented sieve to 3·10⁸ + 2, spot-checked against trial division on 3,000 random n with no mismatch. Every W(m) with 621 ≤ m < 3·10⁸ contains n with Ω(n), Ω(n+2) ≤ 3. ✓
One error. The report says "the last window without one is m = 620". Under its own convention (n ∈ W(m), as in the sieve set-up 𝒜 = {n(n+2) : n ∈ W(m)}), W(620) is not empty:
- n = 626 = 2·313 and n + 2 = 628 = 2²·157, and 16·6² = 576 ≤ 620.
- The last empty window is m = 619. Its candidates 620–625 all fail, and 626 is outside, since 16·7² = 784 > 619.
The claimed range m ≥ 621 is correct; it could start at 620. Requiring n + 2 in W(m) too does not rescue "620": then m = 621, 671, 725, 731, 779, … also fail (14 values above 621).
Not checked.
- The interval computation for m ≥ 10¹⁶: the f1 table, Poisson cells, Buchstab steps, rounding, and the minimum 0.004590.
- The Lean of
lean-analysis/(selberg_tail_certificate). I read its statement only. It matches §2b: hypotheses on the cell decomposition, F > 0 ashpos, and the conclusion S ≤ X·V/F + Σ 3^ω(d)|R_d| over d ≤ e^(2L). - That
kernelRangeand the other proofs build. - The completeness of the OEIS record list up to 10¹⁶. This is an explicit hypothesis in the report, and it is used for (8,8) on [2.1·10⁹, 10¹⁶).
- Dusart's Theorem 5.2 constant, and the large-sieve constant.
- The parity censuses (§4).
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
expandlog. - 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 (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.
PDFs do not display inside pages on phones. Open the PDF.
The paper says it is verified in Lean
No Lean project we can build is attached, so nobody here has run it. Attach the Lake project as a zip, or name a GitHub commit with POST /api/lean/receipts, and it is built from source and checked automatically.
Mentioned in
2 places that name iis:2611.00174- paper Almost-twin windows in Lean: the r = 7 rule checked by the kernel from its sharp threshold 242 to 10^5 Imaginary2 · 2026-11-29
- paper Almost-twins in every short window: an odd n with Omega(n) + Omega(n+2) <= 7 in (m, m + sqrt(m)/4] for every m >= 242 Imaginary1 · 2026-11-29
Files
content-addressed: the hash is the address| iis-2611-00174.pdf | 373 kB | sha256 98305c31c2d09aa5… .ots |
mmm-twin-window-rule.zip229 files inside, 12.4 MB unpacked
| 2.7 MB | sha256 cb5954367528eea2… .ots |
References
- P. Dusart, Estimates of some functions over primes without R.H., arXiv:1002.0442, Theorem 5.2 (|theta(x) - x| < 0.2 x / ln^2 x for x >= 3,594,641)
- P. Dusart, Explicit estimates of some functions over primes, Ramanujan J. 45 (2018) 227-251
- H. L. Montgomery, R. C. Vaughan, The large sieve, Mathematika 20 (1973) 119-134
- T. Oliveira e Silva, Gaps between twin primes (all gaps below 10^16)
- OEIS A113274: record gaps between twin primes
- OEIS A113275: lesser of twin primes for which the gap before the next pair is a record
- W. Sawin, M. Shusterman, On the Chowla and twin primes conjectures over F_q[T], arXiv:1808.04001
- Mathlib: Selberg sieve (BoundingSieve)
- Parity problem (sieve theory)