login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A037015
Numbers n with property that, reading binary expansion of n from right to left, run lengths strictly increase.
18
0, 1, 3, 6, 7, 14, 15, 28, 30, 31, 57, 60, 62, 63, 120, 121, 124, 126, 127, 241, 248, 249, 252, 254, 255, 483, 496, 497, 504, 505, 508, 510, 511, 966, 993, 995, 1008, 1009, 1016, 1017, 1020, 1022, 1023, 1987, 1990, 2016, 2017, 2019, 2032, 2033, 2040, 2041, 2044
OFFSET
1,3
COMMENTS
There are A000009(k) elements of this list consisting of k bits. - Jason Kimberley, Jan 22 2013
EXAMPLE
From Jason Kimberley, Jan 30 2013: (Start)
Interleaved lines:
binary expansions,
corresponding run lengths (distinct partitions);
1,
1;
11,
2;
110, 111,
2,1; 3;
1110, 1111,
3,1; 4;
11100, 11110, 11111,
3,2; 4,1; 5;
111001, 111100, 111110, 111111,
3,2,1; 4,2; 5,1; 6;
1111000, 1111001, 1111100, 1111110, 1111111,
4,3; 4,2,1; 5,2; 6,1; 7;
11110001, 11111000, 11111001, 11111100, 11111110, 11111111
4,3,1; 5,3; 5,2,1; 6,2; 7,1; 8;
111100011, 111110000, 111110001, 111111000, 111111001, 111111100, 111111110, 111111111,
4,3,2; 5,4; 5,3,1; 6,3; 6,2,1; 7,2; 8,1; 9;
Notice the reversed sorting when a part corresponds to a run of 0's.
(End)
MATHEMATICA
Select[Range[0, 2500], Min[Differences[Length/@Split[ Reverse[ IntegerDigits[ #, 2]]]]]>0&] (* Harvey P. Dale, Nov 18 2014 *)
Select[Range[0, 2100], Max[Differences[Length/@Split[IntegerDigits[#, 2]]]]<0&] (* Harvey P. Dale, Jun 28 2020 *)
PROG
(Haskell)
import Data.List (group)
a037015 n = a037015_list !! (n-1)
a037015_list = filter (all (> 0) . ds) [0..] where
ds x = zipWith (-) (tail gs) gs where
gs = map length $ group $ a030308_row x
-- Reinhard Zumkeller, Jul 31 2013, Mar 10 2012
(Python)
from itertools import groupby
A037015_list = []
for n in range(10**5):
c = None
for x, y in groupby(bin(n)[2:]):
z = len(list(y))
if c != None and z >= c:
break
c = z
else:
A037015_list.append(n) # Chai Wah Wu, Sep 14 2021
CROSSREFS
Subsequence of A037016, cf. A037013, A037014.
Cf. A030308.
Sequence in context: A099403 A324726 A333379 * A138218 A056055 A359476
KEYWORD
nonn,easy,base,nice
EXTENSIONS
More terms from Patrick De Geest, Feb 15 1999
Offset fixed and missing 1023 inserted by Reinhard Zumkeller, Mar 10 2012
STATUS
approved