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!)
A051700 Distance from n to closest prime that is different from n. 13

%I #14 Dec 24 2016 01:54:49

%S 2,1,1,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,4,1,2,3,2,1,2,1,2,1,2,

%T 3,2,1,4,1,2,1,2,1,2,1,2,1,4,1,2,3,2,1,6,1,2,3,2,1,2,1,2,1,2,3,2,1,4,

%U 1,2,1,2,1,2,1,2,3,2,1,4,1,2,1,4,1,2,3,2,1,6,1,2,3,4,3,2,1,4,1,2,1,2,1,2,1

%N Distance from n to closest prime that is different from n.

%H T. D. Noe, <a href="/A051700/b051700.txt">Table of n, a(n) for n = 0..10000</a>

%e Closest primes to 0,1,2,3,4 are 2,2,3,2,3.

%p with(numtheory); f := n->min(nextprime(n)-n, n-prevprime(n));

%t Table[Min[NextPrime[n]-n,n-NextPrime[n,-1]],{n,0,200}] (* _Harvey P. Dale_, Mar 27 2011 *)

%Y Related sequences: A023186-A023188, A046929-A046931, A051650, A051652, A051697-A051702, A051728-A051730.

%K nonn,easy,nice

%O 0,1

%A _N. J. A. Sloane_

%E More terms from _James A. Sellers_

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 September 7 09:14 EDT 2024. Contains 375730 sequences. (Running on oeis4.)