A037014 Numbers n with property that reading binary expansion from right to left (from least significant to most significant), run lengths do not increase.
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, 47, 48, 51, 56, 63, 64, 71, 76, 79, 80, 83, 84, 85, 87, 88, 95, 96, 103, 112, 127, 128, 143, 152, 159, 160, 167, 168, 170, 171, 172, 175, 176, 179, 184, 191, 192, 199, 204, 207
Offset: 1
Links
Programs
-
Haskell
import Data.List (unfoldr, group) a037014 n = a037014_list !! (n-1) a037014_list = 0 : filter (all (<= 0) . (\x -> zipWith (-) (tail $ rls x) $ rls x)) [1..] where rls = map length . group . unfoldr (\x -> if x == 0 then Nothing else Just $ swap $ divMod x 2) -- Reinhard Zumkeller, Mar 10 2012
-
Mathematica
Select[Range[0,250],Min[Differences[Length/@Split[IntegerDigits[ #,2]]]]>= 0&] (* Harvey P. Dale, Jan 30 2013 *)
Extensions
More terms from Patrick De Geest, Feb 15 1999
Offset fixed by Reinhard Zumkeller, Mar 10 2012