OFFSET
0,4
COMMENTS
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).
LINKS
Chai Wah Wu, Table of n, a(n) for n = 0..8192
N. J. A. Sloane, On the Number of ON Cells in Cellular Automata, arXiv:1503.01168 [math.CO], 2015.
FORMULA
a(n) = A227349(n)^2. - Omar E. Pol, Feb 10 2015
EXAMPLE
From Omar E. Pol, Feb 10 2015: (Start)
Written as an irregular triangle in which row lengths is A011782:
1;
1;
1,4;
1,1,4,9;
1,1,1,4,4,4,9,16;
1,1,1,4,1,1,4,9,4,4,4,16,9,9,16,25;
1,1,1,4,1,1,4,9,1,1,1,4,4,4,9,16,4,4,4,16,4,4,16,36,9,9,9,36,16,16,25,36;
...
Right border gives A253909: 1 together with the positive squares.
(End)
From Omar E. Pol, Mar 19 2015: (Start)
Also, the sequence can be written as an irregular tetrahedron T(s,r,k) as shown below:
1;
..
1;
..
1;
4;
.......
1, 1;
4;
9;
...............
1, 1, 1, 4;
4, 4;
9;
16;
.............................
1, 1, 1, 4, 1, 1, 4, 9;
4, 4, 4, 16;
9, 9;
16;
25;
......................................................
1, 1, 1, 4, 1, 1, 4, 9, 1, 1, 1, 4, 4, 4, 9, 16;
4, 4, 4, 16, 4, 4, 16, 36;
9, 9, 9, 36;
16, 16;
25;
36;
...
Apart from the initial 1, we have that T(s,r,k) = T(s+1,r,k).
(End)
MAPLE
ans:=[];
for n from 0 to 100 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:=[c, op(lis)]; out1:=1; c:=0;
fi;
if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
od:
a:=mul(i^2, i in lis);
ans:=[op(ans), a];
od:
ans;
MATHEMATICA
Table[Times @@ (Length[#]^2&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 85}] (* Jean-François Alcover, Jul 11 2017 *)
PROG
(Python)
from operator import mul
from functools import reduce
from re import split
def A246595(n):
return reduce(mul, (len(d)**2 for d in split('0+', bin(n)[2:]) if d != '')) if n > 0 else 1 # Chai Wah Wu, Sep 07 2014
(Sage) # uses[RLT from A246660]
A246595_list = lambda len: RLT(lambda n: n^2, len)
A246595_list(86) # Peter Luschny, Sep 07 2014
(Scheme) ; using MIT/GNU Scheme
(define (A246595 n) (fold-left (lambda (a r) (* a r r)) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
;; Other functions are as in A227349 - Antti Karttunen, Sep 08 2014
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 06 2014
STATUS
approved