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.

Showing 1-10 of 43 results. Next

A253102 a(n) = A071053(n)^3.

Original entry on oeis.org

1, 27, 27, 125, 27, 729, 125, 1331, 27, 729, 729, 3375, 125, 3375, 1331, 9261, 27, 729, 729, 3375, 729, 19683, 3375, 35937, 125, 3375, 3375, 15625, 1331, 35937, 9261, 79507, 27, 729, 729, 3375, 729, 19683, 3375, 35937, 729, 19683, 19683, 91125, 3375, 91125, 35937, 250047, 125, 3375, 3375, 15625
Offset: 0

Views

Author

N. J. A. Sloane, Feb 20 2015

Keywords

Comments

Number of ON cells at n-th generation of 3-D CA defined by generalization of Rule 150, starting with a single ON cell at generation 0.
Number of odd coefficients in ((1/x+1+x)*(1/y+1+y)*(1/z+1+z))^n.
Run length transform of A253103.

Crossrefs

Programs

  • Mathematica
    a71053[n_] := Total[CoefficientList[(x^2 + x + 1)^n, x, Modulus -> 2]];
    Table[a71053[n]^3, {n, 0, 51}] (* Jean-François Alcover, Sep 15 2018 *)

A245562 Table read by rows: row n gives list of lengths of runs of 1's in binary expansion of n, starting with high-order bits.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 3, 4, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, 1, 2, 1, 2, 2, 3, 3, 1, 4, 5, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 3, 1, 4, 2, 2, 1
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2014

Keywords

Comments

A formula for A071053(n) depends on this table.

Examples

			Here are the run lengths for the numbers 0 through 21:
0, []
1, [1]
2, [1]
3, [2]
4, [1]
5, [1, 1]
6, [2]
7, [3]
8, [1]
9, [1, 1]
10, [1, 1]
11, [1, 2]
12, [2]
13, [2, 1]
14, [3]
15, [4]
16, [1]
17, [1, 1]
18, [1, 1]
19, [1, 2]
20, [1, 1]
21, [1, 1, 1]
		

Crossrefs

Row sums = A000120 (the binary weight).

Programs

  • Maple
    for n from 0 to 128 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:
    lprint(n,lis);
    od:
  • PARI
    row(n)=my(v=List(),k); while(n, n>>=valuation(n,2); listput(v, k=valuation(n+1,2)); n>>=k); Vecrev(v) \\ Charles R Greathouse IV, Oct 21 2016
  • Python
    from re import split
    A245562_list = [0]
    for n in range(1,100):
        A245562_list.extend(len(d) for d in split('0+',bin(n)[2:]) if d != '')
    # Chai Wah Wu, Sep 07 2014
    

A245563 Table read by rows: row n gives list of lengths of runs of 1's in binary expansion of n, starting with low-order bits.

Original entry on oeis.org

0, 1, 1, 2, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 2, 1, 2, 1, 2, 3, 4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 2, 1, 2, 1, 2, 2, 2, 3, 1, 3, 4, 5, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 3, 1, 4, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, 1, 2, 2, 2, 3, 2, 3, 1, 3, 1, 3, 2, 3, 4, 1, 4, 5, 6, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1
Offset: 0

Views

Author

N. J. A. Sloane, Aug 10 2014

Keywords

Comments

A formula for A071053(n) depends on this table.

Examples

			Here are the run lengths for the numbers 0 through 21:
0, []
1, [1]
2, [1]
3, [2]
4, [1]
5, [1, 1]
6, [2]
7, [3]
8, [1]
9, [1, 1]
10, [1, 1]
11, [2, 1]
12, [2]
13, [1, 2]
14, [3]
15, [4]
16, [1]
17, [1, 1]
18, [1, 1]
19, [2, 1]
20, [1, 1]
21, [1, 1, 1]
		

Crossrefs

Row sums = A000120 (the binary weight).
Row lengths are A069010.
The version for prime indices (instead of binary indices) is A124010.
Numbers with distinct run-lengths are A328592.
Numbers with equal run-lengths are A164707.

Programs

  • Haskell
    import Data.List (group)
    a245563 n k = a245563_tabf !! n !! k
    a245563_row n = a245563_tabf !! n
    a245563_tabf = [0] : map
       (map length . (filter ((== 1) . head)) . group) (tail a030308_tabf)
    -- Reinhard Zumkeller, Aug 10 2014
    
  • Maple
    for n from 0 to 128 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:=[op(lis),c]; out1:=1; c:=0;
    fi;
    if i = L1 and c>0 then lis:=[op(lis),c]; fi;
    od:
    lprint(n,lis);
    od:
  • Mathematica
    Join@@Table[Length/@Split[Join@@Position[Reverse[IntegerDigits[n,2]],1],#2==#1+1&],{n,0,100}] (* Gus Wiseman, Nov 03 2019 *)
  • Python
    from re import split
    A245563_list = [0]
    for n in range(1,100):
        A245563_list.extend(len(d) for d in split('0+',bin(n)[:1:-1]) if d != '')
    # Chai Wah Wu, Sep 07 2014

A246029 a(n) = Product_{i in row n of A245562} prime(i).

Original entry on oeis.org

1, 2, 2, 3, 2, 4, 3, 5, 2, 4, 4, 6, 3, 6, 5, 7, 2, 4, 4, 6, 4, 8, 6, 10, 3, 6, 6, 9, 5, 10, 7, 11, 2, 4, 4, 6, 4, 8, 6, 10, 4, 8, 8, 12, 6, 12, 10, 14, 3, 6, 6, 9, 6, 12, 9, 15, 5, 10, 10, 15, 7, 14, 11, 13, 2, 4, 4, 6, 4, 8, 6, 10, 4, 8, 8, 12, 6, 12, 10, 14, 4, 8, 8, 12, 8, 16, 12, 20, 6, 12, 12, 18
Offset: 0

Views

Author

N. J. A. Sloane, Aug 15 2014; revised Sep 05 2014

Keywords

Comments

This is the Run Length Transform of S(n) = {1,2,3,5,7,11,...} (1 followed by the primes).
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).

Examples

			From _Omar E. Pol_, Feb 12 2015: (Start)
Written as an irregular triangle in which row lengths is A011782:
1;
2;
2,3;
2,4,3,5;
2,4,4,6,3,6,5,7;
2,4,4,6,4,8,6,10,3,6,6,9,5,10,7,11;
2,4,4,6,4,8,6,10,4,8,8,12,6,12,10,14,3,6,6,9,6,12,9,15,5,10,10,15,7,14,11,13;
...
Right border gives the noncomposite numbers. This is simply a restatement of the theorem that this sequence is the Run Length Transform of A008578.
(End)
		

Crossrefs

Programs

  • 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(ithprime(i), i in lis);
    ans:=[op(ans),a];
    od:
    ans;
  • Mathematica
    f[n_, i_, x_] := f[n, i, x] = Which[n == 0, x, EvenQ[n], f[n/2, i + 1, x], True, f[(n - 1)/2, i, x*Prime[i]]];
    a5940[n_] := f[n - 1, 1, 1];
    a181819[n_] := Times @@ Prime[FactorInteger[n][[All, 2]]];
    a[0] = 1; a[n_] := a181819[a5940[n + 1]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 19 2018, after Antti Karttunen *)
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    from sympy import prime
    def A246029(n):
        return reduce(mul,(prime(len(d)) for d in split('0+',bin(n)[2:]) if d != '')) if n > 0 else 1
    # Chai Wah Wu, Sep 12 2014

Formula

a(n) = A181819(A005940(1+n)). - Antti Karttunen, Oct 15 2016

A246660 Run Length Transform of factorials.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 24, 1, 1, 1, 2, 1, 1, 2, 6, 2, 2, 2, 4, 6, 6, 24, 120, 1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 24, 2, 2, 2, 4, 2, 2, 4, 12, 6, 6, 6, 12, 24, 24, 120, 720, 1, 1, 1, 2, 1, 1, 2, 6, 1, 1, 1, 2, 2, 2, 6, 24, 1, 1, 1
Offset: 0

Views

Author

Peter Luschny, Sep 07 2014

Keywords

Comments

For the definition of the Run Length Transform see A246595.
Only Jordan-Polya numbers (A001013) are terms of this sequence.

Crossrefs

Cf. A003714 (gives the positions of ones).
Run Length Transforms of other sequences: A001316, A071053, A227349, A246588, A246595, A246596, A246661, A246674.

Programs

  • Mathematica
    Table[Times @@ (Length[#]!&) /@ Select[Split[IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 83}] (* Jean-François Alcover, Jul 11 2017 *)
  • PARI
    A246660(n) = { my(i=0, p=1); while(n>0, if(n%2, i++; p = p * i, i = 0); n = n\2); p; };
    for(n=0, 8192, write("b246660.txt", n, " ", A246660(n)));
    \\ Antti Karttunen, Sep 08 2014
    
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    from math import factorial
    def A246660(n):
        return reduce(mul,(factorial(len(d)) for d in split('0+',bin(n)[2:]) if d)) if n > 0 else 1 # Chai Wah Wu, Sep 09 2014
  • Sage
    def RLT(f, size):
        L = lambda n: [a for a in Integer(n).binary().split('0') if a != '']
        return [mul([f(len(d)) for d in L(n)]) for n in range(size)]
    A246660_list = lambda len: RLT(factorial, len)
    A246660_list(88)
    
  • Scheme
    ;; A stand-alone loop version, like the Pari-program above:
    (define (A246660 n) (let loop ((n n) (i 0) (p 1)) (cond ((zero? n) p) ((odd? n) (loop (/ (- n 1) 2) (+ i 1) (* p (+ 1 i)))) (else (loop (/ n 2) 0 p)))))
    ;; One based on given recurrence, utilizing memoizing definec-macro from my IntSeq-library:
    (definec (A246660 n) (cond ((zero? n) 1) ((even? n) (A246660 (/ n 2))) (else (* (A007814 (+ n 1)) (A246660 (/ (- n 1) 2))))))
    ;; Yet another implementation, using fold:
    (define (A246660 n) (fold-left (lambda (a r) (* a (A000142 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    (definec (A000142 n) (if (zero? n) 1 (* n (A000142 (- n 1)))))
    ;; Other functions are as in A227349 - Antti Karttunen, Sep 08 2014
    

Formula

a(2^n-1) = n!.
a(0) = 1, a(2n) = a(n), a(2n+1) = a(n) * A007814(2n+2). - Antti Karttunen, Sep 08 2014
a(n) = A112624(A005940(1+n)). - Antti Karttunen, May 29 2017
a(n) = A323505(n) / A323506(n). - Antti Karttunen, Jan 17 2019

A038184 State of one-dimensional cellular automaton 'sigma' (Rule 150): 000,001,010,011,100,101,110,111 -> 0,1,1,0,1,0,0,1 at generation n, converted to a decimal number.

Original entry on oeis.org

1, 7, 21, 107, 273, 1911, 5189, 28123, 65793, 460551, 1381653, 7039851, 17829905, 124809335, 340873541, 1840690907, 4295032833, 30065229831, 90195689493, 459568513131, 1172543963409, 8207807743863, 22286925370437
Offset: 0

Views

Author

Antti Karttunen, Feb 15 1999

Keywords

Comments

Generation n (starting from the generation 0: 1) interpreted as a binary number, but written in base 10.
Rows of the mod 2 trinomial triangle (A027907), interpreted as binary numbers: 1, 111, 10101, 1101011, ... (A118110). - Jacob A. Siehler, Aug 25 2006
See A071053 for number of ON cells. - N. J. A. Sloane, Jul 28 2014

Examples

			Bit patterns with "0" replaced by "." for visibilty [_Georg Fischer_, Dec 16 2021]:
  0:                    1
  1:                   111
  2:                  1.1.1
  3:                 11.1.11
  4:                1...1...1
  5:               111.111.111
  6:              1.1...1...1.1
  7:             11.11.111.11.11
  8:            1.......1.......1
  9:           111.....111.....111
  10:         1.1.1...1.1.1...1.1.1
  11:        11.1.11.11.1.11.11.1.11
  12:       1...1.......1.......1...1
  13:      111.111.....111.....111.111
  14:     1.1...1.1...1.1.1...1.1...1.1
  15:    11.11.11.11.11.1.11.11.11.11.11
		

Crossrefs

Cf. A006977, A006978, A038183, A038185 (other cellular automata).
This sequence, A071036 and A118110 are equivalent descriptions of the Rule 150 automaton.

Programs

  • Maple
    bit_n := (x,n) -> `mod`(floor(x/(2^n)),2);
    sigmagen := proc(n) option remember: if (0 = n) then (1)
    else sum('((bit_n(sigmagen(n-1),i)+bit_n(sigmagen(n-1),i-1)+bit_n(sigmagen(n-1),i-2)) mod 2)*(2^i)', 'i'=0..(2*n)) fi: end:
  • Mathematica
    f[n_] := Sum[2^k*Coefficient[ #, x, k], {k, 0, 2n}] & @ Expand[(1 + x + x^2)^n, Modulus -> 2] (* Jacob A. Siehler, Aug 25 2006 *)
  • PARI
    a(n) = subst(lift(Pol(Mod([1,1,1],2),'x)^n),'x,2);
    vector(23,n,a(n-1))  \\ Gheorghe Coserea, Jun 12 2016

A246035 Number of odd terms in f^n, where f = (1/x+1+x)*(1/y+1+y).

Original entry on oeis.org

1, 9, 9, 25, 9, 81, 25, 121, 9, 81, 81, 225, 25, 225, 121, 441, 9, 81, 81, 225, 81, 729, 225, 1089, 25, 225, 225, 625, 121, 1089, 441, 1849, 9, 81, 81, 225, 81, 729, 225, 1089, 81, 729, 729, 2025, 225, 2025, 1089, 3969, 25, 225, 225, 625, 225, 2025, 625, 3025, 121, 1089, 1089, 3025, 441, 3969, 1849, 7225, 9, 81, 81, 225, 81, 729, 225
Offset: 0

Views

Author

N. J. A. Sloane, Aug 20 2014

Keywords

Comments

This is the number of ON cells in a certain 2-D CA in which the neighborhood of a cell is defined by f, and in which a cell is ON iff there was an odd number of ON cells in the neighborhood at the previous generation.
This is the odd-rule cellular automaton defined by OddRule 777 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link).
Run Length Transform of {A001045(k+2)^2} (or of A139818).
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).

Examples

			Here is the neighborhood:
[X, X, X]
[X, X, X]
[X, X, X]
which contains a(1) = 9 ON cells.
.
From Omar E. Pol, Mar 17 2015: (Start)
Apart from the initial 1, the sequence can be written also as an irregular tetrahedron T(s,r,k) = A139818(r+2) * a(k), s>=1, 1<=r<=s, 0<=k<=(A011782(s-r)-1) as shown below:
..
9;
...
9;
25;
..........
9,     81;
25;
121;
....................
9,     81,  81, 225;
25,   225;
121;
441;
........................................
9,     81,  81, 225, 81, 729, 225, 1089;
25,   225, 225, 625;
121, 1089;
441;
1849;
...
Note that every row r is equal to A139818(r+2) times the beginning of the sequence itself, thus in 3D every column contains the same number: T(s,r,k) = T(s+1,r,k).
(End)
		

Crossrefs

Other CA's that use the same rule but with different cell neighborhoods: A160239, A102376, A071053, A072272, A001316, A246034.

Programs

  • Maple
    C:=f->subs({x=1, y=1}, f);
    # Find number of ON cells in CA for generations 0 thru M defined by rule
    # that cell is ON iff number of ON cells in nbd at time n-1 was odd
    # where nbd is defined by a polynomial or Laurent series f(x, y).
    OddCA:=proc(f, M) global C; local n, a, i, f2, p;
    f2:=simplify(expand(f)) mod 2;
    a:=[]; p:=1;
    for n from 0 to M do a:=[op(a), C(p)]; p:=expand(p*f2) mod 2; od:
    lprint([seq(a[i], i=1..nops(a))]);
    end;
    f:=(1/x+1+x)*(1/y+1+y);
    OddCA(f, 70);
  • Mathematica
    b[0] = 1; b[n_] := b[n] = Expand[b[n - 1]*(x^2 + x + 1)];
    a[n_] := Count[CoefficientList[b[n], x], _?OddQ]^2;
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Apr 30 2017 *)

Formula

a(n) = A071053(n)^2.

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

Original entry on oeis.org

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, 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, 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
Offset: 0

Views

Author

N. J. A. Sloane, Sep 05 2014

Keywords

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

Crossrefs

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

Programs

  • Haskell
    import Data.List (group)
    a246588 = product . map (a000120 . length) .
              filter ((== 1) . head) . group . a030308_row
    -- Reinhard Zumkeller, Feb 13 2015, Sep 05 2014
    
  • Maple
    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;
    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(wt(i), i in lis);
    ans:=[op(ans), a];
    od:
    ans;
  • Mathematica
    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 *)
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    def A246588(n):
        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
    
  • Sage
    # uses[RLT from A246660]
    A246588_list = lambda len: RLT(lambda n: sum(Integer(n).digits(2)), len)
    A246588_list(88) # Peter Luschny, Sep 07 2014

A246595 Run Length Transform of squares.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Sep 06 2014

Keywords

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

Examples

			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)
		

Crossrefs

Cf. A003714 (gives the positions of ones).
Run Length Transforms of other sequences: A071053, A227349, A246588, A246596, A246660, A246661, A246674.

Programs

  • 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 *)
  • 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

Formula

a(n) = A227349(n)^2. - Omar E. Pol, Feb 10 2015

A246596 Run Length Transform of Catalan numbers A000108.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 2, 2, 5, 14, 1, 1, 1, 2, 1, 1, 2, 5, 2, 2, 2, 4, 5, 5, 14, 42, 1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 2, 2, 5, 14, 2, 2, 2, 4, 2, 2, 4, 10, 5, 5, 5, 10, 14, 14, 42, 132, 1, 1, 1, 2, 1, 1, 2, 5, 1, 1, 1, 2, 2, 2, 5, 14, 1, 1, 1, 2, 1, 1, 2, 5
Offset: 0

Views

Author

N. J. A. Sloane, Sep 06 2014

Keywords

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

Examples

			From _Omar E. Pol_, Feb 15 2015: (Start)
Written as an irregular triangle in which row lengths are the terms of A011782:
1;
1;
1,2;
1,1,2,5;
1,1,1,2,2,2,5,14;
1,1,1,2,1,1,2,5,2,2,2,4,5,5,14,42;
1,1,1,2,1,1,2,5,1,1,1,2,2,2,5,14,2,2,2,4,2,2,4,10,5,5,5,10,14,14,42,132;
...
Right border gives the Catalan numbers. This is simply a restatement of the theorem that this sequence is the Run Length Transform of A000108.
(End)
		

Crossrefs

Cf. A000108.
Cf. A003714 (gives the positions of ones).
Run Length Transforms of other sequences: A005940, A069739, A071053, A227349, A246588, A246595, A246660, A246661, A246674.

Programs

  • Maple
    Cat:=n->binomial(2*n,n)/(n+1);
    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(Cat(i), i in lis);
    ans:=[op(ans), a];
    od:
    ans;
  • Mathematica
    f = CatalanNumber; Table[Times @@ (f[Length[#]]&) /@ Select[ Split[ IntegerDigits[n, 2]], #[[1]] == 1&], {n, 0, 87}] (* Jean-François Alcover, Jul 11 2017 *)
  • Python
    from operator import mul
    from functools import reduce
    from gmpy2 import divexact
    from re import split
    def A246596(n):
        s, c = bin(n)[2:], [1, 1]
        for m in range(1, len(s)):
            c.append(divexact(c[-1]*(4*m+2),(m+2)))
        return reduce(mul,(c[len(d)] for d in split('0+',s))) if n > 0 else 1
    # Chai Wah Wu, Sep 07 2014
    
  • Sage
    # uses[RLT from A246660]
    A246596_list = lambda len: RLT(lambda n: binomial(2*n, n)/(n+1), len)
    A246596_list(88) # Peter Luschny, Sep 07 2014
    
  • Scheme
    ; using MIT/GNU Scheme
    (define (A246596 n) (fold-left (lambda (a r) (* a (A000108 r))) 1 (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    (define A000108 (EIGEN-CONVOLUTION 1 *))
    ;; Note: EIGEN-CONVOLUTION can be found from my IntSeq-library and other functions are as in A227349. - Antti Karttunen, Sep 08 2014

Formula

a(n) = A069739(A005940(1+n)). - Antti Karttunen, May 29 2017
Showing 1-10 of 43 results. Next