login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A294075
a(n) is the distance from the n-th isolated prime number to the average of the next twin prime pair.
0
2, 7, 5, 13, 7, 5, 23, 19, 13, 5, 25, 11, 7, 23, 17, 13, 7, 17, 5, 7, 19, 13, 7, 5, 19, 5, 31, 17, 11, 67, 61, 53, 47, 41, 37, 31, 23, 19, 11, 23, 19, 13, 5, 55, 43, 35, 31, 23, 19, 13, 29, 23, 13, 7, 23, 13, 7, 11, 5, 11, 13, 7, 137, 133
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
Sequence in context: A135076 A155546 A073132 * A165355 A038004 A100792
KEYWORD
nonn
AUTHOR
Dimitris Valianatos, Feb 07 2018
STATUS
approved