Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A053646
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A053646 Distance to nearest power of 2. +0
7
0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 (list; graph; listen)
OFFSET

1,6

COMMENT

Sum {j=1..2^(k+1), a(j)} = A002450(k) = (4^k - 1)/3. - Klaus Brockhaus (klaus-brockhaus(AT)t-online.de), Mar 17 2003

LINKS

Klaus Brockhaus, Illustration for A053646, A081252, A081253 and A081254

FORMULA

a(2^k+i)=i for 1<=i<=2^(k-1); a(3*2^k+i)=2^k-i for 1<=i<=2^k; sum(k=1, n, a(k))/n^2 is bounded. - Benoit Cloitre (benoit7848c(AT)orange.fr), Aug 17 2002

a(n) = min(n-2^floor(log(n)/log(2)), 2*2^floor(log(n)/log(2))-n). - Klaus Brockhaus (klaus-brockhaus(AT)t-online.de), Mar 08 2003

EXAMPLE

a(10)=2 since 8 is closest power of 2 to 10 and |8-10|=2

PROGRAM

(PARI) a(n)=vecmin(vector(n, i, abs(n-2^(i-1))))

(PARI) for(n=1, 89, p=2^floor(0.1^25+log(n)/log(2)); print1(min(n-p, 2*p-n), ", "))

CROSSREFS

Cf. A053188, A060973, A081134, A002450, A081252, A081253, A081254.

Sequence in context: A002819 A037834 A004074 this_sequence A080776 A065358 A062329

Adjacent sequences: A053643 A053644 A053645 this_sequence A053647 A053648 A053649

KEYWORD

easy,nonn

AUTHOR

Henry Bottomley (se16(AT)btinternet.com), Mar 22 2000

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 25 08:46 EST 2009. Contains 167481 sequences.


AT&T Labs Research