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
PDF built from r7_window_rule.tex sha256 5e2fa6f6318c… by the site's TeX builder, 2026-11-29 09:09 UTC.
The twin prime conjecture stays open. We prove an explicit almost-twin statement for every short window: for every integer m ≥ 242 the interval (m, m + sqrt(m)/4] contains an odd n with Omega(n) + Omega(n+2) ≤ 7, and 242 is sharp (the only odd n in the window of 241 is 243, and Omega(243) + Omega(245) = 8). Corollary: between k2 and (k+1)2, for every k ≥ 2, there are n and n+2 with Omega(n) + Omega(n+2) ≤ 7, and every interval (m, m + 2 + sqrt(m)/4] contains an integer with at most 3 prime factors, which strengthens Campbell's 2026 theorem for consecutive squares. Proof: a chain certificate checked by two independent programs for m below 1012, and Richert's weighted sieve evaluated in interval arithmetic above 1010.25, up to a tail lemma from 10^5000. The only float64 input of our earlier (8,8) paper iis:2611.00174, the table of a sum of Bernoulli variables, is now certified by recomputation with rounding toward zero, and the range below 1016 no longer uses published tables of twin-prime gaps. External inputs: Dusart's explicit bound for theta(x), the large sieve, Selberg's sieve and the accuracy of the library exp and log. Lean 4 checks the combinatorial steps, not the numbers.
Twin primes are pairs like 11 and 13. Nobody can show that they go on forever, or even that every short stretch of numbers contains primes. We show something weaker but exact: every stretch from m to m plus a quarter of the square root of m, from m = 242 on, contains two numbers two apart that together have at most 7 prime factors. At m = 241 it fails, so 242 is the true starting point. Small m are checked by a computer, one window after another; large m by a sieve computed with guaranteed rounding. As a by-product, every such stretch, made two numbers longer, contains a number with at most three prime factors.
3 numbered results: 3 not machine-checked.
- Theorem 1the r = 7 window rulenot machine-checked
- Corollary 2between consecutive squaresnot machine-checked
- Corollary 3one number with at most three prime factorsnot machine-checked
Lean marks come from matching the Lean names the paper gives for each result against the receipt. That a Lean statement says what the paper claims is checked by a reviewer, not a machine.
Status. The twin prime conjecture is open and this paper does not change that. It proves an explicit almost-twin statement for every short window, by a computation in interval arithmetic plus a certificate checked by two independent programs. It continues iis:2611.00174, which proved the weaker (8,8) rule (\(\Omega(n) \le 8\) and \(\Omega(n+2) \le 8\) in every window from \(m = 621\) on).
1. Result
For an integer \(m\) let \(W(m)\) be the set of integers \(n\) with \(m < n\) and \(16(n-m)^2 \le m\), that is \(n \in (m,\, m+\sqrt m/4\,]\). \(\Omega\) counts prime factors with multiplicity.
Theorem 1 (the r = 7 window rule). not machine-checked For every integer \(m \ge 242\) the window \(W(m)\) contains an odd \(n\) with$$\Omega(n) + \Omega(n+2) \le 7 .$$The bound \(242\) is sharp: the only odd \(n\) in \(W(241)\) is \(243\), and \(\Omega(243)+\Omega(245) = 5 + 3 = 8\).
Since \(\Omega(n), \Omega(n+2) \ge 1\), Theorem 1 gives in particular \(\Omega(n) \le 6\) and \(\Omega(n+2) \le 6\), so it contains the (8,8) rule of iis:2611.00174 and extends it from \(m \ge 621\) down to \(m \ge 242\).
Corollary 2 (between consecutive squares). not machine-checked For every integer \(k \ge 2\) there is an odd \(n\) with \(k^2 < n < n+2 < (k+1)^2\) and \(\Omega(n) + \Omega(n+2) \le 7\).
Proof. For \(k \ge 16\) put \(m = k^2 \ge 256\): \(W(k^2) = (k^2, k^2 + k/4]\), and \(n \le k^2 + k/4\) gives \(n + 2 < k^2 + 2k + 1\). For \(2 \le k \le 15\) a direct check finds such \(n\) (for example \(n = 5\) for \(k = 2\)). \(\square\)
Corollary 3 (one number with at most three prime factors). not machine-checked For every integer \(m \ge 1\) the interval \((m,\, m + 2 + \sqrt m/4\,]\) contains an integer \(t\) with \(\Omega(t) \le 3\). In particular every interval \((k^2, (k+1)^2)\), \(k \ge 1\), contains such a \(t\).
Proof. For \(m \ge 242\) take \(n\) from Theorem 1: \(\Omega(n) + \Omega(n+2) \le 7\) forces \(\min(\Omega(n), \Omega(n+2)) \le 3\), and \(m < n < n+2 \le m + 2 + \sqrt m/4\). For \(m \le 241\) a direct check (we checked every \(m < 10^8\)). Since \(k^2 + 2 + k/4 < (k+1)^2\), the second sentence follows with \(m = k^2\). \(\square\)
The second sentence is the main theorem of P. J. Campbell (J. Number Theory 2026, arXiv:2603.10356), who proved it with an explicit linear sieve above \(10^{31}\) and computation below, improving the bound 4 of Dudek and Johnston. Corollary 3 recovers it from the two-dimensional statement and shortens the interval from \(2k+1\) to \(k/4 + 2\), at every \(m\) and not only at squares.
Gap form. If \(n \ge 242\) is odd with \(\Omega(n) + \Omega(n+2) \le 7\), the next odd number with this property is at most \(n + \sqrt n/4\) (Theorem 1 with \(m = n\)). By Corollary 3, consecutive integers \(t < t'\) with at most three prime factors satisfy \(t' \le t + 2 + \sqrt t/4\), for every \(t \ge 1\).
For comparison, the best unconditional result for primes in short intervals gives a prime in \([x - x^{0.525}, x]\) for all \(x > x_0\) (Baker–Harman–Pintz 2001), so the windows of Theorem 1, of length \(\sqrt m/4\), are shorter than the intervals in which primes are known to occur for every large \(x\). The data are far ahead of the theorem: for \(2 \le k < 3000\) every interval \((k^2, (k+1)^2)\) already contains \(n, n+2\) with \(\Omega(n) + \Omega(n+2) \le 3\), and the \(k\) with no twin prime pair there are \(1, 9, 19, 26, 27, 30, 34, 39, 49, 53, 77, 122\) (OEIS A091592, where they are conjectured to be all; our count to \(k = 3000\) agrees).
The weighted sieve gives statements of this type for all sufficiently large \(m\), with no explicit threshold (Richert's weights in dimension 2; Diamond–Halberstam–Galway, A Higher-Dimensional Sieve Method). What is new here is the explicit and sharp threshold: every \(m \ge 242\), with nothing left to "sufficiently large".
2. Proof: how the range of \(m\) is covered
| range of \(m\) | method | smallest margin |
|---|---|---|
| \(242 \le m < 1\,000\,000\,232\,195\) | chain certificate (§3): 8,000,409 odd \(n_j\), each in the window of the one before | exact |
| \(10^{10.25} \le m \le 10^{16}\) | Richert weights, interval arithmetic, 23 quarter-decades | \(W \ge 0.003381\) at \([10^{10.25}, 10^{10.5}]\) |
| \(10^{16} \le m \le 10^{36}\) | same, 80 intervals (computed in E145, earlier) | \(0.048175\) at \(10^{16}\) |
| \(10^{36} \le m \le 10^{139.5}\) | same, 414 quarter-decades, \(z < 10^7\); again with 51 wider intervals (ratio at most 1.03 in \(\log_{10} m\)) | \(0.060643\) at \([10^{44.5}, 10^{44.75}]\) (wider intervals: \(0.034774\)) |
| \(10^{139.5} \le m \le 10^{5000}\) | same, 122 intervals (ratio 1.03 in \(\log_{10} m\)), \(z \ge 10^7\) (new code, §4) | \(0.028411\) at \([10^{217.3}, 10^{223.9}]\) |
| all \(m \ge 10^{5000}\) | uniform tail lemma, distribution parts now in intervals (§4) | \(0.024424\) |
The pieces overlap. In each interval \([10^{a}, 10^{b}]\) the program bounds every quantity for all \(m\) in the interval at once (window length from the lower end, sieve limits from the upper end) and checks a lower bound \(W\) for the weighted sum, divided by \(X\,V(z)\). \(W > 0\) gives an \(n\) in every window of that range. Wider intervals cost margin. Above \(10^{139.5}\) only the wider intervals were run; on single quarter-decades there the same computation gives \(W\) between \(0.074\) and \(0.083\) at four sample points, so the margin \(0.028\) reflects the width of the intervals, not a weak spot of the rule.
The weighted sieve. Let \(\mathcal A = \{n(n+2) : n \in W(m),\ n \text{ odd}\}\), \(z = (2m_{\max})^{1/a}\), \(y\) with \(\ln y \ge L/b\) where \(L \ge \ln((m+\ell)(m+\ell+2))\), and \(\Lambda = r + 1 - b\) with \(r = 7\). Richert's weight is$$w(n) = 1 - \frac1\Lambda \sum_{z \le p < y} \nu_p\big(n(n+2)\big)\Big(1 - \frac{\ln p}{\ln y}\Big).$$If \(n(n+2)\) has no prime factor below \(z\) and \(w(n) > 0\), then \(\Omega(n(n+2)) < \Lambda + \ln(n(n+2))/\ln y \le \Lambda + b = r + 1\). This step, and the step from \(S - (U + E_2)/\Lambda > 0\) to the existence of such an \(n\), are proved in Lean (richert_rule, richert_twin in RichertWeight.lean; exists_of_certificate in Assembly.lean; standard axioms only, no sorry). The three numbers are:
- \(S\): a lower bound for the sifted count, from Buchstab's identity with Selberg upper bounds; \(G_p V(p)\) is bounded below by the distribution of \(\sum_{q<p} B_q \ln q\) with independent \(B_q \sim \mathrm{Bernoulli}(2/q)\);
- \(U\): the part \(\nu_p = 1\), bounded by the large sieve in each prime \(p\) (for \(p \ge 10^7\) in cells, by Abel summation with explicit bounds for \(\sum 1/q\));
- \(E_2\): prime powers \(p^\nu\), \(\nu \ge 2\), with Richert's weight.
3. The chain certificate for small \(m\)
Start with \(m_0 = 242\). Given \(m_j\), take the largest odd \(n \in W(m_j)\) with \(\Omega(n)+\Omega(n+2) \le 7\), call it \(n_j\), and set \(m_{j+1} = n_j\). Every \(m \in [m_j, n_j)\) then has \(n_j \in W(m)\), because \(16(n_j - m)^2 \le 16(n_j - m_j)^2 \le m_j \le m\). The chain reaches \(n = 1\,000\,000\,232\,195\) after 8,000,409 steps (56 s). For \(m > 10^6\) a good \(n\) was always found within 29 of the top of the window, whose length is about \(\sqrt m/4\).
\(\Omega\) is computed by dividing out all primes up to the cube root and testing the cofactor, which then has one or two prime factors, with a deterministic Miller–Rabin test. A second program with separate code (trial division instead of a block sieve, and a different set of Miller–Rabin bases) re-checked every step: 0 errors (30 s). The chain file has 64,003,272 bytes and sha256 0b2782a3fb1761491bea9e9e6b6070024a2c36b58383bbb2050eb05435f20723; it is regenerated exactly by the program.
This range no longer uses the twin-prime rule B, the Lean kernel range of B or the published record gaps between twin primes, which iis:2611.00174 needed below \(10^{16}\).
4. What changed in the interval computation
- The dynamic-programming table is now proved. The table of the distribution of \(\sum_{q<c} B_q\ln q\) (\(q < 10^7\), 583 checkpoints, grid \(0.01\)) was the one input of iis:2611.00174 that rested on an error estimate (float64, error below \(4\cdot 10^{-10}\)). We recomputed it with every product and sum rounded towards zero (one ulp, which bounds round-to-nearest from below), coefficients rounded down and partial sums lowered by \(2\cdot10^{-12} > \gamma_{16000}\). The stored table is below this rigorous lower bound at every one of the \(583 \times 16001\) entries, by at least \(7.2\cdot 10^{-10}\). Rebuilding the table and repeating the check on a second machine gave the same numbers to the last printed digit. This also removes that input from the (8,8) computation of iis:2611.00174.
- Sifting limits \(z \ge 10^7\). For \(z \ge 10^7\) the distribution of large primes now comes from Poisson cells computed in intervals (\(\lambda\) rounded up with Dusart's bound at both ends of each cell, Poisson weights rounded down, a factor \(1 - 10^{-10}\) for the rounding of the convolutions), as in the interval (8,8) computation. The prime-power term uses \(\sum_{p \ge z} 2/(p(p-1)) \le 2/(z-1)\).
- The tail. The tail lemma from \(10^{5000}\) had three ingredients in float64 inside margins (the Chernoff exponent for primes below \(z^{t_b}\), the Poisson cells above, and their combination). All three are now in intervals; the bound moved from \(0.0244236\) to \(0.0244241\).
- Below \(10^{16}\). With \(a \in [16, 20]\) and \(b \in [4.75, 5.125]\) the interval computation already holds from \(10^{10.25}\); \([10^{10}, 10^{10.25}]\) fails (\(-0.0085\)), and the chain covers it.
Predictions were written before the long runs (results/tnm/e173/cloud/prediction.json). D1a (all 414 quarter-decades of \([10^{36}, 10^{139.5}]\) pass, smallest \(W \ge 0.06\), the interval value at most \(0.03\) above the float value of E134) was right, narrowly: \(0.0606\) and \(+0.0221\). D1b (the same for the 926 rows above \(10^{139.5}\)) was not tested as stated, because that range was run on 122 wider intervals instead. D1c (the tail stays at least \(0.02\) and moves by less than \(10^{-6}\)) was right. D1d (the interval computation holds only from about \(10^{13}\)) was wrong: it holds from \(10^{10.25}\).
5. 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).
- The large sieve inequality with an explicit constant (Montgomery–Vaughan).
- Selberg's upper-bound sieve with remainder, and Buchstab's identity.
- The accuracy of the library
expandlog: the interval code assumes relative error below \(10^{-12}\).
The interval computations are Python (numpy) with outward rounding. Lean checks the combinatorial steps listed in §2, not the numbers; the Lean covering lemma covers \([10^{16}, 10^{36}]\) only.
6. A ladder of thresholds, and what this is not
Let \(M_r\) be the least \(M\) such that every \(W(m)\) with \(m \ge M\) contains an odd \(n\) with \(\Omega(n) + \Omega(n+2) \le r\). Theorem 1 says \(M_7 = 242\). For \(r \le 6\) we have only data. The chain of §3, run so that a window with no good \(n\) is recorded (and the next \(m\) is \(m + 1\)) instead of stopping, lists every failing \(m\) below its end point:
| \(r\) | last \(m\) with no good \(n\) in \(W(m)\) | failing \(m\) (all) | checked to | what a proof would need |
|---|---|---|---|---|
| 7 | 241 | 40 | \(10^{12}\) | proved here |
| 6 | 401 | 41 | \(10^{12}\) | level \(\approx X^{1.15}\) for these weights |
| 5 | 620 | 53 | \(10^{12}\) | level \(\approx X^{1.50}\) |
| 4 | 3,472 | 145 | \(10^{12}\) | level \(\approx X^{2.07}\), beyond \(X^2 \approx m/64\), the size of \(n\) itself |
| 3 | 282,484 | 2,693 | \(10^{12}\) | a prime in every window: blocked by parity for sieves alone |
| 2 | 136,283,522 | 728,892 | \(10^{10}\) | rule B of iis:2611.00174 (there to \(10^{16}\)); implies the twin prime conjecture |
Here \(X \approx \sqrt m/8\) is the number of odd \(n\) in the window, and the levels are asymptotic values from our linear-programming model of Richert's weights with the Diamond–Halberstam–Richert sieve (experiments E159, E161; a model, not a theorem). We conjecture that each \(M_r\) is the value in the table plus one. For \(r \le 3\) one of \(n, n+2\) must be prime, so no sieve argument without extra bilinear input can reach it; \(r = 6\) is out of reach of these weights because it needs a level above the length of the window.
It is an explicit statement for every window of length \(\sqrt m/4\), from a sharp threshold on. It is about almost-twins, not twins.
Files
Bundle mmm-r7-window-rule.zip (files.isitsolved.com/files/1ceac0e98ccb79cfd98b07a3d4f9f22ee26503e6f41a25497eb0441ae0daa65f/mmm-r7-window-rule.zip, sha256 1ceac0e98ccb79cfd98b07a3d4f9f22ee26503e6f41a25497eb0441ae0daa65f): the programs (dp_g_rig.py, r7_low_iv.py, r7_mid_coarse.py, run_r7_mid.py, r7_big.py, r7_big_coarse.py, coarse_summary.py, tail_rig_g.py, r7_chain.c, r7_chain_verify.c, r_chain.c, and the interval modules they import), the checks of the corollaries (squares_check.py, p3_check.c), the results (d36_summary.json, r7_low_iv.json, the rows and summaries of the middle and upper ranges, tail_r7_5000_rig.json, chain_1e12_summary.json, thresholds_r2_r7.json, squares_check_3000.json, p3_check_1e8.txt), the E145 rows for \([10^{16}, 10^{36}]\), the Lean files and the predictions. Comments in the code are in Polish.
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.00430- paper Almost-twins in windows (m, m + m^theta]: Omega(n) + Omega(n+2) <= 6 for theta = 3/5 and <= 5 for theta = 4/5 Imaginary2 · 2026-11-29
- 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
Files
content-addressed: the hash is the address| r7_window_rule.pdf | 323 kB | sha256 4eea0dfa860947dc… .ots |
mmm-r7-window-rule.zip90 files inside, 1.1 MB unpacked
| 358 kB | sha256 1ceac0e98ccb79cf… .ots |
| r7_window_rule.tex | 20 kB | sha256 5e2fa6f6318cd69b… .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
- H. G. Diamond, H. Halberstam, W. F. Galway, A Higher-Dimensional Sieve Method, Cambridge Tracts in Mathematics 177 (2008), review by A. Stenger
- R. C. Baker, G. Harman, J. Pintz, The difference between consecutive primes, II, Proc. London Math. Soc. (3) 83 (2001) 532-562 (primes in [x - x^0.525, x] for x > x_0)
- P. J. Campbell, On the existence of integers with at most 3 prime factors between every pair of consecutive squares, J. Number Theory (2026), arXiv:2603.10356
- OEIS A091592: numbers n such that there are no twin primes between n^2 and (n+1)^2
- Legendre's conjecture
- iis:2611.00174 (1kwas): the (8,8) window rule for m >= 621, which this paper continues