

A077018


Closest prime to n (break ties by taking the larger prime).


4



2, 2, 2, 3, 5, 5, 7, 7, 7, 11, 11, 11, 13, 13, 13, 17, 17, 17, 19, 19, 19, 23, 23, 23, 23, 23, 29, 29, 29, 29, 31, 31, 31, 31, 37, 37, 37, 37, 37, 41, 41, 41, 43, 43, 43, 47, 47, 47, 47, 47, 53, 53, 53, 53, 53, 53, 59, 59, 59, 59, 61, 61, 61, 61, 67, 67, 67, 67, 67, 71, 71, 71
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,1


LINKS

Table of n, a(n) for n=0..71.
Eric Weisstein's World of Mathematics, Nearest Prime


MATHEMATICA

a[n_] := (np = NextPrime[n]; pp = NextPrime[np, 1]; Which[np > 2n  pp, pp, np < 2n  pp, np, True, np]); a[0] = a[1] = 2; Table[a[n], {n, 0, 71}] (* JeanFrançois Alcover, Oct 31 2012 *)


CROSSREFS

This is the same as A051697 except that one of the 3s is deleted here.
Sequence in context: A058727 A304683 A035658 * A007918 A278167 A239470
Adjacent sequences: A077015 A077016 A077017 * A077019 A077020 A077021


KEYWORD

nonn


AUTHOR

Eric W. Weisstein, Oct 17 2002


STATUS

approved



