[go: up one dir, main page]

login
A000230
a(0)=2; for n>=1, a(n) = smallest prime p such that there is a gap of exactly 2n between p and next prime, or -1 if no such prime exists.
(Formerly M2685 N1075)
107
2, 3, 7, 23, 89, 139, 199, 113, 1831, 523, 887, 1129, 1669, 2477, 2971, 4297, 5591, 1327, 9551, 30593, 19333, 16141, 15683, 81463, 28229, 31907, 19609, 35617, 82073, 44293, 43331, 34061, 89689, 162143, 134513, 173359, 31397, 404597, 212701, 188029, 542603, 265621, 461717, 155921, 544279, 404851, 927869, 1100977, 360653, 604073
OFFSET
0,1
COMMENTS
p + 1 = A045881(n) starts the smallest run of exactly 2n-1 successive composite numbers. - Lekraj Beedassy, Apr 23 2010
Weintraub gives upper bounds on a(252), a(255), a(264), a(273), and a(327) based on a search from 1.1 * 10^16 to 1.1 * 10^16 + 1.5 * 10^9, probably performed on a 1970s microcomputer. - Charles R Greathouse IV, Aug 26 2022
REFERENCES
N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 0..672, extracted from T. Olivera e Silva's webpage.
L. J. Lander and T. R. Parkin, On the first appearance of prime differences, Math. Comp., 21 (1967), 483-488.
Thomas R. Nicely, First occurrence prime gaps [For local copy see A000101]
Tomás Oliveira e Silva, Gaps between consecutive primes
Sol Weintraub, A large prime gap, Mathematics of Computation Vol. 36, No. 153 (Jan 1981), p. 279.
J. Young and A. Potler, First occurrence prime gaps, Math. Comp., 52 (1989), 221-224.
Yitang Zhang, Bounded gaps between primes, Annals of Mathematics, Volume 179 (2014), Issue 3, pp. 1121-1174.
FORMULA
a(n) = A000040(A038664(n)). - Lekraj Beedassy, Sep 09 2006
EXAMPLE
The following table, based on a very much larger table in the web page of Tomás Oliveira e Silva (see link) shows, for each gap g, P(g) = the smallest prime such that P(g)+g is the smallest prime number larger than P(g);
* marks a record-holder: g is a record-holder if P(g') > P(g) for all (even) g' > g, i.e., if all prime gaps are smaller than g for all primes smaller than P(g); P(g) is a record-holder if P(g') < P(g) for all (even) g' < g.
This table gives rise to many sequences: P(g) is A000230, the present sequence; P(g)* is A133430; the positions of the *'s in the P(g) column give A100180, A133430; g* is A005250; P(g*) is A002386; etc.
-----
g P(g)
-----
1* 2*
2* 3*
4* 7*
6* 23*
8* 89*
10 139*
12 199*
14* 113
16 1831*
18* 523
20* 887
22* 1129
24 1669
26 2477*
28 2971*
30 4297*
32 5591*
34* 1327
36* 9551*
........
The first time a gap of 4 occurs between primes is between 7 and 11, so a(2)=7 and A001632(2)=11.
MATHEMATICA
Join[{2}, With[{pr = Partition[Prime[Range[86000]], 2, 1]}, Transpose[ Flatten[ Table[Select[pr, #[[2]] - #[[1]] == 2n &, 1], {n, 50}], 1]][[1]]]] (* Harvey P. Dale, Apr 20 2012 *)
PROG
(PARI) a(n)=my(p=2); forprime(q=3, , if(q-p==2*n, return(p)); p=q) \\ Charles R Greathouse IV, Nov 20 2012
(Perl) use ntheory ":all"; my($l, $i, @g)=(2, 0); forprimes { $g[($_-$l) >> 1] //= $l; while (defined $g[$i]) { print "$i $g[$i]\n"; $i++; } $l=$_; } 1e10; # Dana Jacobsen, Mar 29 2019
(Python)
import numpy
from sympy import sieve as prime
aupto = 50
A000230 = np.zeros(aupto+1, dtype=object)
A000230[0], it = 2, 2
while all(A000230) == 0:
gap = (prime[it+1] - prime[it]) // 2
if gap <= aupto and A000230[gap] == 0: A000230[gap] = prime[it]
it += 1
print(list(A000230)) # Karl-Heinz Hofmann, Jun 07 2023
CROSSREFS
A001632(n) = 2n + a(n) = nextprime(a(n)).
Cf. A100964 (least prime number that begins a prime gap of at least 2n).
Sequence in context: A163834 A335366 A002386 * A256454 A133429 A087770
KEYWORD
nonn,nice
EXTENSIONS
a(29)-a(37) from Jud McCranie, Dec 11 1999
a(38)-a(49) from Robert A. Stump (bee_ess107(AT)yahoo.com), Jan 11 2002
"or -1 if ..." added to definition at the suggestion of Alexander Wajnberg by N. J. A. Sloane, Feb 02 2020
STATUS
approved