login
A245563
Table read by rows: row n gives list of lengths of runs of 1's in binary expansion of n, starting with low-order bits.
11
0, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 3, 4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 2, 1, 2, 1, 2, 2, 2, 3, 1, 3, 4, 5, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 4, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 3, 2, 3, 1, 3, 1, 3, 2, 3, 4, 1, 4, 5, 6, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1
OFFSET
0,4
COMMENTS
A formula for A071053(n) depends on this table.
EXAMPLE
Here are the run lengths for the numbers 0 through 21:
0, []
1, [1]
2, [1]
3, [2]
4, [1]
5, [1, 1]
6, [2]
7, [3]
8, [1]
9, [1, 1]
10, [1, 1]
11, [2, 1]
12, [2]
13, [1, 2]
14, [3]
15, [4]
16, [1]
17, [1, 1]
18, [1, 1]
19, [2, 1]
20, [1, 1]
21, [1, 1, 1]
MAPLE
for n from 0 to 128 do
lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
for i from 1 to L1 do
if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
elif out1 = 0 and t1[i] = 1 then c:=c+1;
elif out1 = 1 and t1[i] = 0 then c:=c;
elif out1 = 0 and t1[i] = 0 then lis:=[op(lis), c]; out1:=1; c:=0;
fi;
if i = L1 and c>0 then lis:=[op(lis), c]; fi;
od:
lprint(n, lis);
od:
MATHEMATICA
Join@@Table[Length/@Split[Join@@Position[Reverse[IntegerDigits[n, 2]], 1], #2==#1+1&], {n, 0, 100}] (* Gus Wiseman, Nov 03 2019 *)
PROG
(Haskell)
import Data.List (group)
a245563 n k = a245563_tabf !! n !! k
a245563_row n = a245563_tabf !! n
a245563_tabf = [0] : map
(map length . (filter ((== 1) . head)) . group) (tail a030308_tabf)
-- Reinhard Zumkeller, Aug 10 2014
(Python)
from re import split
A245563_list = [0]
for n in range(1, 100):
....A245563_list.extend(len(d) for d in split('0+', bin(n)[:1:-1]) if d != '')
# Chai Wah Wu, Sep 07 2014
CROSSREFS
Row sums = A000120 (the binary weight).
Row lengths are A069010.
The version for prime indices (instead of binary indices) is A124010.
Numbers with distinct run-lengths are A328592.
Numbers with equal run-lengths are A164707.
Sequence in context: A245562 A304495 A175069 * A356917 A122945 A209972
KEYWORD
nonn,base,tabf
AUTHOR
N. J. A. Sloane, Aug 10 2014
STATUS
approved