# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a227349 Showing 1-1 of 1 %I A227349 #95 Mar 23 2020 06:53:33 %S A227349 1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4,1,1,1,2,1,1,2,3,2,2,2,4,3,3,4,5,1,1, %T A227349 1,2,1,1,2,3,1,1,1,2,2,2,3,4,2,2,2,4,2,2,4,6,3,3,3,6,4,4,5,6,1,1,1,2, %U A227349 1,1,2,3,1,1,1,2,2,2,3,4,1,1,1,2,1,1,2,3,2,2,2,4,3,3,4,5,2,2,2,4,2,2,4,6,2,2,2,4,4,4,6,8,3,3,3,6,3,3,6,9,4 %N A227349 Product of lengths of runs of 1-bits in binary representation of n. %C A227349 This is the Run Length Transform of S(n) = {0, 1, 2, 3, 4, 5, 6, ...}. The Run Length Transform of a sequence {S(n), n >= 0} is defined to be the sequence {T(n), n >= 0} given by T(n) = Product_i S(i), where i runs through the lengths of runs of 1's in the binary expansion of n. E.g., 19 is 10011 in binary, which has two runs of 1's, of lengths 1 and 2. So T(19) = S(1)*S(2). T(0) = 1 (the empty product). - _N. J. A. Sloane_, Sep 05 2014 %C A227349 Like all run length transforms also this sequence satisfies for all i, j: A278222(i) = A278222(j) => a(i) = a(j). - _Antti Karttunen_, Apr 14 2017 %H A227349 Antti Karttunen, Table of n, a(n) for n = 0..8192 %H A227349 N. J. A. Sloane, On the Number of ON Cells in Cellular Automata, arXiv:1503.01168 [math.CO], 2015. %H A227349 Index entries for sequences computed with run length transform %F A227349 A167489(n) = a(n) * A227350(n). %F A227349 A227193(n) = a(n) - A227350(n). %F A227349 a(n) = Product_{i in row n of table A245562} i. - _N. J. A. Sloane_, Aug 10 2014 %F A227349 From _Antti Karttunen_, Apr 14 2017: (Start) %F A227349 a(n) = A005361(A005940(1+n)). %F A227349 a(n) = A284562(n) * A284569(n). %F A227349 A283972(n) = n - a(n). %F A227349 (End) %e A227349 a(0) = 1, as zero has no runs of 1's, and an empty product is 1. %e A227349 a(1) = 1, as 1 is "1" in binary, and the length of that only 1-run is 1. %e A227349 a(2) = 1, as 2 is "10" in binary, and again there is only one run of 1-bits, of length 1. %e A227349 a(3) = 2, as 3 is "11" in binary, and there is one run of two 1-bits. %e A227349 a(55) = 6, as 55 is "110111" in binary, and 2 * 3 = 6. %e A227349 a(119) = 9, as 119 is "1110111" in binary, and 3 * 3 = 9. %e A227349 From _Omar E. Pol_, Feb 10 2015: (Start) %e A227349 Written as an irregular triangle in which row lengths is A011782: %e A227349 1; %e A227349 1; %e A227349 1,2; %e A227349 1,1,2,3; %e A227349 1,1,1,2,2,2,3,4; %e A227349 1,1,1,2,1,1,2,3,2,2,2,4,3,3,4,5; %e A227349 1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4,2,2,2,4,2,2,4,6,3,3,3,6,4,4,5,6; %e A227349 ... %e A227349 Right border gives A028310: 1 together with the positive integers. %e A227349 (End) %e A227349 From _Omar E. Pol_, Mar 19 2015: (Start) %e A227349 Also, the sequence can be written as an irregular tetrahedron T(s, r, k) as shown below: %e A227349 1; %e A227349 .. %e A227349 1; %e A227349 .. %e A227349 1; %e A227349 2; %e A227349 .... %e A227349 1,1; %e A227349 2; %e A227349 3; %e A227349 ........ %e A227349 1,1,1,2; %e A227349 2,2; %e A227349 3; %e A227349 4; %e A227349 ................ %e A227349 1,1,1,2,1,1,2,3; %e A227349 2,2,2,4; %e A227349 3,3; %e A227349 4; %e A227349 5; %e A227349 ................................ %e A227349 1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4; %e A227349 2,2,2,4,2,2,4,6; %e A227349 3,3,3,6; %e A227349 4,4; %e A227349 5; %e A227349 6; %e A227349 ... %e A227349 Apart from the initial 1, we have that T(s, r, k) = T(s+1, r, k). %e A227349 (End) %p A227349 a:= proc(n) local i, m, r; m, r:= n, 1; %p A227349 while m>0 do %p A227349 while irem(m, 2, 'h')=0 do m:=h od; %p A227349 for i from 0 while irem(m, 2, 'h')=1 do m:=h od; %p A227349 r:= r*i %p A227349 od; r %p A227349 end: %p A227349 seq(a(n), n=0..100); # _Alois P. Heinz_, Jul 11 2013 %p A227349 ans:=[]; %p A227349 for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0; %p A227349 for i from 1 to L1 do %p A227349 if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1; %p A227349 elif out1 = 0 and t1[i] = 1 then c:=c+1; %p A227349 elif out1 = 1 and t1[i] = 0 then c:=c; %p A227349 elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0; %p A227349 fi; %p A227349 if i = L1 and c>0 then lis:=[c, op(lis)]; fi; %p A227349 od: %p A227349 a:=mul(i, i in lis); %p A227349 ans:=[op(ans), a]; %p A227349 od: %p A227349 ans; # _N. J. A. Sloane_, Sep 05 2014 %t A227349 onBitRunLenProd[n_] := Times @@ Length /@ Select[Split @ IntegerDigits[n, 2], #[[1]] == 1 & ]; Array[onBitRunLenProd, 100, 0] (* _Jean-François Alcover_, Mar 02 2016 *) %o A227349 (Python) %o A227349 from operator import mul %o A227349 from functools import reduce %o A227349 from re import split %o A227349 def A227349(n): %o A227349 return reduce(mul, (len(d) for d in split('0+',bin(n)[2:]) if d)) if n > 0 else 1 # _Chai Wah Wu_, Sep 07 2014 %o A227349 (Sage) # uses[RLT from A246660] %o A227349 A227349_list = lambda len: RLT(lambda n: n, len) %o A227349 A227349_list(88) # _Peter Luschny_, Sep 07 2014 %o A227349 (Scheme) %o A227349 (define (A227349 n) (apply * (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2))))) %o A227349 (define (bisect lista parity) (let loop ((lista lista) (i 0) (z (list))) (cond ((null? lista) (reverse! z)) ((eq? i parity) (loop (cdr lista) (modulo (1+ i) 2) (cons (car lista) z))) (else (loop (cdr lista) (modulo (1+ i) 2) z))))) %o A227349 (define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2))))))) %Y A227349 Cf. A003714 (positions of ones), A005361, A005940. %Y A227349 Cf. A000120 (sum of lengths of runs of 1-bits), A167489, A227350, A227193, A278222, A245562, A284562, A284569, A283972, A284582, A284583. %Y A227349 Run Length Transforms of other sequences: A246588, A246595, A246596, A246660, A246661, A246674. %Y A227349 Differs from similar A284580 for the first time at n=119, where a(119) = 9, while A284580(119) = 5. %K A227349 nonn,base %O A227349 0,4 %A A227349 _Antti Karttunen_, Jul 08 2013 %E A227349 Data section extended up to term a(120) by _Antti Karttunen_, Apr 14 2017 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE