[go: up one dir, main page]

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!)
A031131 Difference between n-th prime and (n+2)-nd prime. 41

%I #68 Oct 11 2022 00:17:12

%S 3,4,6,6,6,6,6,10,8,8,10,6,6,10,12,8,8,10,6,8,10,10,14,12,6,6,6,6,18,

%T 18,10,8,12,12,8,12,10,10,12,8,12,12,6,6,14,24,16,6,6,10,8,12,16,12,

%U 12,8,8,10,6,12,24,18,6,6,18,20,16,12,6,10,14,14,12,10,10,14,12,12,18,12,12,12

%N Difference between n-th prime and (n+2)-nd prime.

%C Distance between the pair of primes adjacent to the (n+1)-st prime. - _Lekraj Beedassy_, Oct 01 2004 [Typo corrected by _Zak Seidov_, Feb 22 2009]

%C A031131(A261525(n)) = 2*n and A031131(m) != 2*n for m < A261525(n). - _Reinhard Zumkeller_, Aug 23 2015

%C The Polymath project 8b proved that a(n) <= 395106 infinitely often (their published paper contains the slightly weaker bound a(n) <= 398130 infinitely often). - _Charles R Greathouse IV_, Jul 22 2016

%H T. D. Noe, <a href="/A031131/b031131.txt">Table of n, a(n) for n = 1..10000</a>

%H D. H. J. Polymath, <a href="https://doi.org/10.1186/s40687-014-0012-7">Variants of the Selberg sieve, and bounded intervals containing many primes</a>, Research in the Mathematical Sciences 1:12 (2014).

%H Polymath project, <a href="http://michaelnielsen.org/polymath1/index.php?title=Bounded_gaps_between_primes">Bounded gaps between primes</a>

%F a(n) = A001223(n) + A001223(n-1). - _Lior Manor_ Jan 19 2005

%F a(n) = A000040(n+2) - A000040(n).

%e a(10)=8 because the 10th prime=29 is followed by primes 31 and 37, and 37 - 29 = 8.

%p P:= select(isprime, [2,seq(2*i+1,i=1..1000)]):

%p P[3..-1] - P[1..-3]; # _Robert Israel_, Jan 25 2015

%t Differences[lst_]:=Drop[lst,2]-Drop[lst,-2]; Differences[Prime[Range[123]]] (* _Vladimir Joseph Stephan Orlovsky_, Aug 13 2009 *)

%t Map[#3 - #1 & @@ # &, Partition[Prime@ Range[84], 3, 1]] (* _Michael De Vlieger_, Dec 17 2017 *)

%o (MuPAD) ithprime(i+2)-ithprime(i) $ i = 1..65 // _Zerinvary Lajos_, Feb 26 2007

%o (Sage)

%o BB = primes_first_n(67)

%o L = []

%o for i in range(65):

%o L.append(BB[2+i]-BB[i])

%o L

%o # _Zerinvary Lajos_, May 14 2007

%o (Magma) [NthPrime(n+2)-NthPrime(n): n in [1..100] ]; // _Vincenzo Librandi_, Apr 11 2011

%o (PARI) a(n)=my(p=prime(n));nextprime(nextprime(p+1)+1)-p \\ _Charles R Greathouse IV_, Jul 01 2013

%o (Haskell)

%o a031131 n = a031131_list !! (n-1)

%o a031131_list = zipWith (-) (drop 2 a000040_list) a000040_list

%o -- _Reinhard Zumkeller_, Dec 19 2013

%Y Sum of consecutive terms of A001223.

%Y Cf. A031132, A031133, A031134, A122412, A122413,A046931, A000040, A031165, A031166, A031167, A031168, A031169, A031170, A031171, A031172, A261525.

%Y Cf. A075527 (allowing 1 to be prime).

%Y First differences of A001043.

%K nonn

%O 1,1

%A _Jeff Burch_

%E Corrected by _T. D. Noe_, Sep 11 2008

%E Edited by _N. J. A. Sloane_, Sep 18 2008, at the suggestion of _T. D. Noe_

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 August 29 09:35 EDT 2024. Contains 375511 sequences. (Running on oeis4.)