login
Number of pairs of twin primes <= 10^n-th prime.
2

%I #49 Jan 24 2024 08:01:05

%S 4,25,174,1270,10250,86027,738597,6497407,58047180,524733511,

%T 4789919653,44073509102,408231310520

%N Number of pairs of twin primes <= 10^n-th prime.

%C This sequence is >= the values of pi(10^n): 4, 25, 168, 1229, ... in A006880.

%C a(0) = 0. - _Eduard Roure Perdices_, Dec 23 2022

%D Enoch Haga, "Wandering through a prime number desert," Table 6, in Exploring prime numbers on your PC and the Internet, 2001 (ISBN 1-885794-17-7).

%H Soren Laing Aletheia-Zomlefer, Lenny Fukshansky, and Stephan Ramon Garcia, <a href="https://arxiv.org/abs/1807.08899">The Bateman-Horn Conjecture: Heuristics, History, and Applications</a>, arXiv:1807.08899 [math.NT], 2018-2019. See Table 5 p. 40.

%H Thomas R. Nicely, <a href="https://faculty.lynchburg.edu/~nicely/counts.html">Twin prime count</a>.

%H <a href="/index/Pri#primepop">Index entries for sequences related to numbers of primes in various ranges</a>

%F Count twin primes <= p_{10^n}: 10th prime, 100th prime, etc.

%e a(1) = 4 because there are 4 twin primes <= 29, the 10th prime: (3,5), (5,7), (11,13), and (17,19). (29,31) is not counted because it is not entirely <= 29.

%t NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; c = 0; p = q = 1; Do[l = Prime[10^n]; While[q <= l, If[p + 2 == q, c++ ]; p = q; q = NextPrim[p]]; Print[c], {n, 12}] (* _Robert G. Wilson v_, Apr 10 2004 *)

%o (Python)

%o from sympy import prime, sieve # use primerange for larger terms

%o def afind(terms):

%o c, prevp = 0, 1

%o for n in range(1, terms+1):

%o for p in sieve.primerange(prevp+1, prime(10**n)+1):

%o if prevp == p - 2: c += 1

%o prevp = p

%o print(c, end=", ")

%o afind(6) # _Michael S. Branicky_, Apr 25 2021

%Y See A049035 for another version. - _R. J. Mathar_, Sep 05 2008

%Y Cf. A006880, A007508.

%K nonn,more

%O 1,1

%A _Enoch Haga_, Apr 09 2004

%E a(9) from _Michael S. Branicky_, Apr 25 2021

%E a(10) from _Eduard Roure Perdices_, May 08 2021

%E a(11) from _Eduard Roure Perdices_, Feb 03 2022

%E a(12) from _Eduard Roure Perdices_, Dec 23 2022

%E a(13) from _Eduard Roure Perdices_, Jan 24 2024