login
Numbers n with property that reading from right to left in the binary expansion of n, the number of 0's always stays ahead of the number of 1's.
3

%I #17 Mar 04 2020 22:46:26

%S 0,4,8,16,20,24,32,36,40,48,64,68,72,80,84,88,96,100,104,112,128,132,

%T 136,144,148,152,160,164,168,176,192,196,200,208,224,256,260,264,272,

%U 276,280,288,292,296,304,320,324,328,336,340,344,352,356,360,368,384

%N Numbers n with property that reading from right to left in the binary expansion of n, the number of 0's always stays ahead of the number of 1's.

%H Reinhard Zumkeller, <a href="/A036993/b036993.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%t Select[Range[0,400],Min[Accumulate[Reverse[IntegerDigits[#,2]]/.{0->1, 1->-1}]]>0&] (* _Harvey P. Dale_, Aug 25 2013 *)

%o (Haskell)

%o a036993 n = a036993_list !! (n-1)

%o a036993_list = filter ((p 0) . a030308_row) [0..] where

%o p _ [] = True

%o p zeros (0:bs) = p (zeros + 1) bs

%o p zeros (1:bs) = zeros > 1 && p (zeros - 1) bs

%o -- _Reinhard Zumkeller_, Jul 31 2013

%Y Cf. A036990, A036991, A036992, A036994.

%Y Cf. A030308.

%K nonn,easy,base,nice

%O 1,2

%A _N. J. A. Sloane_

%E More terms from _Erich Friedman_