login
Reading binary expansion from right to left, run lengths strictly decrease.
18

%I #23 Oct 10 2019 03:55:21

%S 0,1,3,4,7,8,15,16,24,31,32,39,48,63,64,79,96,112,127,128,143,159,192,

%T 224,255,256,287,319,384,399,448,480,511,512,543,575,624,639,768,799,

%U 896,960,1023,1024,1087,1151,1248,1279,1536,1567,1599,1792,1920,1984,2047,2048,2111

%N Reading binary expansion from right to left, run lengths strictly decrease.

%H Reinhard Zumkeller, <a href="/A037013/b037013.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,2200],Min[Differences[Length/@Split[ IntegerDigits[ #,2]]]]>0&] (* _Harvey P. Dale_, Dec 17 2012 *)

%o (Haskell)

%o import Data.List (unfoldr, group)

%o a037013 n = a037013_list !! (n-1)

%o a037013_list = 0 : filter

%o (all (< 0) . (\x -> zipWith (-) (tail $ rls x) $ rls x)) [1..] where

%o rls = map length . group . unfoldr

%o (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2)

%o -- _Reinhard Zumkeller_, Mar 10 2012

%Y Subsequence of A037014, cf. A037015, A037016.

%K nonn,easy,base,nice

%O 1,3

%A _N. J. A. Sloane_

%E More terms from _Patrick De Geest_, Feb 15 1999

%E Offset fixed and missing 1024 and 2047 inserted by _Reinhard Zumkeller_, Mar 10 2012