OFFSET
1,1
COMMENTS
a(n) is the nearest prime to n, or n if there is a tie. - Wesley Ivan Hurt, May 15 2021
EXAMPLE
(7 + 11)/2 = 9 hence a(9) = 9, a(8) = 7, a(7) = 7, a(10) = 11, a(11) = 11.
MAPLE
A114010 := proc(n) local i, a024675 ; if n <= 2 then 2 ; else for i from 1 do if n >= ithprime(i) and n <= ithprime(i+1) then a024675 := (ithprime(i)+ithprime(i+1))/2 ; if n = a024675 then RETURN(a024675) ; elif n < a024675 then RETURN(ithprime(i)) ; else RETURN(ithprime(i+1)) ; fi ; fi ; od: fi ; end: seq(A114010(n), n=1..120) ; # R. J. Mathar, Feb 06 2008
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Nov 12 2005
EXTENSIONS
More terms from R. J. Mathar, Feb 06 2008
STATUS
approved