login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A078685
Minimum value of |prime(n) - 2^x|.
1
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, 15, 1, 3, 9, 11, 21, 23, 29, 35, 39, 45, 51, 53, 63, 63, 59, 57, 45, 33, 29, 27, 23, 17, 15, 5, 1, 7, 13, 15, 21, 25, 27, 37, 51, 55, 57, 61, 75, 81, 91, 93, 97, 103, 111, 117, 123, 127
OFFSET
1,5
MAPLE
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:
seq(A078685(n), n=1..80) ; # R. J. Mathar, Apr 08 2011
PROG
(Sage)
def A078685(n):
p = nth_prime(n)
x0 = floor(log(p, 2))
return min(abs(p-2**x) for x in (x0, x0+1))
# D. S. McNeil, Apr 08 2011
CROSSREFS
Sequence in context: A002102 A332552 A047655 * A376756 A078882 A262220
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Dec 17 2002
STATUS
approved