OFFSET
0,1
COMMENTS
This sequence only differs from A077019 for n = 2: a(2) = 9 whereas A077019(2) = 0. - Rémy Sigrist, Dec 19 2019
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
Benoit Cloitre, Jan 26 2003
EXTENSIONS
More terms from Robert G. Wilson v, Jan 27 2003
Name clarified by Rémy Sigrist, Dec 19 2019
STATUS
approved