|
|
A246595
|
|
Run Length Transform of squares.
|
|
11
|
|
|
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, 1, 1, 1, 4, 1, 1, 4, 9, 1, 1, 1, 4, 4, 4, 9, 16, 1, 1, 1, 4, 1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
FORMULA
|
|
|
EXAMPLE
|
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)
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
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
A246595_list = lambda len: RLT(lambda n: n^2, len)
(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)))))
|
|
CROSSREFS
|
Cf. A003714 (gives the positions of ones).
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|