This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A114010 #13 May 18 2021 23:37:35 %S A114010 2,2,3,4,5,6,7,7,9,11,11,12,13,13,15,17,17,18,19,19,21,23,23,23,23,26, %T A114010 29,29,29,30,31,31,31,34,37,37,37,37,39,41,41,42,43,43,45,47,47,47,47, %U A114010 50,53,53,53,53,53,56,59,59,59,60,61,61,61,64,67,67,67,67,69,71,71,72 %N A114010 a(1) = a(2) = 2, Let k(n) = (prime(n) + prime(n+1))/2. Then a(k(n)) = k(n). a(k(n)-i) = prime(n), a(k(n)+i) = prime(n+1) until the next prime occurs. %C A114010 a(n) is the nearest prime to n, or n if there is a tie. - _Wesley Ivan Hurt_, May 15 2021 %e A114010 (7 + 11)/2 = 9 hence a(9) = 9, a(8) = 7, a(7) = 7, a(10) = 11, a(11) = 11. %p A114010 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 %Y A114010 Cf. A024675. %K A114010 nonn %O A114010 1,1 %A A114010 _Amarnath Murthy_, Nov 12 2005 %E A114010 More terms from _R. J. Mathar_, Feb 06 2008