## Abstract

Let us call a simple graph on \(n\geqslant 2\) vertices a prime gap graph if its vertex degrees are 1 and the first \(n-1\) prime gaps. We show that such a graph exists for every large *n*, and in fact for every \(n\geqslant 2\) if we assume the Riemann hypothesis. Moreover, an infinite sequence of prime gap graphs can be generated by the so-called degree preserving growth process. This is the first time a naturally occurring infinite sequence of positive integers is identified as graphic. That is, we show the existence of an interesting, and so far unique, infinite combinatorial object.

### Similar content being viewed by others

Avoid common mistakes on your manuscript.

## 1 Introduction

### 1.1 The problem

This paper grew out from an empirical observation by one of us (Z.T.): there are large graphs whose vertex degrees are consecutive members of the sequence of prime gaps. Moreover, such graphs can be generated recursively by the so-called degree preserving growth process [16]. To turn the observation into precise mathematical statements, we introduce the following definition.

### Definition

Let \(p_n\) denote the *n*-th prime number, and let \(p_0=1\). We call a simple graph on \(n\geqslant 2\) vertices a *prime gap graph* if its vertex degrees are \(p_1-p_0,\dotsc ,p_n-p_{n-1}\).

### Conjecture 1.1

(Toroczkai, 2016) For every \(n\geqslant 2\), there exists a prime gap graph on *n* vertices.

### Conjecture 1.2

(Toroczkai, 2016) In every prime gap graph on *n* vertices, there exist \((p_{n+1}-p_n)/2\) independent edges.

In fact, as will become clear in the next subsection, Conjecture 1.2 implies Conjecture 1.1. By combining techniques from analytic number theory and matching theory, we are able to almost fully settle these conjectures.

### Theorem 1.1

Conjectures 1.1 and 1.2 are true for every sufficiently large *n*. Assuming the Riemann hypothesis, they are true for every \(n\geqslant 2\).

The main input from analytic number theory is an upper bound on the sum of large prime gaps. The main input from matching theory is Vizing’s theorem on edge colorings. See Subsection 1.3 for more details. In the next subsection, we discuss the background and motivation for Theorem 1.1.

### 1.2 Broader context

Networks are powerful, graph-based representations used in the study of complex systems. They appear in systems ranging from elementary particle interactions, through nucleosynthesis, chemistry, biology (gene interactions, protein interactions, metabolism, physiology), social sciences (human interactions), infrastructures (transportation, power grid, etc.), ecology (food webs) and climate, to the organization of visible and dark matter in the universe. In this paper we report on a novel family of networks, however, in number theory.

In this paper all graphs are *simple*: there are no parallel edges and loops. The most common characteristic of a graph is its *degree sequence*: we equip each of the *n* vertices with a unique label from \(\{1,\dotsc ,n\}\), and an integer vector \(\textbf{D}=(d_1,\dotsc ,d_n)\) lists the *degrees* of the corresponding labeled vertices, that is, the number of edges incident on a given vertex. In chemistry, and in old-fashioned graph theory, this is called *valency*.

The inverse problem is the following: we are given a sequence \(\textbf{D}\) of nonnegative integers, and we want to know whether there exists a graph with this ensemble as a degree sequence. When the answer is affirmative, then we call the sequence \(\textbf{D}\) *graphic*. Clearly, if the sequence is graphic, then the sum of its members must be even. However, it is not self-evident whether a given sequence is graphic. The most well-known characterization of graphic degree sequences is the following theorem:

### Theorem 1.2

(Erdős–Gallai [7]) Let \(d_1\geqslant \cdots \geqslant d_n\geqslant 0\) be integers. Then the sequence \((d_1,\dotsc ,d_n)\) is graphic if and only if \(d_1+\cdots +d_n\) is even and for every \(k\in \{1,\dotsc ,n\}\) we have

It is well-understood that there are exponentially many different *realizations* for almost every graphic degree sequence. At the same time, the number of all graphic degree sequences is infinitesimal compared to the number of integer partitions of the sum of the degrees. More precisely, let 2*m* denote the sum of the degrees (as usual), so that the degree sequence is a *partition* of 2*m*. By a difficult result of Pittel [23], as *m* tends to infinity, the probability of a random partition of 2*m* being graphic is zero in the limit.

Theorem 1.2 gives us a means to decide whether the degree sequence is graphic. It is, however, an entirely different problem to actually construct a realization of a graphic degree sequence. The simplest way to do that is via the Havel–Hakimi algorithm, which, in turn, is based on the following observation:

### Theorem 1.3

(Havel [12] and Hakimi [11]) Let \(d_1 > 0\) and \(d_2 \geqslant \cdots \geqslant d_n \geqslant 0\) be integers. Then \((d_1,\dotsc ,d_n)\) is graphic if and only if \((d_2-1,\dotsc ,d_{d_1+1}-1,d_{d_1+2},\dotsc ,d_n)\) is graphic.

Assume we are given a long sequence of natural numbers \(\textbf{D}\) such that every *initial segment* \(\textbf{D}^n\) formed by the first *n* elements of \(\textbf{D}\) is graphic (we restrict this notion to \(n\geqslant 2\)). This means, in particular, that \(d_n<n\) for \(n\geqslant 2\). We would like to construct a realization \(G_n\) for any \(n\geqslant 2\). Clearly, it can be done by separate applications of the Havel–Hakimi algorithm for every single \(n\geqslant 2\). But this is rather uneconomical: in principle, for each new segment we have to restart the algorithm from scratch. Instead, we want to find a *graph growth dynamics (GGD)* such that \(G_{n+1}\) can be obtained from \(G_n\) rapidly.

There are only a few GGDs in the network science literature as most graph construction models are based on static algorithms. Arguably, the most popular GGDs is the preferential attachment algorithm of scale-free networks. However, in this and other GGDs, typically, some of the degrees of the vertices in \(G_{n+1}\) are bigger than in the degree sequence of \(G_n\), and thus, they are unsuitable for our purposes.

Recently, a new network growth dynamics has been introduced: the *degree-preserving network growth (DPG)* model family (see [8] or [16]). The DPG-process can be described as follows: let *G* be a simple graph with degree sequence \(\textbf{D}\). In what follows, by a *matching* we mean a set of independent edges in the graph, that is, a set of pairwise non-adjacent edges. In a general step, a new vertex *u* joins *G* by removing a \(\nu \)-element matching of *G* followed by connecting *u* to the vertices incident to the \(\nu \) removed edges. The degree of the newly inserted vertex is \(d=2\nu \). This step does not join two vertices of *G* that are non-adjacent, furthermore, the degrees of vertices in *G* are not changed. The degree sequence of the newly generated graph is \(\textbf{D}\circ d\), that is, *d* is concatenated to the end of \(\textbf{D}\). This graph operation is called a *degree-preserving step (DP-step)*, and the *DPG-process* repeats such steps iteratively.

Returning to our long sequence \(\textbf{D}\) of natural numbers: if, for each step *n*, we can find a matching of size \(d_{n+1}/2\) in \(G_n\), then the application of a DP-step provides a realization \(G_{n+1}\) of \(\textbf{D}^{n+1}\). In this case, we say that the pair \((G_n,d_{n+1})\) is *DPG-graphic*. One can ask, why should a suitable matching be found in \(G_n\)? Actually, this is not inconceivable, as the following theorem shows:

### Theorem 1.4

(Theorem 2.5 in [18]) Given a graphic sequence \(\textbf{D}\) of length *n* and an even integer \(2\leqslant d \leqslant n\), the sequence \(\textbf{D}\circ d\) is graphic if and only if \(\textbf{D}\) has a realization with a matching of size *d*/2.

Since every initial segment \(\textbf{D}^n\) is graphic, therefore, for each one there exists a “special” realization \(G'_n\) with the requested matching. However, it is not automatic that \(G'_n = G_n\). A natural way to deal with this problem is to add the condition that every realization of \(\textbf{D}^n\) has a matching of size \(d_{n+1}/2\).

We stress that it is not easy to find an infinite, naturally occurring sequence \(\textbf{D}\) whose initial segments are all graphic, or at least graphic beyond a certain point. As a matter of fact, until now we have only known one such example: when all elements in the sequence are equal. Such a GGD describes an ever growing regular graph sequence.

In this paper, we describe for the first time a nontrivial, naturally arising infinite sequence whose initial segments are all graphic. Furthermore, we show that any realization of the initial segments is admissible for the DPG-algorithm. This sequence is the sequence of prime gaps with a prefix 1:

The prefix 1 was included to guarantee that the sum of the initial segments is even. The figure below is an illustration of the DPG-process on prime gap graphs. The independent edges used by the DP-steps are red zigzags.

The proof that the DPG-process creates an infinite sequence of prime gap graphs incorporates two main ingredients. The first one is a symmetric inequality, which implies the Erdős–Gallai inequalities, and thus provides a practical sufficient condition for the graphicality of the underlying degree sequence. Moreover, another new inequality implies the DPG-graphicality of a long sequence of natural numbers. The second ingredient combines classical \(L^2\) and \(L^\infty \) bounds for prime gaps.

### Theorem 1.5

If *n* is sufficiently large, then the initial segment \(\textbf{PD}^n\) is graphic, and for any realization \(G_n\) of \(\textbf{PD}^n\), the pair \((G_n, p_{n+1}-p_n)\) is DPG-graphic.

Ultimately, the proof relies on the rarity of zeros possibly violating the Riemann hypothesis. In principle, it allows one to deduce an effective constant beyond which Theorem 1.5 holds true, but this constant far exceeds the capabilities of computers. However, assuming the Riemann hypothesis, we can reduce the constant significantly and prove the result for all \(n\geqslant 2\). Here the numerics are quite delicate, and for efficiency we depart from the symmetric treatment alluded to above. Instead, we go back to first principles and examine the contribution of large prime gaps more directly. We still need to rely on computational results, but they can either be obtained with very simple computer programs, or found in the literature (e.g. prime gap records until \(2\cdot 10^{18}\)).

### Theorem 1.6

Assume the Riemann hypothesis. Then, for any \(n\geqslant 2\), the initial segment \(\textbf{PD}^n\) is graphic, and for any realization \(G_n\) of \(\textbf{PD}^n\), the pair \((G_n, p_{n+1}-p_n)\) is DPG-graphic.

Note that Theorems 1.5 and 1.6 are a reformulation of Theorem 1.1 in the terminology of combinatorics and network theory. They rely on the core theorems presented in the next subsection, which are of independent interest.

### 1.3 New results

Our first result provides, via two symmetric inequalities, sufficient conditions for a given sequence to be graphic and that in every graph realization of the sequence, there is a matching of a given size.

### Theorem 1.7

Let \(\textbf{D}=(d_1,\dotsc ,d_n)\) be a sequence of positive integers such that \({\Vert \textbf{D}\Vert }_1=\sum _{\ell =1}^n d_\ell \) is even. Let \(1<p\leqslant \infty \) be a parameter.

**Part (a).** Assume that the following \(L^p\)-norm bound holds:

Then there is a simple graph *G* with degree sequence \(\textbf{D}\).

**Part (b).** Let *G* be any simple graph with degree sequence \(\textbf{D}\). Assume that \(d\geqslant 2\) is an even integer satisfying

Then the pair (*G*, *d*) is DPG-graphic, and consequently \(\textbf{D}\circ d\) is graphic.

Our second result makes explicit a theorem of Selberg [25, Th. 2].

### Theorem 1.8

Assume the Riemann hypothesis. Then, for any \(x\geqslant 2\) and \(N>0\), we have

### Remark

The example \(x=2\) and \(N=2\) shows that this result would become false if we replaced the constant 163 by 4. On the other hand, Cramér’s model predicts that it can be replaced by *o*(1) for \(x\rightarrow \infty \) (cf. [9, §1.1]).

In order to achieve the good numeric constant 163, we estimate carefully (among others) the error term in the truncated von Mangoldt formula for the Chebyshev psi function. This result, stated below, makes explicit a theorem of Goldston [10], and simultaneously extends and sharpens a theorem of Dudek [6, Th. 1.3] in the special case relevant for us. Here and later the notation \(A=O^*(B)\) stands for \(|A|\leqslant B\).

### Theorem 1.9

For any \(z>x>10^{18}\) we have

where the sum is over the nontrivial zeros of the Riemann zeta function (counted with multiplicity).

## 2 Preliminary results

### 2.1 An application of Vizing’s theorem

### Theorem 2.1

(Vizing [27]) A simple graph with maximal degree \(\Delta \) admits a proper edge coloring with \(\Delta +1\) colors.

### Lemma 2.1

Let *G* be a simple graph on *n* vertices with degrees \(d_1,\dotsc ,d_n\). Let \(\delta \geqslant 1\) be an integer, and let \(d\geqslant 2\) be an even integer satisfying

Then *G* has a matching of size *d*/2.

### Proof

Let us delete all vertices of degree at least \(\delta \) (and the incident edges) from *G*. The remaining subgraph *H* has maximal degree less than \(\delta \), and number of edges at least

by (5). It follows from Theorem 2.1 that the edge set of *H* can be partitioned into \(\delta \) matchings, and then (6) shows that the largest matching in this decomposition must be of size at least *d*/2. Since *H* is a subgraph of *G*, the proof is complete. \(\square \)

### 2.2 Preliminaries about \(\Gamma (z)\) and \(\zeta (s)\)

### Lemma 2.2

Assume that \(\Re z>0\). Then

### Proof

With the help of the well-known integral representation (cf. [28, §12.31])

the statement becomes

However, this one is clear, because the integrand is non-negative with a discrete set of zeros (there are no zeros when *z* is real). \(\square \)

### Lemma 2.3

(Delange [5]) For any \(\sigma >1\) and \(t\in \mathbb {R}\) we have

### Lemma 2.4

(Dudek [6]) Let \(\sigma \leqslant -1\) and \(t\in \mathbb {R}\). Assume that either \(\sigma \in 1+2\mathbb {Z}\) or \(|t|\geqslant 1\). Then

### Proof

This is a variant of [6, Lem. 2.3], and can be proved in the same way. We note a small oversight in [6, p. 183]: instead of assuming that \(U\geqslant 2\) is an even integer, one should assume that \(U\geqslant 1\) is an odd integer, just as in [4, §17]. \(\square \)

### Lemma 2.5

(Dudek [6]) Assume that \(z>100\). Then there exists \(T\in (z-2,z)\) such that

### Proof

The statement follows from [6, Lem. 2.8]. \(\square \)

### Definition

For \(T>0\), we denote by *N*(*T*) the number of zeros of \(\zeta (s)\) with imaginary part in (0, *T*), counted with multiplicity.

### Lemma 2.6

For any \(T\geqslant \Delta +2\pi>\Delta >0\) we have

### Proof

By [2, Cor. 1], we have

The integrand is less than \(\log T\), and the result follows. \(\square \)

### 2.3 Preliminaries about prime gaps

### Theorem 2.2

(Ingham [15, Th. 4]) Let \(\varepsilon >0\). For any \(x\geqslant x_0(\varepsilon )\), there is a prime number in \([x,x+x^{5/8+\varepsilon }]\).

### Remark

The exponent \(5/8+\varepsilon \) was improved multiple times, the current record 21/40 being due to Baker–Harman–Pintz [1]. We have emphasized the classical result of Ingham [15] as it suffices for our purposes.

### Theorem 2.3

(Carneiro–Milinovich–Soundararajan [3, Th. 1.5]) Assume the Riemann hypothesis. Then, for any \(x\geqslant 4\), there is a prime number in \([x,x+\frac{22}{25}\sqrt{x}\log x]\).

In a restricted range, we have a stronger unconditional result thanks to explicit calculations.

### Lemma 2.7

For any \(x\in [117,10^{18}]\), there is a prime number in \([x,x+\sqrt{x}]\).

### Proof

Assume that the conclusion fails for some \(x\in [117,10^{18}]\). Then there is a unique prime number \(p_\ell \) such that \(p_\ell<x<x+\sqrt{x}<p_{\ell +1}\). In particular, \(\ell \geqslant 31\) and \(p_\ell<x<{(p_{\ell +1}-p_\ell )}^2\). Hence the computations of Oliveira e Silva, Herzog, and Pardi [21, Table 8] show that the initial upper bound \({10}^{18}\) for \(p_\ell \) successively improves to: \(1442^2\), \(148^2\), \(52^2\), \(34^2\), \(22^2\), \(14^2\). This means that \(31\leqslant \ell \leqslant 44\), but then \(x<{(p_{\ell +1}-p_\ell )}^2\leqslant 10^2\) is a contradiction. \(\square \)

### Remark

The conclusion of Lemma 2.7 is likely true for all \(x\geqslant 117\). However, this statement is not known to follow from the Riemann hypothesis, and it is stronger than Oppermann’s conjecture (which itself implies Legendre’s conjecture, Andrica’s conjecture, and Brocard’s conjecture).

### Theorem 2.4

(Heath-Brown [13]) For any \(x\geqslant 2\) we have

### Remark

The exponent 4/3 was improved to \(23/18+\varepsilon \) by Heath-Brown [14], and to \(5/4+\varepsilon \) independently by Peck [22] and Maynard [17]. The current record \(123/100+\varepsilon \) is due to Stadlmann [26]. We have emphasized the original breakthrough of Heath-Brown [13] as it suffices for our purposes.

## 3 Proof of the main theorem

In this section, we first prove Theorem 1.5 assuming Theorem 1.7, and then we prove Theorem 1.6 assuming Theorem 1.8. In other words, we deduce Theorem 1.1 from Theorems 1.7 and 1.8.

### 3.1 Proof of Theorem 1.5

Let *n* be sufficiently large. We shall verify the conditions of Theorem 1.7 for

Clearly, \({\Vert \textbf{D}\Vert }_1=p_n-1\) is even. Condition (2) reads

while condition (3) reads

Now (9) and (10) follow from Theorems 2.2 and 2.4, hence we are done:

### 3.2 Proof of Theorem 1.6

Assume the Riemann hypothesis, and let *G* be a prime gap graph on *n* vertices. It suffices to show that *G* has \((p_{n+1}-p_n)/2\) independent edges (cf. Conjecture 1.2), because then a straightforward induction argument based on Theorem 1.4 shows that every initial segment of \(\textbf{PD}\) is graphic (cf. Conjecture 1.1). The statement is clear for \(2\leqslant n\leqslant 4\), hence we shall restrict to \(n\geqslant 5\).

By Lemma 2.1, it suffices to exhibit an integer \(N\geqslant 1\) satisfying

For \(p_n<10^{18}\) we take

so that (11) simplifies to \(N(p_{n+1}-p_n)<p_n\). In fact the proof of Lemma 2.1 reveals that the last condition can be relaxed to

which works better for very small \(n\geqslant 5\). For \(5\leqslant n\leqslant 44\) the condition (12) can be checked by a simple computer program (or by hand). For \(n\geqslant 45\) and \(p_n<10^{18}\) we verify (12) as follows. Let *k* be the unique positive integer satisfying \((k-1)^2<p_n<k^2\). Note that \(k\geqslant 15\), because \(p_n\geqslant p_{45}=197\). From Lemma 2.7 it follows that \(p_{n+1}-p_n\leqslant k-1\) and

hence also that

Therefore, (12) is clear by

For \(p_n>10^{18}\) we take

Then, by Theorems 2.3 and 1.8, we have

From here the bound (11) is immediate, hence we are done.

## 4 A symmetric criterion for graphicality

In this section, we prove Theorem 1.7.

**Part (a).** By symmetry, we can assume that \(d_1\geqslant \cdots \geqslant d_n\). By Theorem 1.2, it suffices to check that for any \(1\leqslant k\leqslant n\),

Since \(d_\ell \geqslant 1\) for any \(1\leqslant \ell \leqslant n\), it suffices to prove that

which is equivalent to

This last condition follows from (2) and Hölder’s inequality, hence we are done:

In the last step, we used that both \(k^2\) and *n* are upper bounded by \(\max (k^2,n)\).

**Part (b).** By Theorem 1.4 and Lemma 2.1, it suffices to verify that (5) holds for some integer \(\delta \geqslant 1\). If \(p=\infty \), then (3) says that \(4d{\Vert \textbf{D}\Vert }_\infty \leqslant {\Vert \textbf{D}\Vert }_1\), hence (5) holds for \(\delta :=1+{\Vert \textbf{D}\Vert }_\infty \). So let us focus on the case \(1<p<\infty \). For any integer \(\delta \geqslant 1\), we have

hence also

So for the validity of (5), it suffices that

In other words, it suffices to find an integer \(\delta \) satisfying

The left-hand side exceeds 1, hence \(\delta \) exists as long as

This is equivalent to condition (3), hence the proof of Theorem 1.7 is complete.

## 5 The sum of large prime gaps

In this section, we prove Theorem 1.8 assuming Theorem 1.9. Throughout, we assume the Riemann hypothesis.

First we eliminate some simple cases. Let \(N^*\) denote the largest prime gap \(p_{\ell +1}-p_\ell \) occurring in (4). Then we can clearly assume that

hence also that \(N^*(2x+N^*)>163x\log ^2 x\). From Theorem 2.3 it follows that \(N^*<3\sqrt{x}\log x\), so our previous inequality yields \(N^*>77\log ^2 x\). By [21, Table 8], this forces \(x>10^{18}\). Indeed, for \(x\in [2,10^3]\) we have \(N^*\leqslant 34\), while for \(x\in [10^3,10^{18}]\) we have \(N^*\leqslant 1476\). On the other hand, for \(x>10^{18}\) we get from Therore 2.3 that \(N^*<\frac{4}{3}\sqrt{x}\log x<0.001 x\), hence by (13) also that

From now on we assume both \(x>10^{18}\) and (14). Following Heath-Brown [13], we write \(N=4\delta x\) with

and we set out to estimate the square mean of

It follows from Theorem 1.9 and the crude bound \(y+\delta y<3x\) that

where

As a result,

### Lemma 5.1

We have

### Proof

The bound \(|C(\rho )|<\delta \) is a consequence of the integral representation

and the triangle inequality for complex-valued Riemann integrals. In addition, the triangle inequality for complex numbers yields by the definition of \(C(\rho )\) that

\(\square \)

We estimate the integral on the right-hand side of (15) as in the proof of [24, Lem. 5]:

Here the contribution of \(\Im \rho <0\) is the same as the contribution of \(\Im \rho >0\). Therefore, applying Lemma 5.1 along with the elementary inequality

we arrive at

We need to estimate the inner sum in (17). The idea is to drop the condition \(|\Im \rho '|<3x\), and consider the full convergent series

The first equality follows from the Riemann hypothesis, while the second equality follows from [20, Cor. 10.14]. Let us write \(s:=\sqrt{6}+\rho \) for simplicity. Then, as in the proof of [20, Cor. 10.14], we have

We take the real part of both sides, and apply Lemma 2.2:

Using that \(\Re s\!=\!\sqrt{6}+1/2\) and \(\Im s>14\), it is straightforward to check that \(\Re \frac{1}{s-1}<\Re \frac{1}{2s+4}\), hence in fact

To sum up, we have proved that

Going back to (17), we conclude that

In the sum on the right-hand side, we drop the condition \(\Im \rho <3x\) and replace \(|\rho |\) by \(\Im \rho \). By [2, Cor. 1, Lem. 5–6], the resulting bigger sum can be estimated as follows:

In the end, we get

Plugging this bound into (15), we conclude that

Assume now that the prime \(p_\ell \in [x,2x]\) satisfies \(p_{\ell +1}-p_\ell \geqslant N\). There is at most one \(p_\ell \) such that \((p_\ell +p_{\ell +1})/2>2x\), so assume also that \((p_\ell +p_{\ell +1})/2\leqslant 2x\). Then, for any

the interval

is free of primes, hence counting the possible higher prime powers in this interval, we get

That is, \(|E(y,\delta )|>0.997\delta y\) holds on \((p_\ell ,(p_\ell +p_{\ell +1})/2)\). Squaring and integrating, we get

Summing over all such primes \(p_\ell \), and using (18) as well as Theorem 2.3 for the possible single exceptional \(p_\ell \), we obtain (4):

## 6 The error term in the truncated von Mangoldt formula

In this section, we prove Theorem 1.9. We follow Davenport [4, §17] and Goldston [10] with appropriate modifications.

We assume first that \(x\not \in \mathbb {Z}\). We choose \(T\in (z-2,z)\) according to Lemma 2.5, and we also fix \(c:=1+1/\log x\). We record the following approximation to the characteristic function of \((1,\infty )\):

This formula follows by making explicit the calculation on [4, pp. 105–106]. The constant 0.501 follows by observing that the line \(\Re s=c\) divides the circle \(|s|=|c+iT|\) into two almost equal arcs, each of length less than \(1.001\pi |c+iT|\). The constant \(1/\pi \) arises as twice the size of the leading \(1/(2\pi i)\). Applying the formula for \(y=x/n\), multiplying by \(\Lambda (n)\), and summing over \(n\geqslant 1\), we get

We shall abbreviate the integrand in (19) by *f*(*s*), and estimate the error term by cutting the *n*-sum into four parts. Throughout, we keep in mind that \(x/T<x/(x-2)\). As a preparation, we record the elementary inequalities

We also observe that the function

is positive and decreasing (the function has a removable discontinuity at \(y=x\)). Indeed, writing \(v:=\log \frac{x}{y}\), the claim is that \(v\mapsto (e^v-1)/v\) is positive and increasing on \(\mathbb {R}\), which in turn follows from the fact that the exponential function is increasing and convex.

First we consider the *n*’s satisfying \(1\leqslant |x-n|\leqslant \log x\). By (21) and the subsequent observation, in this range we have

hence by (20) also

So the corresponding *n*-subsum within (19) is at most

where

Second, we consider the *n*’s satisfying \(\log x<|x-n|\leqslant x/5\). In this range we have the following variant of (22) proved in the same way:

So the corresponding *n*-subsum within (19) is at most

where we relaxed the summation condition for convenience. If *p*(*u*) denotes the number of prime powers in \([x-u,x+u]\), then the last sum can be written as

Since \(0\leqslant p(u)\leqslant 2u+1\), the first term on the right-hand side is less than 2.001. By the Brun–Titchmarsh inequality in the form given by Montgomery and Vaughan [19, Th. 2], we also see that

Indeed, on the right-hand side, the first term upper bounds the number of primes in \([x-u,x+u]\), while the second term upper bounds the number of higher prime powers in \([x-u,x+u]\). In particular,

We infer from (24)–(26) that the *n*’s satisfying \(\log x<|x-n|\leqslant x/5\) contribute to (19) less than

Now we turn to the *n*’s satisfying \(|x-n|>x/5\). In this range we have \(|\log (x/n)|>\log (6/5)\), hence by Lemma 2.3 the corresponding *n*-subsum is at most

Finally, there are two *n*’s satisfying \(|x-n|<1\), and by (20) their contribution to (19) is less than

Collecting everything, we arrive at (with room to spare)

We note here that \(A(x)+B(x)\) is less than \(2.1\log x\log \log x\).

On the other hand, the residue theorem combined with (8) and Lemma 2.4 shows that

where each integral is over a directed line segment or half-line. We estimate the second integral with the help of (8) and Lemma 2.4:

The third integral obeys the same bound, hence we infer that

By Lemma 2.6, we can extend the \(\rho \)-sum to \(|\Im \rho |<z\) at the cost of an error of \(O^*(2\log x)\). Therefore, going back to (27), we conclude for \(x\not \in \mathbb {Z}\) that

Finally, if *x* is an integer, then we make use of the following simple observation. For a fixed \(z>10^{18}\), the \(\rho \)-sum on the right-hand side is continuous in \(x\in (10^{18},z)\), while the left-hand side equals \(\psi (x-)+\Lambda (x)\). Therefore, the previous formula is valid at *x* with an extra error term of \(O^*(\log x)\). We finish the proof of Theorem 1.9 by noting that

## Data availability

Data sharing not applicable to this article as no datasets were generated or analysed during the current study.

## References

Baker, R.C., Harman, G., Pintz, J.: The difference between consecutive primes II. Proc. London Math. Soc.

**83**, 532–562 (2001). https://doi.org/10.1112/plms/83.3.532Brent, R.P., Platt, D.J., Trudgian, T.S.: The mean square of the error term in the prime number theorem. J. Number Theory

**238**, 740–762 (2022). https://doi.org/10.1016/j.jnt.2021.09.016Carneiro, E., Milinovich, M.B., Soundararajan, K.: Fourier optimization and prime gaps. Comment. Math. Helv.

**94**, 533–568 (2019). https://doi.org/10.4171/CMH/467Davenport, H.: Multiplicative number theory, 3rd ed., Revised and with a preface by H. L. Montgomery, Graduate Texts in Mathematics, Vol. 74, Springer-Verlag, New York, (2000). ISBN:978-0387950976

Delange, H.: Une remarque sur la dérivée logarithmique de la fonction zêta de Riemann [A remark on the logarithmic derivative of the Riemann zeta function]. Colloq. Math. (in French)

**53**, 333–335 (1987). https://doi.org/10.4064/cm-53-2-333-335Dudek, A.W.: An explicit result for primes between cubes. Funct. Approx. Comment. Math.

**55**, 177–197 (2016). https://doi.org/10.7169/facm/2016.55.2.3Erdős, P., Gallai, T.: Gráfok előírt fokú pontokkal (Graphs with vertices of prescribed degrees). Mat. Lapok

**11**, 264–274 (1960). (**in Hungarian**)Erdős, P. L., Kharel, S., Mezei, T. R., Toroczkai, Z.: Degree preserving graph dynamics – a versatile process to construct random networks, submitted, arXiv:2111.11994 (2021), 21 pages

Ford, K., Green, B., Konyagin, S., Maynard, J., Tao, T.: Long gaps between primes. J. Amer. Math. Soc.

**31**, 65–105 (2017). https://doi.org/10.1090/jams/876Goldston, D.A.: On a result of Littlewood concerning prime numbers II. Acta Arith.

**43**, 49–51 (1983)Hakimi, S.L.: On realizability of a set of integers as degrees of the vertices of a linear graph I. J. Soc. Indust. Appl. Math.

**10**, 496–506 (1962)Havel, V.: Poznámka o existenci konečných grafů (A remark on the existence of finite graphs). Časopis Pěst. Mat.

**80**, 477–480 (1955). (**in Czech**)Heath-Brown, D.R.: The differences between consecutive primes. J. London Math. Soc.

**18**, 7–13 (1978). https://doi.org/10.1112/jlms/s2-18.1.7Heath-Brown, D.R.: The differences between consecutive primes III. J. London Math. Soc.

**20**, 177–178 (1979). https://doi.org/10.1112/jlms/s2-20.2.177Ingham, A.E.: On the difference between consecutive primes. Quart. J. Math. Oxford Ser.

**8**, 255–266 (1937). https://doi.org/10.1093/qmath/os-8.1.255Kharel, S., Mezei, T.R., Chung, S., Erdős, P.L., Toroczkai, Z.: Degree-preserving network growth. Nat. Phys.

**18**, 100–106 (2022). https://doi.org/10.1038/s41567-021-01417-7Maynard, J.: On the difference between consecutive primes, arXiv:1201.1787 (2012), 41 pages

Mezei, T. R., Kharel, S., Erdős, P. L., Toroczkai, Z.: On graphic degree sequences and matching numbers, submitted, arXiv:2204.07423 (2022), 12 pages

Montgomery, H.L., Vaughan, R.C.: The large sieve. Mathematika

**20**, 119–134 (1973). https://doi.org/10.1112/S0025579300004708Montgomery, H. L., Vaughan, R. C.: Multiplicative number theory. I. Classical theory, Cambridge Studies in Advanced Mathematics, Vol. 97, Cambridge University Press, Cambridge, 2007. https://doi.org/10.1017/CBO9780511618314

Oliveira e Silva, T., Herzog, S., Pardi, S.: Empirical verification of the even Goldbach conjecture and computation of prime gaps up to \(4\cdot 10^{18}\). Math. Comp.

**83**(2014), 2033–2060. https://doi.org/10.1090/S0025-5718-2013-02787-1Peck, A. S.: On the differences between consecutive primes, PhD thesis, University of Oxford, (1996)

Pittel, B.: Confirming two conjectures about the integer partitions. J. Combin. Theory Ser. A

**88**, 123–135 (1999). https://doi.org/10.1006/jcta.1999.2986Saffari, B., Vaughan, R.C.: On the fractional parts of \(x/n\) and related sequences II. Ann. Inst. Fourier (Grenoble)

**27**, 1–30 (1977). https://doi.org/10.5802/aif.649Selberg, A.: On the normal density of primes in small intervals, and the difference between consecutive primes. Arch. Math. Naturvid.

**47**, 87–105 (1943)Stadlmann, J.: On the mean square gap between primes, arXiv:2212.10867 (2022), 71 pages

Vizing, V.G.: On an estimate of the chromatic class of a \(p\)-graph. Diskret. Analiz.

**3**, 25–30 (1964)Whittaker, E.T., Watson, G.N.: A course of modern analysis, 5th edn. Cambridge University Press, Cambridge (2021). https://doi.org/10.1017/9781009004091

## Acknowledgements

We thank the referee for valuable comments that helped us improve the exposition.

## Funding

Open access funding provided by ELKH Alfréd Rényi Institute of Mathematics.

## Author information

### Authors and Affiliations

### Corresponding author

## Ethics declarations

### Conflict of interest

On behalf of all authors, the corresponding author states that there is no conflict of interest.

## Additional information

*Dedicated to János Pintz on the occasion of his 71st and 73rd birthdays.*

### Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

This work was supported in part by NKFIH (National Research, Development and Innovation Office) Grants SNN 135643 (PLE & TRM), K 132696 (PLE & TRM), K 119528 (GH & PM), KKP 133819 (PM), FK 135218 (PM), NSF (National Science Foundation) Grant IIS-1724297 (ZT), and the MTA Rényi Intézet Lendület Automorphic Research Group (GH & PM).

## Rights and permissions

**Open Access** This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

## About this article

### Cite this article

Erdős, P.L., Harcos, G., Kharel, S.R. *et al.* The sequence of prime gaps is graphic.
*Math. Ann.* **388**, 2195–2215 (2024). https://doi.org/10.1007/s00208-023-02574-1

Received:

Revised:

Accepted:

Published:

Issue Date:

DOI: https://doi.org/10.1007/s00208-023-02574-1