A038460 Maximal value of difference between successive primes among numbers < 10^n.
2, 8, 20, 36, 72, 114, 154, 220, 282, 354, 464, 540, 674, 804, 906, 1132, 1220, 1442, 1510
Offset: 1
Examples
Of the 25 primes less than 100, the maximum difference between two consecutive primes is 8 (at 97 - 89), so a(2)=8.
References
- Enoch Haga, Exploring Prime Numbers on Your PC, 2nd edition, 1998, ISBN 1-885794-16-9, Table 3.
Links
- Jens Kruse Andersen, Record prime gaps, current version maintained by Norman Luhn.
- C. K. Caldwell, Prime gaps
- Wikipedia, Brocard's conjecture
Programs
-
Mathematica
a[1] = 2; a[n_] := a[n] = Module[{m, p, q}, m = a[n-1]; p = NextPrime[10^(n - 1), -1]; For[q = NextPrime[p], q < 10^n, q = NextPrime[q], m = Max[m, q - p]; p = q]; m]; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 10}] (* Jean-François Alcover, May 16 2017 *) Table[Differences[Prime[Range[PrimePi[10^n]]]]//Max,{n,10}] (* The program generates the first 10 terms of the sequence. *) (* Harvey P. Dale, Sep 11 2024 *)
-
PARI
a(n) = {dmax = 0; minp = 2; forprime(p=3, 10^n, if ((d = (p - minp)) > dmax, dmax = d); minp = p;); dmax;} \\ Michel Marcus, May 25 2014
-
PARI
m=0;L=1;o=2;forprime(p=3,10^9,m+o>=(o=p)&&next;#Str(p)>L&&!print1(m" /*"L"*/, ")&&L=#Str(p);m=p-precprime(p-1)) \\ Too slow for n>9. M. F. Hasler, Dec 29 2014
Extensions
Two more terms (282, 354) from Jud McCranie
Terms 464 through 1442 from Manfred W. K. Huppertz (huppi-manni(AT)hesit.de), Aug 18 2009
a(19) from Hugo Pfoertner, using data from pzktupel webpage. Jan 21 2025
Comments