OFFSET
1,2
COMMENTS
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.
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 1..224
EXAMPLE
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.
MATHEMATICA
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 *)
PROG
(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]
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Nov 10 2019
STATUS
approved