login
Let P1 >= 3, P2, P3 be consecutive primes, with P3 - P2 = 2. a(n) = (P2 + P3)/12 for the first occurrence of (P2 - P1)/2 = n.
3

%I #17 Nov 04 2020 17:49:29

%S 1,2,5,0,25,87,0,325,213,0,192,758,0,500,1158,0,1668,5383,0,4217,

%T 13130,0,15180,4713,0,5955,19583,0,66642,17127,0,48108,49485,0,28905,

%U 171005,0,175530,61838,0,314192,76967,0,192637,96147,0,812768,708780,0

%N Let P1 >= 3, P2, P3 be consecutive primes, with P3 - P2 = 2. a(n) = (P2 + P3)/12 for the first occurrence of (P2 - P1)/2 = n.

%C Position of first occurrence of a gap of length P2 - P1 = 2*n containing no primes, immediately before the twin primes (P2,P3). To indicate impossible gaps of lengths 8, 14, 20, ..., a(3k+1) is set to 0 for all k >= 1.

%H Hugo Pfoertner, <a href="/A329251/b329251.txt">Table of n, a(n) for n = 1..224</a>

%e a(5) = 25 because the prime gap immediately before P2 = 25*6 - 1 = 149, P3 = 25*6 + 1 = 151 is the first such gap with length 2*n = 2*5 = 10. P2 - P1 = 149 - 139 =10.

%t Module[{nn=500000,lst},lst={(#[[2]]-#[[1]])/2,(#[[2]]+#[[3]])/12}&/@ Select[ Partition[Prime[Range[2,nn]],3,1],#[[3]]-#[[2]]==2&];Table[ SelectFirst[ lst,#[[1]]==n&],{n,50}]/.Missing["NotFound"]->{0,0}] [[All,2]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Nov 04 2020 *)

%o (PARI) my(v=vector(70), p1=3, p2=5, d); forprime(p3=7, 5e6, if(p3-p2==2, d=(p2-p1)/2; if(v[d]==0, v[d]=(p2+p3)/12)); p1=p2; p2=p3); v[1..49]

%Y Cf. A329158, A329159, A329250, A329252.

%K nonn

%O 1,2

%A _Hugo Pfoertner_, Nov 10 2019