The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
FORMULA
a(n) = prime(pi(n)+2) - n.
MAPLE
with(numtheory); A105161:=n->ithprime(pi(n) + 2); seq(A105161(n), n=0..100); # Wesley Ivan Hurt, Feb 26 2014
MATHEMATICA
Table[Prime[PrimePi[n] + 2], {n, 0, 100}] (* Wesley Ivan Hurt, Feb 26 2014 *)
PROG
(PARI) a(n) = prime(primepi(n)+2) - n; \\ Michel Marcus, Oct 09 2013
(PARI) a(n)=nextprime(nextprime(n+1)+1)-n \\ Charles R Greathouse IV, Oct 09 2013
(Python)
from sympy import nextprime
def a(n): return nextprime(nextprime(n)) - n
print([a(n) for n in range(97)]) # Michael S. Branicky, Mar 02 2021
CROSSREFS
Cf. A101300.
Sequence in context: A349351 A147658 A221529 * A275769 A094365 A272886
KEYWORD
nonn,easy
AUTHOR
Zak Seidov, Apr 29 2005
STATUS
approved

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 June 12 04:45 EDT 2024. Contains 373321 sequences. (Running on oeis4.)