Read binary expansion of n from the right; keep track of the excess of 1's over 0's that have been seen so far; sequence gives 1 + maximum(excess of 1's over 0's).

A036989

Read binary expansion of n from the right; keep track of the excess of 1's over 0's that have been seen so far; sequence gives 1 + maximum(excess of 1's over 0's).

Terms

    a(0) =1a(1) =2a(2) =1a(3) =3a(4) =1a(5) =2a(6) =2a(7) =4a(8) =1a(9) =2a(10) =1a(11) =3a(12) =1a(13) =3a(14) =3a(15) =5a(16) =1a(17) =2a(18) =1a(19) =3a(20) =1a(21) =2a(22) =2a(23) =4a(24) =1a(25) =2a(26) =2a(27) =4a(28) =2a(29) =4

External references