Research

Two regularities of the primes that can be predicted

Twin primes in short intervals, and primes along the curves n² + k, are spread more evenly than a lottery would spread them. In both cases we computed how much more evenly, starting from the Hardy–Littlewood conjectures and without fitting any number to the data, and the computation matches what we measured.

Draft for review · not peer reviewedBy Zahit RiosUpdated November 2026

Context

If primes fell at random with their known density, 1/ln x, the number of primes in an interval would behave like a Poisson variable: its variance would equal its mean. That is what Cramér's model gives, and for very short intervals, of order ln x, it is what is expected to happen [4].

In longer intervals it does not happen. Montgomery and Soundararajan [1] showed, assuming a strong form of the Hardy–Littlewood conjecture [2], that in an interval of length H the variance drops from H·ln x to H·ln(x/H): primes are spread more evenly than a lottery. If H = x^δ, the variance is a fraction 1 − δ of that of chance.

In this project we look at one specific interval: the one from n² to (n + 1)², which in the Vogel sunflower [7] is the ring between two consecutive integer radii. There H = 2n and x = n², that is, δ = ½. Legendre's conjecture says this interval is never left without primes.

We call relative variation, V, the variance of a count divided by its mean. For a Poisson process, V = 1. Everything that follows is about values of V below 1.

Formula
V=Var(T)E(T)
Definition: T is the count (of primes, or of pairs) in each interval or on each curve.

What was already known: primes per ring

For the primes of ring n, Theorem 3 of [1] gives the formula below, with the constant 1 − γ − ln 2π read at the point x = n². We checked it up to ring 3·10⁶ (numbers close to ten trillion): on 90,000 consecutive rings the counts behave like a bell curve with that variance.

The theorem covers intervals of length up to √x and the ring is 2√x long, right at the edge; using it there is an extrapolation that the measurements support. This result is not ours: it is the starting point.

Formula
V=12−ln2+γ+ln2π−12lnn≈12−1.054lnn

Result 1 · Twin prime pairs in short intervals

Statement

Let T be the number of twin prime pairs (p, p + 2) with p in the interval from n² to (n + 1)². As n varies, the relative variation of T is below 1 and follows the formula below, which tends to 7/8.

Formula
V=1−0.1216ln22n+0.7563ln2n+0.215ln2n
Relative variation of twin pairs in ring n.
The naturals in order on the Vogel sunflower, with twin primes highlighted. Each ring between two circles is an interval from n² to (n + 1)²; the red circles mark the squares.

Where it comes from

The mean of T is given by the Hardy–Littlewood conjecture for pairs: 𝔖₂·H/ln² x, with 𝔖₂ = 2C₂ ≈ 1.32032 and H = 2n.

The variance requires knowing how often two twin pairs appear at distance h from each other, that is, how often p, p + 2, p + h and p + h + 2 are all prime. Hardy and Littlewood give that frequency as 𝔖₄(h)/ln⁴ x, where 𝔖₄(h) is the singular series of the quadruple (0, 2, h, h + 2). If the pairs were independent it would be 𝔖₂²; the difference is the correlation.

Summing over all distances inside the interval gives the expression below. It is the same computation Montgomery and Soundararajan carry out for primes [1], one level up: there the singular series involve two primes and here four.

Formula
V=1+2𝔖2ln2x∑h=1H(1−hH)(𝔖4(h)−𝔖22)
x = n², H = 2n. 𝔖₄(h) is the Hardy–Littlewood singular series of (0, 2, h, h + 2).

As far as we know the sum has no closed form. We evaluated it numerically for H from 10³ to 2·10⁷ and it behaves like a second-degree polynomial in ln H. Substituting it gives the final formula. Its three coefficients come from that computation with singular series; none was fitted to prime counts.

The leading coefficient of the sum, divided by 𝔖₂, should be −¼ if the rule below is true. Extending the computation to H = 2·10⁸, second differences give −0.253 on average.

Checks

Relative variation of twin pairs per ring

Try it in the explorer
0.60.70.80.91.010²10³10⁴10⁵10⁶10⁷n7/8
Line: the formula. Amber dots: measured on this page (rings 35–999). Blue dot: measured off-site near ring 10⁶. Dashed line: the limit 7/8.
39,000 consecutive rings, from 1,000 to 40,000
Measured standard deviation over predicted: 0.999. Unusual rings show up as often as a bell curve says.
26 stretches around ring 10⁶
Measured 0.806 ± 0.007; the formula gives 0.807.
Pairs at distance 6 instead of 2
The term for the triple (p, p + 6, p + 12), which can occur, must be added. Predicted 0.86; measured 0.859 ± 0.011.
Intervals that do not start at a square
Shifting the interval by 1, 9, 49, 99 or 999 places, or by half a ring, the variation measured between rings 1,000 and 20,000 does not change: 0.73–0.78 for twins (the formula gives 0.74–0.77) and 0.36–0.40 for primes (0.36–0.39). The result does not depend on squares.
Rings 35 to 999, computed on this page
The three bars of the chart: 63, 67 and 71%; the formula gives 60, 67 and 71% at the centre of each band.

Other prime tuples

The same computation works for any pattern of primes: the quadruple is replaced by the corresponding doubled tuple and, when two copies of the pattern can share a prime, the term for that overlap is added. We tried it on pairs at distance 4 and 6 and on two triple patterns, using the exact sum for each ring instead of the fitted formula.

All five predictions fall within the measurement error or within twice it. For triples the variation is 0.92 to 0.96: they are closer to chance than pairs, as the rule requires, although this is not enough to pin down the limit.

PatternRings 3,000–8,000PredictedRings 8,000–20,000Predicted
(p, p + 2)0.770 ± 0.0150.7630.775 ± 0.0100.776
(p, p + 4)0.756 ± 0.0150.7640.765 ± 0.0100.775
(p, p + 6)0.873 ± 0.0170.8430.849 ± 0.0110.849
(p, p + 2, p + 6)0.917 ± 0.0180.9370.958 ± 0.0120.941
(p, p + 4, p + 6)0.925 ± 0.0180.9370.933 ± 0.0120.941

Audit

Before publishing this page we repeated everything with code written afresh. The sieve matches the published tables exactly: 78,498, 664,579 and 5,761,455 primes and 8,169, 58,980 and 440,312 twin pairs below 10⁶, 10⁷ and 10⁸.

The sum of singular series, computed by a different route (local factors with trial division), gives the same values. The fitted formula departs from the exact sum by less than 0.006 between rings 1,000 and 20,000. And measuring with the theoretical mean instead of the mean of neighbouring rings, the variation of twins comes out 0.729, 0.770 and 0.775 on three bands, where the exact sum gives 0.746, 0.763 and 0.776.

The limit and the rule

Since the leading coefficient is −¼·𝔖₂, the formula tends to 1 − ⅛·(ln H / ln n)². With H = x^δ that is 1 − δ²/2, and for the ring (δ = ½) it gives 7/8. We also computed it for pairs at distance 4, 6 and 30, with the same limit.

Convergence is very slow: 0.81 near 10⁶, 0.83 near 10⁹, 0.86 near 10²⁰. The limit cannot be measured directly; what can be measured is the full formula, with its lower-order terms.

For primes the rule is 1 − δ [1]; for pairs, 1 − δ²/2. For triples it would be 1 − δ³/6, but the computation could not settle it: the coefficient that should be −0.083 comes out between −0.064 and −0.128 depending on the range.

Formula
V→1−δ22

Result 2 · Primes along the curves n² + k

Statement

Let T(k) be the number of primes of the form n² + k with n in a stretch from N to F·N. The Bateman–Horn conjecture [3] says that T(k) is, on average, C(k)·X, where C(k) is a constant depending on k and X is the sum of 1/ln n² over the stretch. As k varies, T(k) strays from that count less than a lottery would: the relative variation is 0.40–0.43 for F = 2, does not depend on N and drops as F grows.

Why curves

In the Sacks spiral (radius √v and one turn per square) the squares line up and the primes gather along curves. Each of those curves is a polynomial n² + k or n² + n + k. The best known is Euler's, n² + n + 41, whose first 40 values are all prime.

Bateman and Horn [3, 5] predict how many primes each curve has. There are proved results that almost every curve has the expected primes [6]; that is about the mean. Here we ask about the variance: how far they stray.

The naturals on the Sacks spiral, with the values of n² + n + 41 highlighted: they form one of the curves.

Where it comes from

Two values on the same curve, n² + k and m² + k, lie m² − n² apart. Averaging over k, the Hardy–Littlewood conjecture for pairs says both are prime with frequency 𝔖(m² − n²)/(ln n²·ln m²), where 𝔖(h) is the singular series of pairs at distance h (it is 0 when h is odd).

On the other hand, the Bateman–Horn prediction for each curve already explains part of that correlation through C(k). What it explains is the second moment of the constants, c₂ = E[C(k)²], which is computed as a product over the primes.

Subtracting one from the other leaves the expression below. The average of 𝔖(m² − n²) over the pairs (n, m) is exactly c₂, prime by prime, so the leading term cancels. What remains is negative, and that is the regularity.

Formula
V=1+1X[∑n≠mwnwm𝔖(m2−n2)−c2X2]
wₙ = 1/ln n², X = Σ wₙ; the sum runs over the pairs n ≠ m of the stretch.
Formula
c2=∏p>2[1p+p−12p·(1−2p)2+1(1−1p)2]
Second moment of the Bateman–Horn constants of n² + k averaged over k: c₂ ≈ 1.29573.
Formula
𝔖(h)=2C2∏q|h,q>2q−1q−2
Singular series of prime pairs at even distance h; C₂ ≈ 0.66016 is the twin prime constant.

The sum is evaluated numerically; we have no closed form. Unlike the twin case, there is no intermediate fit here: the prediction is the sum as it stands.

Checks

Relative variation along curves by length of the stretch

Try it in the explorer
0.300.350.400.450.50×1.25×2×4×8×16×32F
Line and amber dots: prediction. Blue dots: measurement, with its error. The horizontal axis is F, the ratio between the end and the start of the stretch.

By length of the stretch

StretchPredictedMeasured
N → 1.25 N0.4670.465
N → 1.5 N0.4520.438
N → 2 N0.4030.410
N → 4 N0.3740.367
N → 8 N0.3590.338
N → 16 N0.3250.325
N → 32 N0.3250.311

Measured over 3,000 curves (k from 1 to 3,000), with N between 1,000 and 8,000; the error of each measurement is ≈ 0.01. The mean difference between predicted and measured is −0.008.

By size, with the stretch fixed from N to 2N

NMeasuredError
3,0000.406± 0.023
10,0000.425± 0.019
30,0000.425± 0.019
100,0000.431± 0.019
300,0000.423± 0.024

Up to 1,000 curves per row. This table uses a slightly different average (the variance of each curve's deviation divided by its own expected count), which gives values ≈ 0.01 higher than the previous table's. The prediction for stretches from N to 2N ranges from 0.40 to 0.43 depending on N.

Other families of curves

The derivation uses nothing specific to n² + k, so we repeated it with n² + n + k and with 2n² + k, using new code. In all three the prediction, averaged over 21 neighbouring sizes, matches the measurement to within 0.01. One caveat is worth stating: evaluated on an exact stretch, the prediction wobbles depending on where the stretch starts and ends (the “wobble” column), while the measurement is stable. We do not fully understand that sensitivity to the endpoints; that is why we compare averages.

FamilyPredicted (average)WobbleMeasured
n² + k0.414± 0.0090.411
n² + n + k0.377± 0.0350.384
2n² + k0.399± 0.0170.393

Computed on this page

With 1,000 curves and n up to 1,000, for stretches from 800 to 1,000, from 500 to 1,000 and from 250 to 1,000: measured 47, 36 and 29%; predicted 46, 37 and 31%.

In a first comparison the prediction sat 0.02–0.04 below the measurement. The mistake was ours: we measured with one average and predicted with another. With the same average on both sides the difference disappears. We keep the note because it is the kind of error a reviewer should look for.

What is missing and what could be wrong

We do not know whether it is new.
We searched general search engines and arXiv, not MathSciNet or zbMATH. These computations may exist in a paper or thesis we did not find, or be a known exercise to a specialist.
Everything is conditional.
Both predictions assume the Hardy–Littlewood and Bateman–Horn conjectures with small error terms. We prove nothing; we check numerically that the consequences hold.
The ring sits at the edge.
The theorem in [1] holds for intervals of length up to √x; the ring is 2√x long. For pairs we know of no equivalent theorem: we apply the same reasoning without that guarantee.
The twin formula has an intermediate fit.
The coefficients 0.1216, 0.7563 and 0.215 come from fitting a polynomial to the sum of singular series. The first should be exactly ⅛ and the fit gives 0.1216; we cannot express the other two in closed form.
Closed forms are missing.
Neither the twin sum nor the curve sum is solved analytically. In [1] the secondary term is obtained through an analysis we did not carry out here.
The computation is our own.
Sieves and sums written for this project, in double precision. Only prime and twin counts on small ranges were checked against external tables.

What we would like to learn from a reviewer

  1. Is the variance of prime pairs in short intervals, or the rule 1 − δ²/2, published?
  2. Is the variance, averaged over k, of the number of primes n² + k published?
  3. Is it legitimate to read Theorem 3 of [1] at H = 2√x? Does any extra term appear at that edge?
  4. Do the two sums have closed forms?

References

  1. [1]H. L. Montgomery, K. Soundararajan. Primes in short intervals. Communications in Mathematical Physics 252 (2004), 589–617 · arXiv:math/0409258.
  2. [2]G. H. Hardy, J. E. Littlewood. Some problems of ‘Partitio numerorum’; III: On the expression of a number as a sum of primes. Acta Mathematica 44 (1923), 1–70.
  3. [3]P. T. Bateman, R. A. Horn. A heuristic asymptotic formula concerning the distribution of prime numbers. Mathematics of Computation 16 (1962), 363–367.
  4. [4]P. X. Gallagher. On the distribution of primes in short intervals. Mathematika 23 (1976), 4–9.
  5. [5]S. L. Aletheia-Zomlefer, L. Fukshansky, S. R. Garcia. The Bateman–Horn conjecture: heuristics, history, and applications. Expositiones Mathematicae 38 (2020) · arXiv:1807.08899.
  6. [6]F. Balestrieri, N. Rome. Average Bateman–Horn for Kummer polynomials. Acta Arithmetica 207 (2023) · arXiv:2005.11835.
  7. [7]H. Vogel. A better way to construct the sunflower head. Mathematical Biosciences 44 (1979), 179–189.