login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A246588 Run Length Transform of S(n) = wt(n) = 0,1,1,2,1,2,2,3,1,... (cf. A000120). 11

%I #42 Apr 06 2020 05:38:06

%S 1,1,1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,2,2,1,2,1,1,

%T 1,1,1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,2,2,2,2,1,1,2,2,1,1,1,1,

%U 1,1,1,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,2,2,1,2,1,1,1,1,1

%N Run Length Transform of S(n) = wt(n) = 0,1,1,2,1,2,2,3,1,... (cf. A000120).

%C 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).

%H Reinhard Zumkeller, <a href="/A246588/b246588.txt">Table of n, a(n) for n = 0..10000</a>

%p A000120 := proc(n) local w, m, i; w := 0; m :=n; while m > 0 do i := m mod 2; w := w+i; m := (m-i)/2; od; w; end: wt := A000120;

%p ans:=[];

%p for n from 0 to 100 do 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 a:=mul(wt(i), i in lis);

%p ans:=[op(ans), a];

%p od:

%p ans;

%t f[n_] := DigitCount[n, 2, 1]; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 100}] (* _Jean-François Alcover_, Jul 11 2017 *)

%o (Haskell)

%o import Data.List (group)

%o a246588 = product . map (a000120 . length) .

%o filter ((== 1) . head) . group . a030308_row

%o -- _Reinhard Zumkeller_, Feb 13 2015, Sep 05 2014

%o (Python)

%o from operator import mul

%o from functools import reduce

%o from re import split

%o def A246588(n):

%o return reduce(mul,(bin(len(d)).count('1') for d in split('0+',bin(n)[2:]) if d)) if n > 0 else 1 # _Chai Wah Wu_, Sep 07 2014

%o (Sage) # uses[RLT from A246660]

%o A246588_list = lambda len: RLT(lambda n: sum(Integer(n).digits(2)), len)

%o A246588_list(88) # _Peter Luschny_, Sep 07 2014

%Y Cf. A000120.

%Y Cf. A167489, A030308.

%Y Run Length Transforms of other sequences: A071053, A227349, A246595, A246596, A246660, A246661, A246674.

%K nonn

%O 0,8

%A _N. J. A. Sloane_, Sep 05 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 5 19:35 EDT 2024. Contains 372277 sequences. (Running on oeis4.)