OFFSET
0,4
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
KEYWORD
easy,nonn
AUTHOR
Franklin T. Adams-Watters, Dec 26 2006
STATUS
approved