OFFSET
1,1
COMMENTS
Note that p,q,r are not required to be consecutive primes.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
EXAMPLE
a(1)=5 because both 5 + 2 = 7 and 7 + 4 = 11 are prime;
n=2: d=4, p=7 because both p + d = 11 and 11 + 6 = 17 are prime;
n=3: d=6: primes 11,13 are not qualified while 17 + 6 = 23 and 23 + 8 = 31 are prime hence a(3)=17.
MATHEMATICA
m=0; p=3; s={}; Do[p = NextPrime[p]; m=m+2; While[!PrimeQ[p+m]||!PrimeQ[p+2*m+2], p=NextPrime[p]]; AppendTo[s, p], {50}]; s
PROG
(PARI) first(n)=my(v=vector(n), k=4); v[1]=5; forprime(p=5, , if(isprime(p+k) && isprime(p+2*k+2), v[k/2]=p; if(k==2*n, return(v)); k+=2)) \\ Charles R Greathouse IV, Mar 01 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Mar 01 2017
EXTENSIONS
a(16)-a(17) corrected by Charles R Greathouse IV, Mar 01 2017
STATUS
approved