The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A126387 Read binary expansion of n from the left; keep track of the excess of 1's over 0's that have been seen so far; sequence gives maximum(excess of 1's over 0's). 1
 0, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 4, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 4, 5, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 3, 4, 2, 2, 2, 2, 2, 2, 3, 4, 3, 3, 3, 4, 4, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 3, 3, 3, 4, 5, 2, 2, 2, 2, 2, 2, 2, 3, 2 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,4 LINKS FORMULA a(0) = 0, a(2^i) = 1, if n = 2^i + 2^j + m with j < i and 0 <= m < 2^j, then a(n) = max(a(2^j+m) + j + 2 - i, 1). EXAMPLE 59 in binary is 111011, excess from left to right is 1,2,3,2,3,4, maximum is 4, so a(59) = 4. CROSSREFS Cf. A036989. Sequence in context: A237453 A265754 A089309 * A038374 A284569 A272604 Adjacent sequences:  A126384 A126385 A126386 * A126388 A126389 A126390 KEYWORD easy,nonn AUTHOR Franklin T. Adams-Watters, Dec 26 2006 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 18 12:45 EDT 2021. Contains 343088 sequences. (Running on oeis4.)