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!)
A105161 Difference between n and the second-smallest prime larger than n. 3

%I #14 Mar 02 2021 15:54:45

%S 3,2,3,4,3,6,5,6,5,4,3,6,5,6,5,4,3,6,5,10,9,8,7,8,7,6,5,4,3,8,7,10,9,

%T 8,7,6,5,6,5,4,3,6,5,10,9,8,7,12,11,10,9,8,7,8,7,6,5,4,3,8,7,10,9,8,7,

%U 6,5,6,5,4,3,8,7,10,9,8,7,6,5,10,9,8,7,14,13,12,11,10,9,12,11,10,9,8,7,6,5

%N Difference between n and the second-smallest prime larger than n.

%H Charles R Greathouse IV, <a href="/A105161/b105161.txt">Table of n, a(n) for n = 0..10000</a>

%F a(n) = prime(pi(n)+2) - n.

%p with(numtheory); A105161:=n->ithprime(pi(n) + 2); seq(A105161(n), n=0..100); # _Wesley Ivan Hurt_, Feb 26 2014

%t Table[Prime[PrimePi[n] + 2], {n, 0, 100}] (* _Wesley Ivan Hurt_, Feb 26 2014 *)

%o (PARI) a(n) = prime(primepi(n)+2) - n; \\ _Michel Marcus_, Oct 09 2013

%o (PARI) a(n)=nextprime(nextprime(n+1)+1)-n \\ _Charles R Greathouse IV_, Oct 09 2013

%o (Python)

%o from sympy import nextprime

%o def a(n): return nextprime(nextprime(n)) - n

%o print([a(n) for n in range(97)]) # _Michael S. Branicky_, Mar 02 2021

%Y Cf. A101300.

%K nonn,easy

%O 0,1

%A _Zak Seidov_, Apr 29 2005

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 March 28 18:04 EDT 2024. Contains 371254 sequences. (Running on oeis4.)