login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A245562 Table read by rows: row n gives list of lengths of runs of 1's in binary expansion of n, starting with high-order bits. 12

%I

%S 0,1,1,2,1,1,1,2,3,1,1,1,1,1,1,2,2,2,1,3,4,1,1,1,1,1,1,2,1,1,1,1,1,1,

%T 2,1,3,2,2,1,2,1,2,2,3,3,1,4,5,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,3,1,1,1,

%U 1,1,1,1,1,1,1,2,1,2,1,2,1,1,3,1,4,2,2,1

%N Table read by rows: row n gives list of lengths of runs of 1's in binary expansion of n, starting with high-order bits.

%C A formula for A071053(n) depends on this table.

%H Reinhard Zumkeller, <a href="/A245562/b245562.txt">Table of n, a(n) for n = 0..2770</a>

%H N. J. A. Sloane, <a href="http://arxiv.org/abs/1503.01168">On the Number of ON Cells in Cellular Automata</a>, arXiv:1503.01168, 2015

%e Here are the run lengths for the numbers 0 through 21:

%e 0, []

%e 1, [1]

%e 2, [1]

%e 3, [2]

%e 4, [1]

%e 5, [1, 1]

%e 6, [2]

%e 7, [3]

%e 8, [1]

%e 9, [1, 1]

%e 10, [1, 1]

%e 11, [1, 2]

%e 12, [2]

%e 13, [2, 1]

%e 14, [3]

%e 15, [4]

%e 16, [1]

%e 17, [1, 1]

%e 18, [1, 1]

%e 19, [1, 2]

%e 20, [1, 1]

%e 21, [1, 1, 1]

%p for n from 0 to 128 do

%p lis:=[]; t1:=convert(n,base,2); L1:=nops(t1); out1:=1; c:=0;

%p for i from 1 to L1 do

%p if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;

%p elif out1 = 0 and t1[i] = 1 then c:=c+1;

%p elif out1 = 1 and t1[i] = 0 then c:=c;

%p elif out1 = 0 and t1[i] = 0 then lis:=[c,op(lis)]; out1:=1; c:=0;

%p fi;

%p if i = L1 and c>0 then lis:=[c,op(lis)]; fi;

%p od:

%p lprint(n,lis);

%p od:

%o (Python)

%o from re import split

%o A245562_list = [0]

%o for n in range(1,100):

%o ....A245562_list.extend(len(d) for d in split('0+',bin(n)[2:]) if d != '')

%o # _Chai Wah Wu_, Sep 07 2014

%o (PARI) row(n)=my(v=List(),k); while(n, n>>=valuation(n,2); listput(v, k=valuation(n+1,2)); n>>=k); Vecrev(v) \\ _Charles R Greathouse IV_, Oct 21 2016

%Y Row sums = A000120 (the binary weight).

%Y Cf. A245563, A071053.

%K nonn,base,tabf,easy

%O 0,4

%A _N. J. A. Sloane_, Aug 10 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 21 16:04 EST 2019. Contains 329371 sequences. (Running on oeis4.)