login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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
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
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
Cf. A003714 (gives the positions of ones).
Run Length Transforms of other sequences: A071053, A227349, A246588, A246596, A246660, A246661, A246674.
Sequence in context: A324893 A301626 A080061 * A209571 A269845 A124258
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Sep 06 2014
STATUS
approved