login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I M2685 N1075 #151 Jun 07 2023 11:51:45

%S 2,3,7,23,89,139,199,113,1831,523,887,1129,1669,2477,2971,4297,5591,

%T 1327,9551,30593,19333,16141,15683,81463,28229,31907,19609,35617,

%U 82073,44293,43331,34061,89689,162143,134513,173359,31397,404597,212701,188029,542603,265621,461717,155921,544279,404851,927869,1100977,360653,604073

%N 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.

%C p + 1 = A045881(n) starts the smallest run of exactly 2n-1 successive composite numbers. - _Lekraj Beedassy_, Apr 23 2010

%C 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

%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).

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

%H Hugo Pfoertner, <a href="/A000230/b000230.txt">Table of n, a(n) for n = 0..672</a>, extracted from T. Olivera e Silva's webpage.

%H A. Booker, <a href="https://t5k.org/nthprime">The Nth Prime Page</a>

%H L. J. Lander and T. R. Parkin, <a href="http://dx.doi.org/10.1090/S0025-5718-1967-0230677-4">On the first appearance of prime differences</a>, Math. Comp., 21 (1967), 483-488.

%H Thomas R. Nicely, <a href="https://faculty.lynchburg.edu/~nicely/gaps/gaplist.html">First occurrence prime gaps</a> [For local copy see A000101]

%H Tomás Oliveira e Silva, <a href="http://sweet.ua.pt/tos/gaps.html">Gaps between consecutive primes</a>

%H J. Thonnard, <a href="http://www.proftnj.com/calcprem.htm">Les nombres premiers (Primality check; Closest next prime; Factorizer)</a>

%H Sol Weintraub, <a href="https://doi.org/10.1090/S0025-5718-1981-0595062-1">A large prime gap</a>, Mathematics of Computation Vol. 36, No. 153 (Jan 1981), p. 279.

%H J. Young and A. Potler, <a href="http://dx.doi.org/10.1090/S0025-5718-1989-0947470-1">First occurrence prime gaps</a>, Math. Comp., 52 (1989), 221-224.

%H Yitang Zhang, <a href="https://doi.org/10.4007/annals.2014.179.3.7">Bounded gaps between primes</a>, Annals of Mathematics, Volume 179 (2014), Issue 3, pp. 1121-1174.

%H <a href="/index/Pri#gaps">Index entries for primes, gaps between</a>

%F a(n) = A000040(A038664(n)). - _Lekraj Beedassy_, Sep 09 2006

%e 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);

%e * 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.

%e 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.

%e -----

%e g P(g)

%e -----

%e 1* 2*

%e 2* 3*

%e 4* 7*

%e 6* 23*

%e 8* 89*

%e 10 139*

%e 12 199*

%e 14* 113

%e 16 1831*

%e 18* 523

%e 20* 887

%e 22* 1129

%e 24 1669

%e 26 2477*

%e 28 2971*

%e 30 4297*

%e 32 5591*

%e 34* 1327

%e 36* 9551*

%e ........

%e The first time a gap of 4 occurs between primes is between 7 and 11, so a(2)=7 and A001632(2)=11.

%t 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 *)

%o (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

%o (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

%o (Python)

%o import numpy

%o from sympy import sieve as prime

%o aupto = 50

%o A000230 = np.zeros(aupto+1, dtype=object)

%o A000230[0], it = 2, 2

%o while all(A000230) == 0:

%o gap = (prime[it+1] - prime[it]) // 2

%o if gap <= aupto and A000230[gap] == 0: A000230[gap] = prime[it]

%o it += 1

%o print(list(A000230)) # _Karl-Heinz Hofmann_, Jun 07 2023

%Y A001632(n) = 2n + a(n) = nextprime(a(n)).

%Y Cf. A001223, A002386, A005250, A045881, A038664.

%Y Cf. A100964 (least prime number that begins a prime gap of at least 2n).

%Y Cf. also A133429 (records), A133430, A100180, A226657, A229021, A229028, A229030, A229033, A229034.

%K nonn,nice

%O 0,1

%A _N. J. A. Sloane_

%E a(29)-a(37) from _Jud McCranie_, Dec 11 1999

%E a(38)-a(49) from Robert A. Stump (bee_ess107(AT)yahoo.com), Jan 11 2002

%E "or -1 if ..." added to definition at the suggestion of Alexander Wajnberg by _N. J. A. Sloane_, Feb 02 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 12:14 EDT 2024. Contains 371792 sequences. (Running on oeis4.)