[go: up one dir, main page]

login
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
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