A prime gap is the difference between two successive prime numbers, denoted as g_n = p_{n+1} - p_n, where p_n is the n-th prime.[1] The first prime gap is 1 (between 2 and 3), but all subsequent gaps are even and at least 2, since one of any two consecutive integers greater than 2 must be even and thus composite except for 2 itself.[1] By the Prime Number Theorem, the average size of prime gaps around primes near x is approximately \ln x, though individual gaps vary widely.[2]Prime gaps are a fundamental object of study in analytic number theory, providing insights into the irregular distribution of primes along the number line.[2] It has been known since the time of Euclid that there are infinitely many primes, but the gaps between them can be made arbitrarily large; for any positive integer k, there exist k consecutive composite numbers (e.g., n! + 2, n! + 3, \dots, n! + n for n > k), bounding primes on either side.[1] Upper bounds on the maximal gap up to x, denoted G(x), are conjectured to satisfy G(x) \sim (\ln x)^2 by Cramér's model, though proven unconditional bounds are weaker, such as G(x) \ll x^{0.525}, while under the Riemann Hypothesis, G(x) \ll \sqrt{x} \log x.[1][3]Significant progress has also been made on small prime gaps, addressing conjectures like the infinitude of twin primes (gaps of 2).[2] In 2013, Yitang Zhang proved that there are infinitely many prime pairs with gaps bounded by 70 million, a landmark result later improved by the Polymath project to 246 and by Maynard to 12 under certain sieve assumptions.[2] These bounded gap theorems rely on sieve methods and the distribution of primes in arithmetic progressions, highlighting connections to broader problems in additive number theory.[2] Ongoing research continues to refine these bounds and explore the minimal possible liminf of normalized gaps \liminf (p_{n+1} - p_n)/\ln p_n, which equals 0 if sufficiently many small gaps exist.[1]
Fundamentals
Definition
In number theory, a prime gap is defined as the difference between two consecutive prime numbers. Specifically, if p_n denotes the n-th prime number, then the n-th prime gap g_n is given by
g_n = p_{n+1} - p_n.
[1]
This measures the spacing between successive primes in the sequence of all prime numbers, which begins 2, 3, 5, 7, 11, and so on.The notation p_n refers to the ordered sequence of primes, starting with p_1 = 2, p_2 = 3, p_3 = 5, etc. For small values, the prime gaps are g_1 = 1 (between 2 and 3), g_2 = 2 (between 3 and 5), and g_3 = 2 (between 5 and 7).[1] These initial examples illustrate how gaps can be as small as 1 at the outset but typically increase as primes grow larger.An immediate observation is that all prime gaps for n \geq 2 are even integers, since there are no even primes beyond 2 and thus all subsequent primes are odd, making their differences even.[1]The concept of prime gaps appears implicitly in Euclid's proof of the infinitude of primes around 300 BCE, where constructing a new prime larger than any given finite list highlights non-constant spacings between primes.[4] Explicit mathematical study of prime gaps began in the 19th century, with early investigations into prime distribution by figures such as Carl Friedrich Gauss and Adrien-Marie Legendre.[4] Prime gaps relate to the overall distribution of primes up to a number x, as captured by the prime counting function \pi(x), which tallies the primes less than or equal to x.
Basic Properties
Prime gaps exhibit a fundamental parity property: the only odd gap occurs between the first two primes, p_1 = 2 and p_2 = 3, yielding g_1 = 1. For all subsequent gaps where n \geq 2, both p_n and p_{n+1} are odd, as 2 is the only even prime; thus, their difference g_n = p_{n+1} - p_n is even.[5]Gaps of size 2, known as twin primes, represent the smallest even gaps after the initial odd one and occur when both p_n and p_n + 2 are prime. Euclid proved there are infinitely many primes overall, but whether infinitely many twin prime pairs exist—the twin prime conjecture, first stated by de Polignac—remains unresolved despite significant progress on bounded gaps.[6]Early prime gaps reveal patterns of small even differences. The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, producing gaps of 1, 2, 2, 4, 2, 4, 2, 4, 6. These illustrate how gaps of 2, 4, and 6 frequently appear initially, reflecting the relative density of primes among small integers.The sieve of Eratosthenes provides insight into gap formation by systematically eliminating composites—multiples of each prime starting from 2—leaving primes isolated amid the sieved-out numbers, with gap sizes corresponding to runs of these composites.[5]The prime number theorem implies that the average gap between primes up to x is asymptotically \ln x. This arises because the prime-counting function satisfies \pi(x) \sim \frac{x}{\ln x}, so the average gap is roughly \frac{x}{\pi(x)} \sim \ln x.
Numerical Data
Known Gaps
The largest known prime gap as of November 2025 is 16,045,848, occurring between probable primes near a number with about 385,713 digits, discovered by Andreas Höglund in 2024 using advanced computational searches for high-merit gaps. For gaps with fully proven prime endpoints, the record stands at 1,113,106, between two 18,662-digit primes identified in collaborative efforts reported in 2023. These records highlight the role of probable prime testing in extending known gaps beyond regions where complete primality proofs are computationally infeasible.The historical progression of record gaps reflects advances in computing power and algorithms. The first gap exceeding 1,000 was 1,132, found in 1999 by Bertil Nyman after the prime 1,693,182,318,746,371. This was surpassed in 2009 by Tomás Oliveira e Silva's discovery of a 1,476 gap near 1.425 × 10^18, achieved through exhaustive sieving up to 4 × 10^18. Subsequent records include 1,488 in 2017 by Anand S. Nair and 1,676 in 2021 by Brian Kehrig, with the latter confirmed in 2024; larger probable gaps have since pushed records into the millions via targeted hunts for sequences divisible by small primes. These milestones often rely on gap-hunting algorithms that generate long composite runs by ensuring coverage by small prime factors, combined with probabilistic primality tests like Miller-Rabin.Notable gaps near powers of 10 provide concrete examples of gap sizes at specific scales. For instance, the gap following the prime 113 (near 10^2) measures 14, spanning to 127. A much larger example is the 1,132 gap after 1,693,182,318,746,371 (near 10^15), marking the first occurrence of a gap over 1,000. Another significant case is a 282 gap near 1.4 × 10^15, illustrating variability even in similar ranges.Empirical data show maximal gaps scaling roughly like (\ln p_n)^2, where p_n is the starting prime. For example, the largest gap with starting prime below 10^6 is 114 (after 492,113), while up to 10^18 it reaches 1,476 (near 1.425 × 10^18). These figures underscore the logarithmic growth observed in computations across decades.Projects such as PrimeGrid, a distributed computing initiative, have been instrumental in tracking and discovering large gaps by leveraging volunteer resources for sieving vast intervals and verifying probable primes. Similarly, the Prime Gap List Project maintains curated records of first-occurrence and high-merit gaps, fostering collaboration among researchers.
Tabular Results
The initial prime gaps provide a glimpse into the early distribution of primes. The following table lists the first 20 prime gaps g_n = p_{n+1} - p_n, where p_n is the nth prime number.
n
p_n
g_n
1
2
1
2
3
2
3
5
2
4
7
4
5
11
2
6
13
4
7
17
2
8
19
4
9
23
6
10
29
2
11
31
6
12
37
4
13
41
2
14
43
4
15
47
6
16
53
6
17
59
2
18
61
6
19
67
4
20
71
2
Empirical distributions of prime gaps up to $10^6 reveal that smaller even gaps are more frequent, with gap sizes of 2 (twin primes) occurring 8169 times among the 78497 gaps between the 78498 primes less than or equal to $10^6. Larger even gaps appear with decreasing frequency, reflecting the sparser distribution of primes as numbers grow, though gaps tend to cluster around small values.
Gap Size
Frequency up to $10^6
2
8169
4
~10000 (approximate, based on near-equality with gap 2 in early ranges)
6
~13000 (most common small gap)
The table above uses exact data for gap 2 and representative estimates for gaps 4 and 6 derived from computational patterns; exact counts for all small gaps confirm the dominance of multiples of 6 among common gaps.Maximal prime gaps, defined as the largest gap starting from any prime below a given magnitude $10^k, grow logarithmically with the magnitude. The following table summarizes these maximal gaps G(10^k) for k=1 to 20, based on exhaustive computations.
The first significant upper bound on prime gaps was established by Hoheisel in 1930, who proved that there exists a constant \delta > 0 such that the gap g_n between consecutive primes satisfies g_n = O(p_n^{1 - \delta}), with the specific value \delta = 1/33000, yielding g_n \ll p_n^{0.99997}.[7] This result demonstrated that prime gaps grow slower than any linear function of p_n, relying on estimates for the distribution of primes in short arithmetic progressions derived from properties of the Riemann zeta function.[8]Subsequent refinements improved the exponent \theta in the general bound g_n \leq C p_n^\theta for some constant C > 0 and \theta < 1. In 1937, Ingham advanced the bound to \theta = 5/8 + \varepsilon for any \varepsilon > 0, using deeper insights into the zero-free regions of the zeta function to ensure the existence of primes in intervals [x, x + x^{5/8 + \varepsilon}].[9] Further progress in the mid-20th century, including works by Titchmarsh (1942) and Huxley (1972), gradually reduced \theta to around 0.583, incorporating zero-density estimates for zeta function zeros.[7]Modern improvements shifted toward sieve-theoretic methods to guarantee primes in short intervals. A landmark result came from Baker, Harman, and Pintz in 2001, who established g_n \ll p_n^{0.525} unconditionally for sufficiently large p_n, combining sieve techniques with Bombieri-Vinogradov-type theorems on the distribution of primes in arithmetic progressions.[10] As of 2025, this remains the strongest unconditional upper bound, with no further reductions in the exponent achieved through unconditional methods.[7]These upper bounds are typically proved by demonstrating that every interval [x, x + x^\theta] contains at least one prime for large x, which implies the gap bound. Early approaches, like Hoheisel's and Ingham's, exploited zero-free regions near the critical line of the zeta function to control the error in the prime number theorem for short intervals. Later developments, such as those by Baker, Harman, and Pintz, employed upper-bound sieves to isolate prime-like numbers while bounding the contribution of composites, providing a more direct arithmetic guarantee without relying solely on analytic estimates.[9][10]
Lower Bounds
The existence of arbitrarily large prime gaps follows from a simple extension of Euclid's argument for the infinitude of primes. For any integer n \geq 2, the numbers n! + 2, n! + 3, \dots, n! + n are each composite, as n! + k is divisible by k for $2 \leq k \leq n. This sequence of n-1 consecutive composite numbers implies a prime gap of length at least n-1 somewhere near n!. By choosing sufficiently large n, gaps exceeding any fixed bound can be constructed.[11]A refinement of this idea, replacing the factorial with the primorial (the product of the first m primes), yields gaps of size at least p_m - 1, where p_m is the m-th prime. For explicit examples, taking the product of the first k primes for k > 1000 produces a sequence of more than 1000 consecutive composites, ensuring a gap larger than 1000. For instance, with k = 1001, the construction guarantees a gap exceeding 1000 near this primorial.[11]These constructions establish that \limsup_{n \to \infty} g_n / \ln p_n = \infty, first proven by Westzynthius in 1931 using estimates on the distribution of primes in short intervals.[12]Erdős and Rankin developed more sophisticated methods in the late 1930s and early 1940s, incorporating sieving techniques to enlarge the composite intervals beyond the basic primorial construction. Rankin's 1938 approach uses the primorial up to a prime near \exp(c \log p_n / \log \log p_n) and applies a sieve to cover additional residues, yielding gaps of size at least c \ln p_n \frac{\ln \ln p_n}{\ln \ln \ln p_n} for some constant c > 0. This marked a significant improvement over earlier logarithmic bounds.[12]Modern advancements build on the Erdős-Rankin framework by integrating recent sieve theory progress, particularly from small-gap results. In 2014, Ford, Green, Konyagin, and Tao proved that there exist prime gaps g_n \gg \ln p_n \frac{(\ln \ln p_n)^2}{(\ln \ln \ln p_n)^2}, approaching the conjectured maximal order up to constants. Their method refines the sieve coverage to nearly optimize the proportion of composites in the interval, providing the strongest known lower bounds to date.[13]
Conjectures
Asymptotic Conjectures
Asymptotic conjectures on prime gaps primarily concern the expected behavior and distribution of typical gaps around the nth prime p_n, drawing from probabilistic heuristics inspired by the prime number theorem. These models suggest that the average gap g_n = p_{n+1} - p_n is asymptotically \sim \ln p_n, with finer predictions on the distribution of gaps relative to this average. Under the assumption of the Hardy-Littlewood k-tuple conjecture, Gallagher proved that the proportion of gaps exceeding \lambda \ln x up to x follows an exponential distribution: the number of such gaps is (e^{-\lambda} + o(1)) \frac{x}{\ln x}.[14] This heuristic aligns with a Poisson process model for primes, where the probability that a gap exceeds \lambda \ln p_n is approximately e^{-\lambda}.[15]Cramér introduced a random model in 1936, treating integers near x as prime with probability $1/\ln x independently, leading to gap sizes behaving like waiting times in a Poisson process with rate $1/\ln x. In this model, the expected maximum gap up to x is asymptotically \ln^2 x. This predicts that typical large gaps cluster around \ln^2 x for the maximal order, though the model assumes uniformity modulo small primes, which real primes violate due to sieve effects. Granville refined this in 1995 by incorporating biases from the distribution of primes in arithmetic progressions, suggesting the maximal gap is at least \xi \ln^2 x where \xi = 2e^{-\gamma} \approx 1.1229 and \gamma is the Euler-Mascheroni constant; his model predicts gaps slightly larger than Cramér's due to these irregularities.However, these smooth probabilistic models face challenges from observed oscillations in prime distributions. In 1985, Maier developed the matrix method to construct intervals exhibiting abnormal prime counts, providing counterexamples to Cramér's heuristic in certain ranges; specifically, it shows that the number of primes in short intervals [y, y + y^\theta] for \theta > 7/12 can deviate significantly from the expected \sim y^\theta / \ln y, implying irregularities in gap distributions that persist asymptotically. These findings highlight limitations in random models for predicting fine-scale gap behaviors, though they support the overall asymptotic scale of \ln p_n for average gaps.[15]
Maximal Gap Conjectures
In 1936, Harald Cramér formulated a conjecture asserting that the maximal prime gaps grow asymptotically like the square of the natural logarithm of the primes. Specifically, Cramér conjectured that \limsup_{n\to \infty} \frac{g_n}{\ln^2 p_n} = 1, where g_n = p_{n+1} - p_n denotes the gap between consecutive primes p_n and p_{n+1}, implying g_n = O(\ln^2 p_n).[16]Daniel Shanks conjectured in 1964 that the smallest prime p(g) following a gap of at least g consecutive composites satisfies \log p(g) \sim \sqrt{g}, based on probabilistic heuristics. This implies that the first occurrence of a gap of size g happens near p \approx e^{\sqrt{g}}, consistent with maximal gaps G(x) \sim (\ln x)^2.[17]Andrew Granville modified Cramér's conjecture around 1995, incorporating biases observed in prime races—systematic deviations in the distribution of primes among residue classes—to argue that the original model underestimates maximal gaps. Granville's adjustment posits \limsup_{n\to \infty} \frac{g_n}{\ln^2 p_n} \geq 2e^{-\gamma} \approx 1.1229, where \gamma is the Euler-Mascheroni constant, suggesting slightly larger gaps due to these distributional asymmetries. Soundararajan contributed to related analyses of such biases, supporting the heuristic foundation for this refinement.[18]Under the Riemann Hypothesis (RH), Cramér himself established that g_n = O(\sqrt{p_n} \ln p_n), a weaker bound than the conjecture; however, the full conjectured order remains unproven even assuming RH.[16]If Cramér's conjecture (or its refinements) holds, it implies the existence of primes in every interval of length approximately \ln^2 x up to x for sufficiently large x, providing a strong quantitative form of the intuition that primes become sparser but remain sufficiently dense.[16]
Advanced Topics
Arithmetic Progression
The prime gap function, denoted g(n), is defined as the difference between consecutive prime numbers: g(n) = p_{n+1} - p_n for n \geq 1, where p_n denotes the nth prime number starting with p_1 = 2.[1] This function captures the spacing between primes and serves as an arithmetic sequence indexed by the prime count. A key property arises from its telescoping nature: the partial sum \sum_{k=1}^m g(k) = p_{m+1} - p_1 = p_{m+1} - 2.[19]The summatory function of the prime gaps, G(x) = \sum_{\{n : p_n \leq x\}} g(n), sums the gaps up to the largest prime not exceeding x. Let m = \pi(x), the prime-counting function, so the sum runs over the first m gaps and equals p_{m+1} - 2. Since p_m \leq x < p_{m+1} and the prime number theorem implies p_{m+1} \sim x as x \to \infty, it follows that G(x) \sim x.[20] This asymptotic equivalence reflects the overall length covered by the primes up to x, adjusted by the initial offset of 2.Generating functions for the prime gaps include Dirichlet series of the form \sum_{n=1}^\infty g(n) n^{-s} for \Re(s) > 1, which encode the gaps' growth in a multiplicative framework. Although not directly multiplicative, this series relates to derivatives of the Riemann zeta function, as the average gap size \sim \log n suggests connections to -\zeta'(s)/\zeta(s) = \sum_{n=1}^\infty (\log n) n^{-s}, with adjustments for the prime indexing.[21]The prime gap function g(n) lacks multiplicativity, meaning g(mn) \neq g(m)g(n) in general for coprime m, n, due to the irregular distribution of primes. However, gaps exhibit relations in arithmetic progressions of primes, such as those congruent to a fixed residue a modulo m with \gcd(a, m) = 1. Dirichlet's theorem ensures infinitely many such primes, and modern results bound gaps within these progressions; for instance, primes in arithmetic progressions to smooth moduli up to x^{1/2 + 1/40 - \epsilon} are equidistributed on average below x, implying controlled gap behavior in these subsets.[22]Advanced analytic connections link prime gaps to explicit formulae involving the von Mangoldt function \Lambda(n), defined as \log p if n = p^k for prime p and k \geq 1, and 0 otherwise. The Riemann-von Mangoldt explicit formula expresses the Chebyshev function \psi(x) = \sum_{n \leq x} \Lambda(n) \approx x - \sum_\rho x^\rho / \rho, where the sum is over nontrivial zeros \rho of \zeta(s). This provides oscillatory insights into prime distribution, with gap-specific implications derived from differences in \psi(x), such as bounds on maximal gaps via zero spacings, though direct gap formulae remain limited.
Distribution and Patterns
The distribution of prime gaps is a central topic in analytic number theory, with probabilistic models providing key insights into their statistical behavior. Under the Hardy–Littlewood k-tuple conjecture, Gallagher proved in 1976 that the gaps between consecutive primes near p_n follow a Poisson distribution with mean \ln p_n.[14] This result aligns with the intuitive random model for primes, where each integer near p_n has an independent probability of approximately $1/\ln p_n of being prime, leading to exponentially distributed gaps. In this model, the probability that a gap exceeds \alpha \ln p_n is asymptotically e^{-\alpha}:\mathbb{P}(g(p_n) > \alpha \ln p_n) \approx e^{-\alpha}.This approximation captures the typical scale of gaps but overlooks finer structures.A notable pattern is the clustering of small gaps, where sequences of primes occur closer together than the average spacing would suggest, forming prime constellations or k-tuples. For instance, the primes 5, 7, and 11 form a constellation with successive gaps of 2 and 4, illustrating how small even gaps (often multiples of 2 or 6 due to modular constraints) tend to appear in proximity.[23] The Hardy–Littlewood conjecture predicts that such constellations occur with positive density, contributing to the observed tendency for small gaps to bunch rather than distribute uniformly. This clustering effect is empirically evident in the prime number race and biases toward certain gap patterns, such as an overrepresentation of gap pairs like (2,4) relative to independent random expectations.[24]However, the distribution exhibits irregularities that challenge the Poisson model. In 1985, Maier demonstrated that for short intervals of length (\log x)^\lambda with \lambda > 1, there exist intervals around x containing significantly fewer primes than predicted by the random model or the prime number theorem, with the count sometimes dropping below the expected \lambda \log \log x.[25] This "Maier phenomenon" highlights oscillations in prime density on logarithmic scales, affecting gap statistics by creating regions of larger-than-average gaps and underscoring the limitations of purely probabilistic heuristics.Recent advances have refined our understanding of gap patterns through sieve methods. The GPY sieve, developed by Goldston, Pintz, and Yıldırım in 2009, laid the groundwork for proving bounded small gaps. Building on this, Yitang Zhang established in 2013 the existence of infinitely many gaps bounded by 70 million, later improved by the Polymath project to 246 in 2014. Independently, James Maynard in 2015 proved an unconditional bound of 600 using a new sieve method and 12 assuming the Elliott-Halberstam conjecture for larger k-tuples.[26] These results confirm the infinitude of clustered small gaps, aligning with but surpassing conjectural expectations from the Poisson framework.