cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A245563 #25 May 22 2025 10:21:39
%S A245563 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,
%T A245563 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,
%U A245563 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
%N 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.
%C A245563 A formula for A071053(n) depends on this table.
%H A245563 Reinhard Zumkeller, <a href="/A245563/b245563.txt">Rows n = 0..1000 of triangle, flattened</a>
%H A245563 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%e A245563 Here are the run lengths for the numbers 0 through 21:
%e A245563 0, []
%e A245563 1, [1]
%e A245563 2, [1]
%e A245563 3, [2]
%e A245563 4, [1]
%e A245563 5, [1, 1]
%e A245563 6, [2]
%e A245563 7, [3]
%e A245563 8, [1]
%e A245563 9, [1, 1]
%e A245563 10, [1, 1]
%e A245563 11, [2, 1]
%e A245563 12, [2]
%e A245563 13, [1, 2]
%e A245563 14, [3]
%e A245563 15, [4]
%e A245563 16, [1]
%e A245563 17, [1, 1]
%e A245563 18, [1, 1]
%e A245563 19, [2, 1]
%e A245563 20, [1, 1]
%e A245563 21, [1, 1, 1]
%p A245563 for n from 0 to 128 do
%p A245563 lis:=[]; t1:=convert(n,base,2); L1:=nops(t1); out1:=1; c:=0;
%p A245563 for i from 1 to L1 do
%p A245563 if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
%p A245563 elif out1 = 0 and t1[i] = 1 then c:=c+1;
%p A245563 elif out1 = 1 and t1[i] = 0 then c:=c;
%p A245563 elif out1 = 0 and t1[i] = 0 then lis:=[op(lis),c]; out1:=1; c:=0;
%p A245563 fi;
%p A245563 if i = L1 and c>0 then lis:=[op(lis),c]; fi;
%p A245563 od:
%p A245563 lprint(n,lis);
%p A245563 od:
%t A245563 Join@@Table[Length/@Split[Join@@Position[Reverse[IntegerDigits[n,2]],1],#2==#1+1&],{n,0,100}] (* _Gus Wiseman_, Nov 03 2019 *)
%o A245563 (Haskell)
%o A245563 import Data.List (group)
%o A245563 a245563 n k = a245563_tabf !! n !! k
%o A245563 a245563_row n = a245563_tabf !! n
%o A245563 a245563_tabf = [0] : map
%o A245563    (map length . (filter ((== 1) . head)) . group) (tail a030308_tabf)
%o A245563 -- _Reinhard Zumkeller_, Aug 10 2014
%o A245563 (Python)
%o A245563 from re import split
%o A245563 A245563_list = [0]
%o A245563 for n in range(1,100):
%o A245563     A245563_list.extend(len(d) for d in split('0+',bin(n)[:1:-1]) if d != '')
%o A245563 # _Chai Wah Wu_, Sep 07 2014
%Y A245563 Row sums = A000120 (the binary weight).
%Y A245563 Cf. A245562, A071053.
%Y A245563 Cf. A030308, A227736.
%Y A245563 Row lengths are A069010.
%Y A245563 The version for prime indices (instead of binary indices) is A124010.
%Y A245563 Numbers with distinct run-lengths are A328592.
%Y A245563 Numbers with equal run-lengths are A164707.
%Y A245563 Cf. A003714, A014081, A328166, A328594, A328595, A328596.
%K A245563 nonn,base,tabf
%O A245563 0,4
%A A245563 _N. J. A. Sloane_, Aug 10 2014