6
Views
0
CrossRef citations to date
0
Altmetric
Research Article

Gaps Between Consecutive Primes and the Exponential Distribution

ORCID Icon

Abstract

Based on the primes less than 4×1018, Oliveira e Silva et al. (Math. Comp., 83(288):2033–2060, 2014) conjectured an asymptotic formula for the sum of the kth power of the gaps between consecutive primes less than a large number x. We show that the conjecture of Oliveira e Silva holds if and only if the kth moment of the first n gaps is asymptotic to the kth moment of an exponential distribution with mean logn, though the distribution of gaps is not exponential. Asymptotically exponential moments imply that the gaps asymptotically obey Taylor’s law of fluctuation scaling: variance of the first n gaps ∼ (mean of the first n gaps)2. If the distribution of the first n gaps is asymptotically exponential with mean logn, then the expectation of the largest of the first n gaps is asymptotic to (logn)2. The largest of the first n gaps is asymptotic to (logn)2 if and only if the Cramér-Shanks conjecture holds. Numerical counts of gaps and the maximal gap Gn among the first n gaps test these results. While most values of Gn are better approximated by (logn)2 than by other models, seven exceptional values of n with Gn>2eγ(logn)2 suggest that lim supnGn/[2eγ(logn)2] may exceed 1.

2020 MATHEMATICS SUBJECT CLASSIFICATION:

1 Introduction

The gaps between consecutive prime numbers have been studied mathematically, numerically, and statistically by many people for centuries [Citation4, Citation8–10, Citation13, Citation16, Citation17, Citation19–21, Citation23–25, Citation28, Citation29, Citation32, Citation38–42]. This list of references is far from complete. Many questions remain open. Throughout, we use gap to mean a difference, denoted d, between consecutive primes, including d4:=p5p4=117=4 and excluding p4p2=73=4, where pn is the nth prime, p1=2.

We do not attempt to summarize here everything that is currently known about the distribution of prime gaps. Some selected recent results and conjectures are pertinent. Heath-Brown [Citation21, p. 87] conjectured a simple asymptotic expression for the sum of the squares of the gaps of the primes not exceeding a large real x (OEIS A074741). Wolf [Citation39, Conjecture 5] conjectured an alternative asymptotic form and compared the two alternatives numerically. Based on a detailed numerical study of the primes less than 4×1018, Oliveira e Silva [Citation28, p. 2056] conjectured a simple asymptotic formula for the sum of the kth power of the gaps of primes less than x as x, for every k=1,2,. Wolf [Citation41] refined and extended the conjectured asymptotic expressions of Oliveira e Silva and compared the alternatives analytically and numerically. Firoozbakht conjectured that the sequence (pn1/n)nN decreases as n increases [Citation38]. The conjecture holds for all primes less than 2641.84×1019 as of April 2024 [Citation38]. Kourbatov [Citation23] showed that Firoozbakht’s conjecture implies an upper bound on all gaps. Maier [Citation24] showed that chains of consecutive large gaps exist, and that average gaps of primes in short intervals do not converge (contrary to previous conjecture) but have a limsup strictly greater than the liminf [Citation25].

What is new here? We consider the first n=1,2, gaps instead of the gaps of primes less than large x (Section 3). This change of scale enables us to show (Theorem 3) that the conjecture of Oliveira e Silva holds if and only if, for every k=1,2,, the kth moment of the gaps (that is, the sum of the kth power of the first n gaps, divided by n) is asymptotically (as n) the kth moment k!(logn)k of an exponential distribution with mean logn.

Obviously the distribution of gaps is not exponential because an exponential random variable has a continuous density function on [0,), whereas gaps are positive integers only and all gaps except d1=p2p1=32=1 are even integers. Gaps are also not geometrically distributed (the integer-valued analog of the exponential) because a geometric distribution would give positive probability to all odd positive integers. Despite these deviations from the exponential distribution at a microscopic scale, the numerically supported conjecture that the kth moment of the first n gaps is asymptotically the kth moment k!(logn)k of an exponential distribution with mean logn has interesting consequences, as we now summarize and then show in detail.

From Theorem 3, it follows (Corollary 4) that, as n, the ratio of the variance of the first n gaps to the square of the mean of the first n gaps converges to 1 (Section 4). Thus the gaps have a power-law asymptotic variance function [Citation1, Citation2, Citation11, Citation34–36] or, equivalently, asymptotically obey Taylor’s law of fluctuation scaling: variance of the first n gaps ∼ square of the mean of the first n gaps [Citation4, Citation6, Citation7, Citation12, Citation14, Citation33]. Moreover (Section 6), Taylor’s law (with a different coefficient and a different exponent) also describes the variance function of the maximal gap among the first n gaps if the maximal gap may be modeled as the largest order statistic of n observations of an exponential distribution with mean logn: variance of the maximal order statistic (π2/6)× mean of the maximal order statistic. These (conjectured) scaling laws do not appear to have been noticed previously.

The Cramér-Shanks conjecture (Cramér [Citation8, pp. 24, 27], Shanks [Citation32, p. 648, his EquationEq. (5)], Granville [Citation17, p. 21, his EquationEq. (14)]) proposes that the maximal gap of primes less than x is asymptotic to (logx)2 as x (Section 6). Using the exponential distribution as a heuristic model of the gaps, we show (Theorem 5) that the Cramér-Shanks conjecture holds if and only if the largest of the first n gaps is asymptotic (as n) to the expectation (logn)2 of the largest order statistic of a sample of n independent observations from an exponential distribution with mean logn. However, the (11/n)-quantile of the largest order statistic of a sample of n independent observations from an exponential distribution with mean logn yields 2(logn)2 as an asymptotic estimate of the largest of the first n gaps. This estimate exceeds the Cramér-Shanks conjecture and Kourbatov’s bound [Citation23] on gaps derived from Firoozbakht’s conjecture.

In the concluding Section 7, we compare asymptotic expressions (derived from the exponential model of prime gaps and from other conjectures) for moments and maximal gaps with exact numerical results derived from public sources. Numerical evidence supports the moments of an exponential distribution with mean logn as models of the moments of the first n gaps and questions (logn)2 as an asymptotic description of the largest of the first n gaps.

2 Definitions and background

For any natural number nN:={1,2,}, let pn be the nth prime starting from p1=2, p2=3 (OEIS A000040). Let P:={p1,p2,} be the set of primes. Define the nth gap dn between consecutive primes (OEIS A001223) and the sum Dk(x) of the kth power, k{0}N, of the gaps between consecutive primes that do not exceed real x to be (1) dn:=pn+1pn, nN,(1) (2) Dk(x):=pn+1xdnk.(2)

We shall say that dn is the gap of pn if and only if (Equation1). For example, the gap of 17 is 2.

Let π(x):=#{pP|px} be the number of primes that do not exceed real x2 (OEIS A000720 gives π(x) evaluated at positive integral values of x). Obviously π(pn)=n and pπ(x)=max{pnP|pnx}. For 2<a<b, the number of primes in the interval (a,b] equals π(b)π(a). Those primes are pπ(a)+1,,pπ(b) and the gaps of those primes are dπ(a)+1,,dπ(b). Then (3) dπ(a)+1++dπ(b)1:=L1<L:=ba<L2:=dπ(a)+1++dπ(b).(3)

Some authors define the number of the gaps of the primes in (a,b] to be N1:=π(b)π(a)1 (excluding gap dπ(b) because pπ(b)+1>b) and some authors define it to be N2:=π(b)π(a) (including gap dπ(b)). Asymptotically, the difference in these definitions is immaterial.

If f(x) and g(x) are real-valued functions of real x and g(x) > 0 for all x sufficiently large, define f(x)g(x) to mean that f(x)/g(x)1 as x. In Riesel’s [Citation29, p. 61] cautious notation, define f(x)cg(x) if f(x)g(x) is conjectured but not proved. Likewise, =c will denote a conjectured but unproved equality.

Oliveira e Silva [Citation28, p. 2056] conjectured that (4) Dk(x)ck! x(logx)k1,k1.(4)

The prime number theorem states: (5) π(x)xlogx as  x or equivalently pnnlogn as n.(5)

Because π(x)x/logx if and only if logxx/π(x), and because x/π(x) is asymptotic to the average gap of the primes x, the prime number theorem (5) implies that the average gap of the primes x is asymptotic to logx. (Why? Because x is asymptotic to the sum of gaps of the primes x. Also π(x) is asymptotic to the number of gaps of the primes x, by either definition of that number N1 or N2 above. By definition, the average of the gaps of the primes x is the sum of gaps of the primes x divided by the number of gaps of the primes x. That ratio is asymptotic to x/π(x)=log(x).) As n, (Equation5) implies that pn/n. Taking logs of both sides gives logpnlogn but logpn/logn (logn+loglogn)/logn1.

Wolf [Citation41] remarked that, when k = 0, the right side of conjecture (Equation4) becomes x/logx as in the prime number theorem in (Equation5). When k = 1, (Equation2) simplifies to D1(x)=pπ(x)2 and (Equation4) asserts that D1(x)x, which is well known and, in any case, follows from Lemma 1. For k > 1, (Equation4) apparently remains unproved, though well supported numerically [Citation28, Citation41].

We shall use some elementary consequences of the prime number theorem (5).

Lemma 1.

The prime number theorem (5) implies (6) limnpn+1pn=1,(6) (7) limxxpπ(x)=1,(7) (8) limxlogπ(x)logx=1.(8)

Proof.

By (Equation5), (9) pn+1pn(n+1)log(n+1)nlogn1·1=1.(9)

This proves (Equation6). To prove (Equation7), observe that pπ(x)x<pπ(x)+1, hence 1x/pπ(x)<pπ(x)+1/pπ(x). As x, also π(x), so (Equation6) implies (Equation7). To prove (Equation8), take logarithms of (Equation5): logπ(x)logxloglogxlogx as x. □

Now we define an exponentially distributed random variable and state, mostly without proof, several of its well known properties. Let X be a nonnegative real-valued random variable with cumulative distribution function (cdf) F(x):=Pr{Xx}, x0. If there exists some λ>0 such that F(x)=1exp(λx), then X is exponentially distributed with scale parameter λ and we write X=dexp(λ).

Lemma 2.

Assume λ>0. For n > 1, let X and X1,,Xn be independently and identically distributed (iid) Exp(λ) random variables. Then:

  1. For any real c > 0, cX=dexp(λ/c).

  2. For real r>1, the rth moment of X is E(Xr)=Γ(r+1)/λr [Citation26, p. 28, EquationEq. (5)]. When rN, then Γ(r+1)=r!. Hence the expectation or mean of X is 1/λ and the variance of X is 1/λ2.

  3. Let the order statistics of X1,,Xn be X(1)X(n). Then [Citation30, p. 343] for i=1,,n, (10) E(X(i))=1λj=1i1nj+1=1λj=ni+1n1j,(10) (11) Var(X(i))=1λ2j=1i1(nj+1)2=1λ2j=ni+1n1j2.(11)

  4. The cumulative distribution function (cdf) of the smallest order statistic X(1) is (12) Pr{X(1)x}=1exp(nλx), x0,(12) i.e., X(1)=dexp(λn). For 0<q<1, let y1 be the (1q)-quantile of X(1). By definition, y1 satisfies q=Pr{X(1)>y1}=1Pr{X(1)y1}=exp(y1). Then (13) y1=(1/[])logq<+(1/[])(1/q1).(13) In particular, if q=1/n, then y1=+(1/[])logn.

  5. The cdf of the largest order statistic X(n) is (14) Pr{X(n)x}=(1exp(λx))n, x0.(14) For 0<q<1, let yn be the (1q)-quantile of X(n). By definition, yn satisfies Pr{X(n)>yn}=1Pr{X(n)yn}=q. Then (15) yn=(1/λ)log(1(1q)1/n)<+(1/λ)(lognlogq).(15) Proof. q=1(1exp(λyn))n, hence 1exp(λyn)=(1q)1/n and then λyn=log(1(1q)1/n). The inequality follows from (1q)1/n<1q/n. □

  6. [Citation18, p. 324, Ex. 9] By Lemma 2.1, λXn=dexp(1). Then (16) Pr{lim supnλXnlogn=1}=1.(16)

  7. Let Sn:=X1++Xn. Let random variables U1,,Un1 be iid uniformly on [0,1] and let U0:=0, Un:=1 with probability 1. Then (X1/Sn,X2/Sn,,Xn/Sn)=d(g1,g2,,gn):=(U(1)U(0),U(2)U(1),,U(n)U(n1)) ([Citation15, p. 75, III.3(e)] and [Citation18, p. 302, Ex. 42]).

  8. [Citation27] Large deviations: When a>1/λ, then (17) Pr{X1++Xnn>a}exp((1logλloga)n).(17)

3 Asymptotic moments of first n gaps are exponential

Define the kth moment (k>1) of the first n gaps to be (18) μk,n:=1nj=1ndjk.(18)

Thus if π(x)=n, then (Equation2) and (Equation18) give μk,n=Dk(x)/n.

Theorem 3.

The conjecture (Equation4) of Oliveira e Silva [Citation28, p. 2056] holds for each k{0}N if and only if the kth moment of the first n gaps is asymptotic to the kth moment of the exponential distribution Exp(1/logn) with mean logn: (19) μk,nck!(logn)k,n.(19)

Proof.

The cases k=0, k=1 are known to be true. Assume (Equation4) for k > 1. Using the definition (Equation2) and Lemma 1, replace x by pn+1 in (Equation4) to get (20) Dk(pn+1)ck! nlogn(log(nlogn))k1=k! nlogn(logn+loglogn)k1k! n(logn)k.(20)

Dividing both sides by n gives (Equation19).

Conversely, suppose the kth moment of the first n gaps is asymptotic to the kth moment of the exponential distribution Exp(1/logn). Then, working backward through the calculation in (Equation20), (21) nμk,n:=j=1ndjkk!n(logn)kk! nlogn(logn+loglogn)k1=k! nlogn(log(nlogn))k1cDk(pn+1).(21)

Again using Lemma 1 to replace pn+1 by x and nlognpnpn+1 by x gives (22) k! x(logx)k1cDk(x).(22)

4 Asymptotic variance function obeys Taylor’s power law

For nN, n2, define the mean and variance of the first n gaps as (23) mn:=1nj=1ndj=μ1,n,(23) (24) vn:=1n1j=1n(djmn)2=nn1(1nj=1ndj2mn2)=nn1(μ2,n(μ1,n)2).(24)

The central equality in (Equation24) holds because j=1n(djmn)2=j=1n(dj22djmn+mn2)=j=1ndj22j=1ndjmn+nmn2=j=1ndj22(nmn)mn+nmn2=j=1ndj2nmn2.

The variance function of gaps is the function f that satisfies vn=f(mn) [Citation1, Citation2, Citation11, Citation34–36]. The asymptotic variance function of gaps is a (not unique) function f that satisfies vnf(mn).

Corollary 4.

Conditional on the conjectures of Heath-Brown [Citation21], Wolf [Citation39], and (Equation4) of Oliveira e Silva [Citation28, p. 2056], (25) limnvnmn2=c1.(25)

Proof.

From (Equation19), (26) μ2,n(μ1,n)2c2.(26)

Hence (27) vn(μ1,n)2(μ2,n(μ1,n)21)c(μ1,n)2(21)=mn2.(27)

This power-law asymptotic variance function is the special case c=1, b=2 of Taylor’s law of fluctuation scaling vncmnb, c>0 [Citation4–7, Citation12, Citation14, Citation33]. These parameter values c=1, b=2 are consistent with the exponential distribution, in which the variance equals the square of the mean. However, a variance asymptotic to the squared mean does not imply an exponential distribution (e.g., a normal distribution with mean μ and variance μ2 has a variance equal to the squared mean).

5 An asymptotically exponential distribution of gaps is plausible

In a heuristic and numerical exploration, Yamasaki and Yamasaki [Citation42] “assume that the exponential distribution can be applied to the gaps of prime numbers. But the gaps [except for d1=1] are always even integers, so do not distribute continuously on [0,).” They proposed adjustments to the exponential distribution.

Conditional on a uniform version of the unproved prime r-tuple conjecture of Hardy and Littlewood [Citation20], Gallagher [Citation16] showed that, for λ>0, hλlogN, and nN, as N, the distribution of the values of π(n+h)π(n) converges to the Poisson distribution with parameter λ. Thus λ is the expectation and the variance of the number of primes over the interval (n,n+λlogN] of length λlogN, so the average gap is asymptotically logN. If the Poisson-distributed number of primes arrived in the interval (n,n+λlogN] according to a Poisson process, then the inter-arrival interval between successive primes (that is, the gap) would be exponentially distributed [Citation15, pp. 188, 378], Exp(1/logN).

Wolf [Citation40] gave strong numerical evidence [Citation40, p. 3, his ] and a heuristic argument [Citation40, p. 2, his EquationEq. (7)] that an exponential distribution with mean logn asymptotically approximates the distribution of the first n gaps. To circumvent the difficulty that the exponential distribution lacks the discreteness of the natural numbers, Wolf [Citation40, his EquationEq. (19), his Figure 5] proposed a rescaling that turns the discrete dn into a continuous variable.

Fig. 1 Moments μk,n (k=1,2,3,4) of the first n gaps between consecutive primes (solid dots) from k = 1 (bottom row) to k = 4 (top row); and corresponding kth moments (k=1,2,3,4) of exponential distributions Exp(1/logn) (solid lines). The dots and the lines are calculated independently with no adjustment of parameters.

Fig. 1 Moments μk,n′ (k=1,2,3,4) of the first n gaps between consecutive primes (solid dots) from k = 1 (bottom row) to k = 4 (top row); and corresponding kth moments (k=1,2,3,4) of exponential distributions Exp(1/ log n) (solid lines). The dots and the lines are calculated independently with no adjustment of parameters.

Our finding that, conditional on the conjecture (Equation4) of Oliveira e Silva [Citation28, p. 2056], the moments of the first n gaps are asymptotic to the moments of the exponential distribution, even though the gaps are not continuously distributed, is consistent with T. Stieltjes’s discovery in 1894 that the moments of the lognormal distribution do not uniquely specify the continuous probability distribution that produced the moments [Citation31, pp. 17–18, section 2.1].

We suggest it is plausible that the moments (Equation18) of the first n gaps are asymptotic to the moments of Exp(1/logn). First, the primes that do not exceed x are asymptotically uniformly distributed on [0,x] as x [Citation4]. To see why, choose any 0<r<1. Then, for large x, the number of primes not exceeding rx divided by the number of primes not exceeding x is asymptotically, by the prime number theorem (5), π(rx)/π(x)limx(rx/log(rx))/(x/logx)=r. (From a more general perspective, the asymptotic counting function π(x)x/logx of primes is regularly varying [Citation3] with exponent 1.)

Assume U1,,Un are iid uniform on [0,x]. The finding that the primes are asymptotically uniformly distributed on [0,x] [Citation4] suggests the order statistics U(1)U(n) of U1,,Un as a stochastic model of the asymptotic distribution of the primes on [0,x] and suggests the n “spacings” [Citation5, Citation22] gi:=U(i)U(i1), i=1,,n, with U(0):=0 almost surely, as a stochastic model of the first n gaps. The spacings are exponentially distributed (Lemma 2.7) and their average size is asymptotically logn. So the gaps between consecutive primes x are plausibly distributed as the spacings between consecutive order statistics of π(x) iid uniform random variables on [0,x], and these spacings are distributed as Exp(1/logn).

This stochastic model of the primes and gaps intentionally omits the discreteness of integers and the lack of independence of primes.

6 The largest of the first n gaps

What would the exponential model of gaps predict about the asymptotic behavior of the maximal gap, Gn:=max{d1,,dn}, among the first n gaps? Here we consider two possible answers.

Theorem 5.

For fixed n > 1, let Xi=dexp(1/logn), i=1,,n, be iid. Let γ0.5772 be the Euler-Mascheroni constant, ζ(·) the zeta function, and π2/61.6449. Then the mean and variance of the largest order statistic X(n) are (28) E(X(n))=(logn)j=1n1nj+1(logn)(γ+logn)(logn)2,(28) (29) Var(X(n))=(logn)2j=1n1(nj+1)2(logn)2ζ(2)=(logn)2π26.(29)

Thus Var(X(n))/E(X(n))π2/6>1 and Var(X(n))(π2/6)E(X(n)). The maximal gap illustrates Taylor’s law with c=π2/6, b=1.

Proof.

From Lemma 2.3, (30) E(X(n))=(logn)(1+12+13++1n)(logn)(γ+logn)(logn)2,(30) (31) Var(X(n))=(logn)2(1+122+132++1n2)(logn)2ζ(2)=(logn)2π26.(31)

The Cramér-Shanks conjecture may be stated as (32) maxpjx(pj+1pj)c(logx)2(logpπ(x))2.(32)

See Cramér [Citation8, pp. 24, 27], Shanks [Citation32, p. 648, his EquationEq. (5)], and the very helpful Granville [Citation17, p. 21, his EquationEq. (14)].

Theorem 6.

The Cramér-Shanks conjecture (Equation32) holds if and only if the maximal gap Gn:=max{d1,,dn} satisfies (33) Gnc(logn)2.(33)

Proof.

If there are n primes less than or equal to x, then the largest of these is pnnlognx, using Lemma 1. Thus, translated from the scale of primes not exceeding x to the first n gaps, the Cramér-Shanks conjecture (Equation32) becomes (Equation33) because (34) max1jndjc(log(nlogn))2=(logn+loglogn)2(logn)2.(34)

Conversely, if max1jndjc(logn)2, then max1jndj=maxpjpndjmaxpjxdj and logxlog(nlogn)logn+loglognlogn, so (logx)2(logn)2 and (Equation32) holds. □

Theorems 5 and 6 suggest that (logx)2 in the Cramér-Shanks conjecture (Equation32) is too small asymptotically. In the model of Theorem 5, the largest gap is likely to be larger than the expectation of the largest gap because the variance of the largest gap is of the same order of magnitude as the expectation of the largest gap. To the extent that the above conjectures are correct that gaps have exponential moments asymptotically, it would be surprising if the largest of the first n gaps did not exceed (logx)2.

These suggestions indirectly challenge Firoozbakht’s conjecture [Citation38]. Kourbatov [Citation23] showed that Firoozbakht’s conjecture implies that dn:=pn+1pn<c(logpn)2logpn1 for all n > 9 and is implied by dn<c(logpn)2logpn1.17 for all n > 9. These upper bounds are stronger than the Cramér-Shanks conjecture (Equation32), and lower than the dominant term (logpn)2(logn)2 (see Theorem 6) by amounts that increase without limit as n increases. To the extent that our Theorems 5 and 6 suggest that (logx)2 in the Cramér-Shanks conjecture (Equation32) is too small asymptotically, our results suggest even more that Kourbatov’s upper bounds on gaps are likely to be too small. Kourbatov [Citation23] discusses many related inequalities and conjectures concerning prime gaps.

Granville [Citation17, p. 24] reviewed results that suggest, contrary to the Cramér-Shanks conjecture (Equation32), that (35) maxpjxdj>c2eγ(logx)22eγ(logpπ(x))2,(35) where 2eγ1.1229. Translating from the scale of x to the scale of the number of gaps n=π(x) by xpnnlogn so that (logx)2(log(nlogn))2(logn)2 gives the proposal that (36) Gn>c2eγ(logn)2.(36)

These observations motivate another estimate of the largest of the first n gaps, namely, the (11/n)-quantile of the largest order statistic X(n). We now determine the value of y such that, in a sample of size n from Exp(1/logn), as in Theorem 5, the probability that the largest order statistic X(n) exceeds y is 1/n.

Theorem 7.

In a sample of size k > 1 from Exp(1/logn), let yk be the (11/k)-quantile of the maximal order statistic X(k). Then yk2(logn)(logk) as k. If ktn for some t > 0, then yk2(logn)2 as n.

Proof.

Using Lemma 2.5, (Equation13), with λ=1/logn gives (37) yk=(logn)log(1(11/k)1/k).(37)

Repeated applications of l’Hopital’s rule as k shows that log(1(11/k)1/k)(2logk) and hence that (38) yk+2(logn)(logk).(38)

Wolf [Citation40, his EquationEq. (15)] argued heuristically for the conjecture that, as x, (39) GW(x):=maxpn<x(pnpn1)cxπ(x)(2log(π(x))log(x)+c),(39) where c0.2778769. Here c:=log(C2) and C2:=2p>2(1(p1)2) is known sometimes as the twins constant and sometimes as twice the twins constant. The product in C2 is taken over all positive odd primes. Replacing x by pn+ε and letting ε0 gives the equivalent conjecture, as n, (40) GW(pn)cpnn(2log(n)log(nlogn)+c)(logn)2.(40)

7 Numerical illustrations

For moments and maximal gaps, we compare exact numerical results derived from public sources with asymptotic expressions derived from the exponential model of prime gaps and from other conjectures.

7.1 Moments

To illustrate Theorem 3, we compare exact computations of the moments of the first n gaps with the moments of an exponential distribution with mean logn as given by (Equation19). Wolf [Citation40] generously made public extensive numerical results at http://pracownicy.uksw.edu.pl/mwolf/gapstau.zip. Wolf [Citation40, p. 2, his EquationEq. (2)] defined, for large real x and even dN, (41) τd(x):=#{pn+1|pn+1<x andpn+1pn=d}(41) and, for every odd dN, τd(x):=0. In words, when d is even, τd(x) is the number of pairs of consecutive primes such that the larger prime is less than x and such that their difference equals d; and for odd d, τd(x):=0. This definition and my subsequent analyses exclude τ1(x)=1, x3, representing the single gap p2p1=32 of size d = 1. Wolf collected the non-zero values of τd(x) in 34 text files, one file for each of the 34 values of x=2t, t=15(1)48. (Approximately, 2482.8147×1014.) Each file has two columns, the first listing values of d such that τd(x)>0, and the second listing the corresponding non-zero values of τd(x).

First, using MATLAB Version 9.13.0.2049777 (R2022b), I calculated τd(x) directly for all primes less than 220. My results agreed exactly with those in Wolf’s file tau20s.dat. For example, Wolf and I independently found τ2(220)=8535 gaps of size d = 2; the maximal gap size, d = 114, occurred once: τ114(220)=1.

Having partially verified Wolf’s results, I analyzed Wolf’s 12 files with values of x=2t, t=15,18,21,24,27,,48. For each such file separately, gives t; the number of gaps n=dNτd(x) where x=2t (not counting the first gap d = 1); the first four integer moments μk,n, k=1,2,3,4 from (Equation18); and the maximal gap Gn. compares μk,n with k!(logn)k, which is asymptotic to the corresponding moments of samples of size n from an exponential distribution Exp(1/logn), as conjectured in (Equation19). Visually, the agreement in between the exact moments and the asymptotic moments of Exp(1/logn) is remarkable.

Table 1 For each upper limit x=2t, this table shows the exponent t of 2, the number n of gaps between consecutive primes (not counting the odd first gap), the moments μk,n(k=1,2,3,4), and the maximal gap Gn .

7.2 Maximal gaps

We compare the first 80 known maximal gaps (now including the initial gap of size 1) [Citation37] with four asymptotic models: (Citation32, Citation33, Citation36), and (Equation35). These results on maximal gaps are more extensive and more detailed than those in . The tabulation lists three sequences:

  1. the indices of primes after which a maximal gap occurs

    n=1,2,4,9,24,30,99,154,189,217,1183, (OEIS A005669),

  2. the corresponding maximal gaps

    Gn:=pn+1pn=1,2,4,6,8,14,18,20,22,34,36, (OEIS A005250), and

  3. the primes after which a maximal gap occurs

    pn=2,3,7,23,89,113,523,887,1129,1327,9551, (OEIS A002386).

I partially verified the Wikipedia tabulation in two ways. First, Marek Wolf (personal communication, 2022-11-10) generously sent me his tabulation of the first 74 maximal gaps Gn (not including G1), their indices n, and their beginning primes pn. Second, using MATLAB, I calculated these three sequences directly for all primes less than 106. My results and Wolf’s agreed exactly, as far as they went, with the Wikipedia tabulation [Citation37].

plots, as a function of n, the maximal gap size Gn among the first n gaps; and the values of the four conjectured asymptotic expressions (logn)2; (logpn)2; 2eγ(logn)2, where 2eγ1.1229; and 2eγ(logpn)2. The majority of points (n,Gn) (blue solid dots in ) fall slightly below the conjectured asymptotic behavior (n,(logn)2) (solid black line in ) derived here from the conjectured asymptotically exponential distribution of gaps. The form of Wolf’s conjecture in (Equation40) falls slightly below (n,(logn)2) and often closer to the points (n,Gn) than (n,(logn)2). However, the seven exceptional values of n with Gn>2eγ(logn)2 in suggest that lim supnGn/[2eγ(logn)2] may exceed 1. The available numerical results neither confirm nor reject the suggestion implied by Theorem 7 that lim supnGn might be asymptotic to 2(logn)2. The asymptotic behavior of Gn remains to be determined.

Fig. 2 Maximal gap Gn (solid blue dots) among the first n gaps and four conjectured models: (logn)2 (solid black line); (logpn)2 (solid black line with + markers); 2eγ(logn)2 (dashed purple line), where 2eγ1.1229; and 2eγ(logpn)2 (dashed purple line with + markers). The dots and lines are calculated independently with no adjustment of parameters. While the great majority of the values of Gn are better approximated by (logn)2 (solid black line) than by the other models, the seven exceptional values of n with Gn>2eγ(logn)2 in suggest that lim supnGn/[2eγ(logn)2] may exceed 1.

Fig. 2 Maximal gap Gn (solid blue dots) among the first n gaps and four conjectured models: ( log n)2 (solid black line); ( log pn)2 (solid black line with + markers); 2e−γ( log n)2 (dashed purple line), where 2e−γ≈1.1229; and 2e−γ( log pn)2 (dashed purple line with + markers). The dots and lines are calculated independently with no adjustment of parameters. While the great majority of the values of Gn are better approximated by ( log n)2 (solid black line) than by the other models, the seven exceptional values of n with Gn>2e−γ( log n)2 in Table 2 suggest that lim supn→∞Gn/[2e−γ( log n)2] may exceed 1.

Table 2 Seven maximal gaps Gn that exceed (logn)2 and 2eγ(logn)2, the index n of the prime pn that begins the maximal gap, the prime pn that begins the maximal gap, (logpn)2, and 2eγ(logpn)2.

Acknowledgments

J.E.C. thanks Andrew Granville, D. R. Heath-Brown, Tomás Oliveira e Silva, and Marek Wolf for very helpful guidance to relevant references; Marek Wolf for sharing numerical results analyzed here; and Roseanne Benjamin for assistance during this work. Two helpful reviewers provided constructive suggestions.

Declaration of Interest

The author reports there are no competing interests to declare.

References

  • Bar-Lev, S. K., Enis, P. (1986). Reproducibility and natural exponential families with power variance functions. Ann. Stat. 14(4): 1507–1522.
  • Bar-Lev, S. K., Stramer, O. (1987). Characterizations of natural exponential families with power variance functions by zero regression properties. Probab. Theory Related Fields 76: 509–522. 10.1007/BF00960071
  • Bingham, N. H., Goldie, C. M., Teugels, J. L. (1987). Regular Variation, Encyclopedia of Mathematics and its Applications. Cambridge, England: Cambridge University Press.
  • Cohen, J. E. (2016). Statistics of primes (and probably twin primes) satisfy Taylor’s law from ecology. Amer. Stat. 70(4): 399–404. 10.1080/00031305.2016.1173591
  • Cohen, J. E. (2020). Species-abundance distributions and Taylor’s power law of fluctuation scaling. Theor. Ecol. 13(4): 607–614. 10.1007/s12080-020-00470-x
  • Cohen, J. E. (2023). Integer sequences with regularly varying counting functions have power-law variance functions. Integers 23(A87): 1–19.
  • Cohen, M. P. (2017). Non-asymptotic mean and variance also approximately satisfy Taylor’s law. Amer. Stat. 71(2): 187. 10.1080/00031305.2017.1286261
  • Cramér, H. (1936). On the order of magnitude of the difference between consecutive prime numbers. Acta Arith. 2(1): 23–46. 10.4064/aa-2-1-23-46
  • Crandall, R., Pomerance, C. (2005). Prime Numbers–A Computational Approach, 2nd ed. New York: Springer.
  • Cutter, P. A. (2001). Finding prime pairs with particular gaps. Math. Comp. 70(236): 1737–1744. 10.1090/S0025-5718-01-01327-8
  • Davidian, M., Carroll, R. J. (1987). Variance function estimation. J. Amer. Stat. Assoc., 82(400): 1079–1091. 10.1080/01621459.1987.10478543
  • Demers, S. (2018). Taylor’s law holds for finite OEIS integer sequences and binomial coefficients. Amer. Stat. 72(4): 376–378. 10.1080/00031305.2017.1422439
  • Dickson, L. G. (1919). History of the Theory of Numbers, Volume I: Divisibility and Primality, Vol. 256(1). Washington, DC: Carnegie Institution of Washington.
  • Eisler, Z., Bartos, I., Kertész, J. (2008). Fluctuation scaling in complex systems: Taylor’s law and beyond. Adv. Phys. 57(1): 89–142.
  • Feller, W. (1971). An Introduction to Probability Theory and Its Applications, Vol. 2, 2nd ed. New York: Wiley.
  • Gallagher, P. X. (1981). On the distribution of primes in short intervals. Mathematika 23(1): 4–9. Corrigendum, Mathematika 28: 86.
  • Granville, A. (1995). Harald Cramér and the distribution of prime numbers. Scand. Actuar. J. 1: 12–28. 10.1080/03461238.1995.10413946
  • Grimmett, G. R., Stirzaker, D. R. (2001). Probability and Random Processes, 3rd ed. New York: Oxford University Press.
  • Guy, R. K. (1994). Unsolved Problems in Number Theory, 2nd ed. New York: Springer Verlag.
  • Hardy, G. H., Littlewood, J. E. (1966). Some problems of ‘partitio numerorum’: III: On the expression of a number as a sum of primes. Acta Math. 44:1–70. Reprinted in “Collected Papers of G. H. Hardy,” Vol. I, pp. 561–630. Oxford: Clarendon Press. 10.1007/BF02403921
  • Heath-Brown, D. R. (1992). Gaps between primes and the pair correlation of zeros of the zeta-function. Acta Arith. 41: 85–99. 10.4064/aa-41-1-85-99
  • Holst, L. (1980). On the lengths of the pieces of a stick broken at random. J. Appl. Probab. 17: 623–634. 10.1017/S0021900200033738
  • Kourbatov, A. (2015). Upper bounds for prime gaps related to Firoozbakht’s conjecture. arXiv 1506.03042v4.
  • Maier, H. (1981). Chains of large gaps between consecutive primes. Adv. Math. 39(3): 257–269. 10.1016/0001-8708(81)90003-7
  • Maier, H. (1985). Primes in short intervals. Michigan Math. J. 32(2): 221–225. 10.1307/mmj/1029003189
  • Marshall, A. W., Olkin, I. (2007). Life Distributions: Structure of Nonparametric, Semiparametric, and Parametric Families. Series in Statistics. New York: Springer.
  • Massachusetts Institute of Technology. (2013). Large deviations for i.i.d. random variables, Advanced Stochastic Processes. Available at: https://ocw.mit.edu/courses/15-070j-advanced-stochastic-processes-fall-2013/ed35842f2e902421e4a6cdd4d9eca6fe_MIT15_070JF13_Lec2.pdf. [Online; accessed 13-April-2024].
  • Oliveira e Silva, T., Herzog, S., Pardi, S. (2014). Empirical verification of the even Goldbach conjecture and computation of prime gaps up to 4×1018. Math. Comp. 83(288): 2033–2060.
  • Riesel, H. (1994). Prime Numbers and Computer Methods for Factorization. Progress in Mathematics, Vol. 126, 2nd ed. Boston: Birkhauser.
  • Sarhan, A. E., Greenberg, B. G., eds. (1962). Contributions to Order Statistics. New York, London: Wiley.
  • Schmüdgen, K. (2020). Ten lectures on the moment problem. Available at: 10.48550/arXiv.2008.12698. arXiv:2008.12698v1 [math.FA].
  • Shanks, D. (1964). On maximal gaps between successive primes. Math. Comp. 18(88): 646–651. 10.1090/S0025-5718-1964-0167472-8
  • Taylor, R. A. J. (2019). Taylor’s Power Law: Order and Pattern in Nature. New York: Academic Press.
  • Tweedie, M. C. K. (1946). The regression of the sample variance on the sample mean. J. London. Math. Soc. 21: 22–28. 10.1112/jlms/s1-21.1.22
  • Tweedie, M. C. K. (1947). Functions of a statistical variate with given means, with special reference to Laplacian distributions. Proc. Cambridge Philos. Soc. 43: 41–49. 10.1017/S0305004100023185
  • Tweedie, M. C. K. (1984). An index which distinguishes between some important exponential families. In: Ghosh, J. K., Roy, J., eds. Statistics: Applications and New Directions. Proceedings of the Indian Statistical Institute Golden Jubilee International Conference, pp. 579–604, Calcutta, 1984. Indian Statistical Institute.
  • Wikipedia contributors. (2022). Prime gap—Wikipedia, the free encyclopedia. Available at: https://en.wikipedia.org/w/index.php?title=Prime_gap&oldid=1113313971. [Online; accessed 13-November-2022].
  • Wikipedia contributors. (2023). Firoozbakht’s conjecture—Wikipedia, the free encyclopedia. https://en.wikipedia.org/w/index.php?title=Firoozbakht%27s_conjecture&oldid=1167645599. [Online; accessed 10-April-2024].
  • Wolf, M. (1998). Some conjectures on the gaps between consecutive primes. Available at: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.49.3015&rep=rep1&type=pdf and http://pracownicy.uksw.edu.pl/mwolf/conjectures.ps, 1998. Preprint accessed 2022-09-23.
  • Wolf, M. (2014). Nearest-neighbor-spacing distribution of prime numbers and quantum chaos. Phys. Rev. E 89: 022922. 10.1103/PhysRevE.89.022922
  • Wolf, M. (2017). On the moments of the gaps between consecutive primes. arXiv:1705.10766v1.
  • Yamasaki, Y., Yamasaki, A. (1994). On the gap distribution of prime numbers. Notes Res Inst. Math. Anal. Kyoto Univ. 887: 151–168.

Reprints and Corporate Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

To request a reprint or corporate permissions for this article, please click on the relevant link below:

Academic Permissions

Please note: Selecting permissions does not provide access to the full text of the article, please see our help page How do I view content?

Obtain permissions instantly via Rightslink by clicking on the button below:

If you are unable to obtain permissions via Rightslink, please complete and submit this Permissions form. For more information, please visit our Permissions help page.