OFFSET
1,1
EXAMPLE
For n=2, the second isolated prime number is 23. The next twin prime pair after 23 is (29, 31). The average (29 + 31)/2 = 30. The difference 30 - 23 = 7 is the second term.
MATHEMATICA
Block[{s = Prime@ Range@ 200, q, r}, q = Select[Partition[s, 2, 1], Differences@ # == {2} &]; r = Complement[s, Union@ Flatten@ q]; q = Mean /@ q; TakeWhile[#, IntegerQ] &@ Table[SelectFirst[q, # > p &] - p, {p, r}]] (* Michael De Vlieger, Feb 16 2018 *)
PROG
(PARI) {
p=2; t1=2;
forprime(t=3, 1000,
if(t-p==2,
t2=p+1;
forprime(i=t1, t2-2,
print1(t2-i, ", ")
);
t1=t2+2
);
p=t
)
}
(PARI) lista(nn) = {forprime(p=2, nn, if(!isprime(p-2)&&!isprime(p+2), forprime(q = p+1, , if (isprime(q+2), print1(q+1-p, ", "); break); ); ); ); } \\ Michel Marcus, Mar 01 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Dimitris Valianatos, Feb 07 2018
STATUS
approved