login
Numbers n with property that reading binary expansion from right to left (from least significant to most significant), run lengths do not increase.
5

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

%S 0,1,2,3,4,5,7,8,10,11,12,15,16,19,20,21,23,24,31,32,39,40,42,43,44,

%T 47,48,51,56,63,64,71,76,79,80,83,84,85,87,88,95,96,103,112,127,128,

%U 143,152,159,160,167,168,170,171,172,175,176,179,184,191,192,199,204,207

%N Numbers n with property that reading binary expansion from right to left (from least significant to most significant), run lengths do not increase.

%H Reinhard Zumkeller, <a href="/A037014/b037014.txt">Table of n, a(n) for n = 1..10000</a>

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

%t Select[Range[0,250],Min[Differences[Length/@Split[IntegerDigits[ #,2]]]]>= 0&] (* _Harvey P. Dale_, Jan 30 2013 *)

%o (Haskell)

%o import Data.List (unfoldr, group)

%o a037014 n = a037014_list !! (n-1)

%o a037014_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 Cf. A037013 (subsequence), A037016, A037015.

%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 by _Reinhard Zumkeller_, Mar 10 2012