login
Number of twin primes between n and 2n: a(n) = number of j in range n <= j <= 2*n such that j and j+2 are primes.
4

%I #13 Aug 22 2021 19:04:57

%S 0,1,2,1,1,1,1,1,2,2,2,1,1,1,2,2,2,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,

%T 2,3,3,3,3,3,3,2,2,2,2,2,2,2,2,2,3,3,3,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,

%U 4,4,4,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,7,7,7,6,6,6,6

%N Number of twin primes between n and 2n: a(n) = number of j in range n <= j <= 2*n such that j and j+2 are primes.

%H T. D. Noe, <a href="/A080356/b080356.txt">Table of n, a(n) for n=1..10000</a>

%e n=36: between 36 and 72 the primes p such that (p,p+2) is a pair of twin primes are {41,59,71}, so a(36)=3.

%t Table[Count[Table[PrimeQ[j]&&PrimeQ[j+2], {j, n, 2*n}], True], {n, 1, 1000}]

%Y Cf. A001359, A071538.

%K nonn

%O 1,3

%A _Labos Elemer_, Feb 19 2003

%E Definition clarified by _N. J. A. Sloane_, Aug 22 2021