login
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
OFFSET
1,3
COMMENTS
a(n) can be thought of as the radius of the largest 1-dimensional circle centered at prime(n) and consisting entirely of primes.
LINKS
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 = p-3}, While[!PrimeQ[p+k] || !PrimeQ[p-k], k-=2]; k]; Join[{0}, a/@Select[Range[3, 1000], PrimeQ]] (* Amiram Eldar, Mar 24 2019 *)
CROSSREFS
Sequence in context: A190751 A030232 A102024 * A323440 A350804 A285626
KEYWORD
easy,nonn
AUTHOR
Joseph L. Pe, Mar 12 2005
STATUS
approved