

A104197


Largest nonnegative integer r such that prime(n) + r and prime(n)  r are both prime.


1



0, 0, 2, 4, 8, 10, 14, 12, 20, 24, 28, 34, 38, 40, 42, 50, 54, 48, 64, 68, 66, 72, 80, 84, 94, 98, 96, 104, 102, 110, 124, 126, 134, 132, 144, 132, 154, 150, 164, 144, 174, 178, 188, 190, 192, 180, 208, 220, 222, 210, 230, 228, 238, 248, 252, 260, 252, 252, 270
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,3


COMMENTS

a(n) can be thought of as the radius of the largest 1dimensional circle centered at prime(n) and consisting entirely of primes.


LINKS

Amiram Eldar, Table of n, a(n) for n = 1..10000


EXAMPLE

r = 4 is the largest nonnegative integer r such that prime(4) + 4 = 11 and prime(4)  4 = 3 are both prime; so a(4) = 4.


MATHEMATICA

a[p_] := Module[{k = p3}, While[!PrimeQ[p+k]  !PrimeQ[pk], k=2]; k]; Join[{0}, a/@Select[Range[3, 1000], PrimeQ]] (* Amiram Eldar, Mar 24 2019 *)


CROSSREFS

Sequence in context: A190751 A030232 A102024 * A323440 A285626 A284853
Adjacent sequences: A104194 A104195 A104196 * A104198 A104199 A104200


KEYWORD

easy,nonn


AUTHOR

Joseph L. Pe, Mar 12 2005


STATUS

approved



