%I #32 Jul 25 2024 02:43:09
%S 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,
%T 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,
%U 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
%N The number of twin prime pairs in the n-th century.
%C The number of members of A001359 from 100*n-99 to 100*n-3. - _Robert Israel_, Jul 19 2017
%H Robert Israel, <a href="/A158288/b158288.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = A071538(100*n-3) - A071538(100*n-100). - _Robert Israel_, Jul 19 2017
%p f:= proc(n) local P;
%p P:= select(isprime, {seq(i,i=100*n-99..100*n-1,2)});
%p nops(P intersect map(`+`,P,2))
%p end proc:
%p map(f, [$1..200]); # _Robert Israel_, Jul 19 2017
%t 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 *)
%o (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
%o (Python)
%o from sympy import primerange, isprime
%o def a(n):
%o s=0
%o for p in primerange(100*n - 99, 100*n - 1):
%o if isprime(p + 2):s+=1
%o return s
%o print([a(n) for n in range(1, 201)]) # _Indranil Ghosh_, Jul 20 2017, after PARI code
%Y Cf. A001359, A071538.
%K nonn
%O 1,1
%A _Ki Punches_, Mar 15 2009
%E Corrected by _Ray Chandler_, May 23 2009