|
|
A079582
|
|
Least positive k such that the distance from k to closest prime = n.
|
|
0
|
|
|
2, 1, 9, 26, 93, 118, 119, 120, 531, 532, 897, 1140, 1339, 1340, 1341, 1342, 1343, 1344, 9569, 15702, 15703, 15704, 15705, 19632, 19633, 19634, 19635, 31424, 31425, 31426, 31427, 31428, 31429, 31430, 31431, 31432, 31433, 155958, 155959, 155960, 155961
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
|
|
LINKS
|
|
|
MATHEMATICA
|
a[n_] := Block[{s = 1}, While[ PrimeQ[s] || Min[s - NextPrime[s, -1], NextPrime[s] - s] != n, s++ ]; s]; a[0] = 2; Table[a[n], {n, 0, 40}]
|
|
PROG
|
(PARI) a(n)=if(n<0, 0, s=1; while(abs(n-min(abs(precprime(s)-s), abs(nextprime(s)-s)))>0, s++); s)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|