login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A077018 Closest prime to n (break ties by taking the larger prime). 3

%I #8 Jul 30 2015 01:40:12

%S 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,

%T 29,29,29,29,31,31,31,31,37,37,37,37,37,41,41,41,43,43,43,47,47,47,47,

%U 47,53,53,53,53,53,53,59,59,59,59,61,61,61,61,67,67,67,67,67,71,71,71

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

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/NearestPrime.html">Nearest Prime</a>

%t 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}] (* _Jean-François Alcover_, Oct 31 2012 *)

%Y This is the same as A051697 except that one of the 3s is deleted here.

%K nonn

%O 0,1

%A _Eric W. Weisstein_, Oct 17 2002

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 09:48 EDT 2024. Contains 371905 sequences. (Running on oeis4.)