|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
EXAMPLE
|
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
(Python)
from itertools import groupby
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:
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,base,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|