login
Number of prime pairs below 10^n having a difference of 4.
3

%I #20 May 11 2023 09:33:30

%S 0,7,40,202,1215,8143,58621,440257,3424679,27409998,224373160,

%T 1870585458,15834656002,135779962759,1177207270203,10304191320776,

%U 90948823579814,808675898548205

%N Number of prime pairs below 10^n having a difference of 4.

%H Siegfried "Zig" Herzog, <a href="http://zigherzog.net/primes/index.html#compare">Frequency of Occurrence of Prime Gaps</a>

%H T. Oliveira e Silva, S. Herzog, and S. Pardi, <a href="http://dx.doi.org/10.1090/S0025-5718-2013-02787-1">Empirical verification of the even Goldbach conjecture and computation of prime gaps up to 4.10^18</a>, Math. Comp., 83 (2014), 2033-2060.

%e a(2) = 7 because there are 7 prime gaps of 4 below 10^2.

%o (UBASIC) 20 N=1:dim T(34); 30 A=nxtprm(N); 40 N=A; 50 B=nxtprm(N); 60 D=B-A; 70 for x=2 to 34 step 2; 80 if D=X and B<10^2+1 then T(X)=T(X)+1; 90 next X; 100 if B>10^2+1 then 140; 110 B=A; 120 N=N+1; 130 goto 30; 140 for x=2 to 34 step 2; 150 print T(X);, 160 next (This program simultaneously finds values from 2 to 34 -- if gap=2 add 1-- adjust lines 80 and 100 for desired 10^n)

%o (PARI) a(n)=my(p=2,s); forprime(q=3,10^n, if(q-p==4, s++); p=q); s \\ _Charles R Greathouse IV_, Feb 05 2016

%Y Cf. A007508, A093738.

%K nonn,more

%O 1,2

%A _Enoch Haga_, Apr 15 2004

%E a(10)-a(13) from _Washington Bomfim_, Jun 22 2012

%E a(14)-a(18) from S. Herzog's website added by _Giovanni Resta_, Aug 14 2018