cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A158288 The number of twin prime pairs in the n-th century.

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