cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A246595 Run Length Transform of squares.

This page as a plain text file.
%I A246595 #55 Mar 15 2020 06:00:07
%S A246595 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,
%T A246595 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,
%U A246595 25,36,1,1,1,4,1,1,4,9,1,1,1,4,4,4,9,16,1,1,1,4,1,1
%N A246595 Run Length Transform of squares.
%C A246595 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 A246595 Chai Wah Wu, <a href="/A246595/b246595.txt">Table of n, a(n) for n = 0..8192</a>
%H A246595 N. J. A. Sloane, <a href="http://arxiv.org/abs/1503.01168">On the Number of ON Cells in Cellular Automata</a>, arXiv:1503.01168 [math.CO], 2015.
%F A246595 a(n) = A227349(n)^2. - _Omar E. Pol_, Feb 10 2015
%e A246595 From _Omar E. Pol_, Feb 10 2015: (Start)
%e A246595 Written as an irregular triangle in which row lengths is A011782:
%e A246595 1;
%e A246595 1;
%e A246595 1,4;
%e A246595 1,1,4,9;
%e A246595 1,1,1,4,4,4,9,16;
%e A246595 1,1,1,4,1,1,4,9,4,4,4,16,9,9,16,25;
%e A246595 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;
%e A246595 ...
%e A246595 Right border gives A253909: 1 together with the positive squares.
%e A246595 (End)
%e A246595 From _Omar E. Pol_, Mar 19 2015: (Start)
%e A246595 Also, the sequence can be written as an irregular tetrahedron T(s,r,k) as shown below:
%e A246595 1;
%e A246595 ..
%e A246595 1;
%e A246595 ..
%e A246595 1;
%e A246595 4;
%e A246595 .......
%e A246595 1,   1;
%e A246595 4;
%e A246595 9;
%e A246595 ...............
%e A246595 1,   1,  1,  4;
%e A246595 4,   4;
%e A246595 9;
%e A246595 16;
%e A246595 .............................
%e A246595 1,   1,  1,  4, 1, 1,  4,  9;
%e A246595 4,   4,  4, 16;
%e A246595 9,   9;
%e A246595 16;
%e A246595 25;
%e A246595 ......................................................
%e A246595 1,   1,  1,  4, 1, 1,  4,  9, 1, 1, 1, 4, 4, 4, 9, 16;
%e A246595 4,   4,  4, 16, 4, 4, 16, 36;
%e A246595 9,   9,  9, 36;
%e A246595 16, 16;
%e A246595 25;
%e A246595 36;
%e A246595 ...
%e A246595 Apart from the initial 1, we have that T(s,r,k) = T(s+1,r,k).
%e A246595 (End)
%p A246595 ans:=[];
%p A246595 for n from 0 to 100 do lis:=[]; t1:=convert(n, base, 2); L1:=nops(t1); out1:=1; c:=0;
%p A246595 for i from 1 to L1 do
%p A246595    if out1 = 1 and t1[i] = 1 then out1:=0; c:=c+1;
%p A246595    elif out1 = 0 and t1[i] = 1 then c:=c+1;
%p A246595    elif out1 = 1 and t1[i] = 0 then c:=c;
%p A246595    elif out1 = 0 and t1[i] = 0 then lis:=[c, op(lis)]; out1:=1; c:=0;
%p A246595    fi;
%p A246595    if i = L1 and c>0 then lis:=[c, op(lis)]; fi;
%p A246595                    od:
%p A246595 a:=mul(i^2, i in lis);
%p A246595 ans:=[op(ans), a];
%p A246595 od:
%p A246595 ans;
%t A246595 Table[Times @@ (Length[#]^2&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 85}] (* _Jean-François Alcover_, Jul 11 2017 *)
%o A246595 (Python)
%o A246595 from operator import mul
%o A246595 from functools import reduce
%o A246595 from re import split
%o A246595 def A246595(n):
%o A246595     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
%o A246595 (Sage) # uses[RLT from A246660]
%o A246595 A246595_list = lambda len: RLT(lambda n: n^2, len)
%o A246595 A246595_list(86) # _Peter Luschny_, Sep 07 2014
%o A246595 (Scheme) ; using MIT/GNU Scheme
%o A246595 (define (A246595 n) (fold-left (lambda (a r) (* a r r)) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
%o A246595 ;; Other functions are as in A227349 - _Antti Karttunen_, Sep 08 2014
%Y A246595 Cf. A000290, A253082.
%Y A246595 Cf. A003714 (gives the positions of ones).
%Y A246595 Run Length Transforms of other sequences: A071053, A227349, A246588, A246596, A246660, A246661, A246674.
%K A246595 nonn
%O A246595 0,4
%A A246595 _N. J. A. Sloane_, Sep 06 2014