A005250 - OEIS (original) (raw)

A005250

Record gaps between primes.
(Formerly M0994)

68

1, 2, 4, 6, 8, 14, 18, 20, 22, 34, 36, 44, 52, 72, 86, 96, 112, 114, 118, 132, 148, 154, 180, 210, 220, 222, 234, 248, 250, 282, 288, 292, 320, 336, 354, 382, 384, 394, 456, 464, 468, 474, 486, 490, 500, 514, 516, 532, 534, 540, 582, 588, 602, 652

COMMENTS

Here a "gap" means prime(n+1) - prime(n), but in other references it can mean prime(n+1) - prime(n) - 1.

a(n+1)/a(n) <= 2, for all n <= 80, and a(n+1)/a(n) < 1 + f(n)/a(n) with f(n)/a(n) <= epsilon for some function f(n) and with 0 < epsilon <= 1. It also appears, with the small amount of data available, for all n <= 80, that a(n+1)/a(n) ~ 1. - John W. Nicholson, Jun 08 2014, updated Aug 05 2019

Equivalent to the above statement, A053695(n) = a(n+1) - a(n) <= a(n). - John W. Nicholson, Jan 20 2016

Conjecture: a(n) = O(n^2); specifically, a(n) <= n^2. - Alexei Kourbatov, Aug 05 2017

Conjecture: below the k-th prime, the number of maximal gaps is about 2*log(k), i.e., about twice as many as the expected number of records in a sequence of k i.i.d. random variables (see arXiv:1709.05508 for a heuristic explanation). - Alexei Kourbatov, Mar 16 2018

REFERENCES

B. C. Berndt, Ramanujan's Notebooks Part IV, Springer-Verlag, see p. 133.

R. K. Guy, Unsolved Problems in Number Theory, A8.

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

MATHEMATICA

nn=10^7; Module[{d=Differences[Prime[Range[nn]]], ls={1}}, Table[If[d[[n]]> Last[ls], AppendTo[ls, d[[n]]]], {n, nn-1}]; ls] (* Harvey P. Dale, Jul 23 2012 *)

DeleteDuplicates[Differences[Prime[Range[10^7]]], GreaterEqual] (* The program generates the first 26 terms of the sequence. *) (* Harvey P. Dale, May 12 2022 *)

PROG

(PARI) p=q=2; g=0; until( g<(q=nextprime(1+p=q))-p & print1(g=q-p, ", "), ) \\ M. F. Hasler, Dec 13 2007

(PARI) p=2; g=0; m=g; forprime(q=3, 10^13, g=q-p; if(g>m, print(g", ", p, ", ", q); m=g); p=q) \\ John W. Nicholson, Dec 18 2016

(Haskell)

a005250 n = a005250_list !! (n-1)

a005250_list = f 0 a001223_list

where f m (x:xs) = if x <= m then f m xs else x : f x xs

EXTENSIONS

More terms from Andreas Boerner (andreas.boerner(AT)altavista.net), Jul 11 2000