A037016 Numbers n with property that reading binary expansion from right to left (least significant to most significant), run lengths do not decrease.
0, 1, 2, 3, 5, 6, 7, 10, 12, 13, 14, 15, 21, 25, 26, 28, 29, 30, 31, 42, 50, 51, 53, 56, 57, 58, 60, 61, 62, 63, 85, 101, 102, 106, 113, 114, 115, 117, 120, 121, 122, 124, 125, 126, 127, 170, 202, 204, 205, 213, 226, 227, 229, 230, 234, 240, 241, 242, 243, 245, 248
Offset: 1
Links
Programs
-
Haskell
import Data.List (unfoldr, group) a037016 n = a037016_list !! (n-1) a037016_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], OrderedQ[ Reverse[ Length /@ Split[ IntegerDigits[#, 2] ] ] ]&] (* Jean-François Alcover, Apr 05 2013 *)
Extensions
More terms from Patrick De Geest, Feb 15 1999
Offset fixed by Reinhard Zumkeller, Mar 10 2012
Comments