OFFSET
0,1
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
EXAMPLE
Closest primes to 0,1,2,3,4 are 2,2,3,2,3.
MATHEMATICA
cp[n_]:=Module[{p1=NextPrime[n, -1], p2=NextPrime[n]}, If[p2-n<n-p1, p2, p1]]; Join[{2}, Table[cp[k], {k, 80}]] (* Harvey P. Dale, Dec 11 2018 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
More terms from James A. Sellers
STATUS
approved