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!)
A078685 Minimum value of |prime(n) - 2^x|. 1

%I #16 Mar 08 2020 11:38:17

%S 0,1,1,1,3,3,1,3,7,3,1,5,9,11,15,11,5,3,3,7,9,15,19,25,31,27,25,21,19,

%T 15,1,3,9,11,21,23,29,35,39,45,51,53,63,63,59,57,45,33,29,27,23,17,15,

%U 5,1,7,13,15,21,25,27,37,51,55,57,61,75,81,91,93,97,103,111,117,123,127

%N Minimum value of |prime(n) - 2^x|.

%p A078685 := proc(n) local p,a,x,r ; p := ithprime(n) ; a := p ; for x from 0 do r := p-2^x ; if r < -p then return a ; fi ; r := abs(r) ; if r < a then a := r ; end if; end do: a ; end proc:

%p seq(A078685(n),n=1..80) ; # _R. J. Mathar_, Apr 08 2011

%o (Sage)

%o def A078685(n):

%o p = nth_prime(n)

%o x0 = floor(log(p,2))

%o return min(abs(p-2**x) for x in (x0, x0+1))

%o # _D. S. McNeil_, Apr 08 2011

%K nonn

%O 1,5

%A _Benoit Cloitre_, Dec 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 20 00:03 EDT 2024. Contains 371798 sequences. (Running on oeis4.)