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!)
A051698 Closest prime to n that is different from n (break ties by taking the smaller prime). 3
2, 2, 3, 2, 3, 3, 5, 5, 7, 7, 11, 13, 11, 11, 13, 13, 17, 19, 17, 17, 19, 19, 23, 19, 23, 23, 23, 29, 29, 31, 29, 29, 31, 31, 31, 37, 37, 41, 37, 37, 41, 43, 41, 41, 43, 43, 47, 43, 47, 47, 47, 53, 53, 47, 53, 53, 53, 59, 59, 61, 59, 59, 61, 61, 61, 67, 67, 71, 67, 67, 71, 73 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
LINKS
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
Sequence in context: A048475 A204597 A285734 * A046773 A175402 A281726
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
More terms from James A. Sellers
STATUS
approved

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 March 28 08:22 EDT 2024. Contains 371236 sequences. (Running on oeis4.)