A168141 a(n) = pi(n + 1) - pi(n - 2), where pi is the prime counting function.
1, 2, 2, 2, 1, 2, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 2, 1, 1, 0
Offset: 1
Keywords
Links
- Antti Karttunen, Table of n, a(n) for n = 1..20000
- Eric Weisstein's World of Mathematics, Twin Prime Conjecture
- Wikipedia, Twin prime
Programs
-
Maple
A168141 := proc(n) numtheory[pi](n+1)-numtheory[pi](n-2) ; end proc: seq(A168141(n),n=1..120) ; # R. J. Mathar, Nov 19 2009 # second Maple program: a:= n-> add(`if`(isprime(n+i), 1, 0), i=-1..1): seq(a(n), n=1..120); # Alois P. Heinz, Apr 28 2020
-
Mathematica
Table[PrimePi[n + 1] - PrimePi[n - 2], {n, 100}] (* Wesley Ivan Hurt, Apr 26 2020 *)
-
PARI
a(n) = primepi(n+1) - primepi(n-2); \\ Michel Marcus, Apr 27 2020
Formula
From Alois P. Heinz, Apr 28 2020: (Start)
a(n) = 2 <=> n in { 2,3 } union { A014574 }.
a(n) = 0 <=> n in A079364. (End)
Comments