A158288 The number of twin prime pairs in the n-th century.
8, 7, 4, 2, 3, 2, 3, 0, 5, 0, 5, 1, 3, 2, 4, 0, 4, 2, 2, 3, 3, 3, 2, 3, 0, 2, 2, 3, 1, 1, 0, 2, 2, 4, 2, 4, 1, 1, 2, 2, 4, 2, 5, 1, 2, 2, 2, 2, 0, 2, 2, 0, 2, 0, 3, 2, 3, 1, 3, 0, 1, 2, 1, 1, 1, 2, 2, 4, 2, 2, 0, 1, 1, 3, 2, 3, 0, 1, 1, 1, 2, 0, 3, 1, 1, 2, 1, 0, 3, 1, 2, 0, 2, 1, 4, 0, 2, 2, 1, 1, 4, 1, 1, 2, 2
Offset: 1
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
f:= proc(n) local P; P:= select(isprime, {seq(i,i=100*n-99..100*n-1,2)}); nops(P intersect map(`+`,P,2)) end proc: map(f, [$1..200]); # Robert Israel, Jul 19 2017
-
Mathematica
Table[Count[Prime@ Range[Boole[n == 1] + PrimePi[100 (n - 1) + 1], PrimePi[100 n] - 1], ?(PrimeQ[# + 2] &)], {n, 105}] (* _Michael De Vlieger, Jul 20 2017 *)
-
PARI
a(n)=my(s=0);forprime(p=100*n-99,100*n-2,if(isprime(p+2),s++));s \\ Charles R Greathouse IV, Feb 03 2011
-
Python
from sympy import primerange, isprime def a(n): s=0 for p in primerange(100*n - 99, 100*n - 1): if isprime(p + 2):s+=1 return s print([a(n) for n in range(1, 201)]) # Indranil Ghosh, Jul 20 2017, after PARI code
Formula
Extensions
Corrected by Ray Chandler, May 23 2009
Comments