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 30 results. Next

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

A245564 a(n) = Product_{i in row n of A245562} Fibonacci(i+2).

Original entry on oeis.org

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

Views

Author

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

Keywords

Comments

This is the Run Length Transform of S(n) = Fibonacci(n+2).
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).
Also the number of sparse subsets of the binary indices of n, where a set is sparse iff 1 is not a first difference. The maximal case is A384883. For prime instead of binary indices we have A166469. - Gus Wiseman, Jul 05 2025

Examples

			From _Gus Wiseman_, Jul 05 2025: (Start)
The binary indices of 11 are {1,2,4}, with sparse subsets {{},{1},{2},{4},{1,4},{2,4}}, so a(11) = 6.
The maximal runs of binary indices of 11 are ((1,2),(4)), with lengths (2,1), so a(11) = F(2+2)*F(1+2) = 6.
The a(0) = 1 through a(12) = 3 sparse subsets are:
  0    1    2    3    4    5    6    7    8    9    10    11    12
  ------------------------------------------------------------------
  {}   {}   {}   {}   {}   {}   {}   {}   {}   {}    {}    {}    {}
       {1}  {2}  {1}  {3}  {1}  {2}  {1}  {4}  {1}   {2}   {1}   {3}
                 {2}       {3}  {3}  {2}       {4}   {4}   {2}   {4}
                           {1,3}     {3}       {1,4} {2,4} {4}
                                     {1,3}                 {1,4}
                                                           {2,4}
The greatest number whose set of binary indices is a member of column n above is A374356(n).
(End)
		

Crossrefs

A034839 counts subsets by number of maximal runs, strict partitions A116674.
A384877 gives lengths of maximal anti-runs of binary indices, firsts A384878.
A384893 counts subsets by number of maximal anti-runs, for partitions A268193, A384905.

Programs

  • Maple
    with(combinat); 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(fibonacci(i+2), i in lis);
    ans:=[op(ans),a];
    od:
    ans;
  • Mathematica
    a[n_] := Sum[Mod[Binomial[3k, k] Binomial[n, k], 2], {k, 0, n}];
    a /@ Range[0, 100] (* Jean-François Alcover, Feb 29 2020, after Chai Wah Wu *)
    spars[S_]:=Select[Subsets[S],FreeQ[Differences[#],1]&];
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Length[spars[bpe[n]]],{n,0,30}] (* Gus Wiseman, Jul 05 2025 *)
  • PARI
    a(n)=my(s=1,k); while(n, n>>=valuation(n,2); k=valuation(n+1,2); s*=fibonacci(k+2); n>>=k); s \\ Charles R Greathouse IV, Oct 21 2016
    
  • Python
    # use RLT function from A278159
    from sympy import fibonacci
    def A245564(n): return RLT(n,lambda m: fibonacci(m+2)) # Chai Wah Wu, Feb 04 2022

Formula

a(n) = Sum_{k=0..n} ({binomial(3k,k)*binomial(n,k)} mod 2). - Chai Wah Wu, Oct 19 2016

A245565 a(n) = Product_{i in row n of A245562} Pell(i+1).

Original entry on oeis.org

1, 2, 2, 5, 2, 4, 5, 12, 2, 4, 4, 10, 5, 10, 12, 29, 2, 4, 4, 10, 4, 8, 10, 24, 5, 10, 10, 25, 12, 24, 29, 70, 2, 4, 4, 10, 4, 8, 10, 24, 4, 8, 8, 20, 10, 20, 24, 58, 5, 10, 10, 25, 10, 20, 25, 60, 12, 24, 24, 60, 29, 58, 70, 169, 2, 4, 4, 10, 4, 8, 10, 24, 4, 8, 8, 20, 10, 20, 24, 58, 4, 8, 8, 20, 8, 16
Offset: 0

Views

Author

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

Keywords

Comments

This is the Run Length Transform of S(n) = Pell(n+1) (cf. A000129).
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

Programs

  • Maple
    A000129 := proc(n) option remember; if n <=1 then n; else 2*A000129(n-1)+A000129(n-2); fi; end;
    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(A000129(i+1), i in lis);
    ans:=[op(ans),a];
    od:
    ans;

A246028 a(n) = Product_{i in row n of A245562} Fibonacci(i+1).

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 5, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 4, 3, 3, 5, 8, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 5, 2, 2, 2, 4, 2, 2, 4, 6, 3, 3, 3, 6, 5, 5, 8, 13, 1, 1, 1, 2, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 3, 5, 1, 1, 1, 2, 1, 1, 2, 3, 2, 2, 2, 4, 3, 3, 5, 8, 2, 2, 2, 4, 2
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) = Fibonacci(n+1).
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

Programs

  • Maple
    with(combinat); 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(fibonacci(i+1), i in lis);
    ans:=[op(ans),a];
    od:
    ans;
  • Mathematica
    a[n_] := Sum[Mod[Binomial[n-k, 2k] Binomial[n, k], 2], {k, 0, n}];
    a /@ Range[0, 100] (* Jean-François Alcover, Feb 28 2020, after Chai Wah Wu *)
  • PARI
    a(n)=my(s=1,k); while(n, n>>=valuation(n,2); k=valuation(n+1,2); if(k>1, s*=fibonacci(k+1)); n>>=k); s \\ Charles R Greathouse IV, Oct 21 2016
    
  • PARI
    a(n)=sum(k=0,n, !bitand(n-3*k,2*k) && !bitand(n-k,k)) \\ Charles R Greathouse IV, Oct 21 2016
    
  • Python
    def A246028(n): return sum(int(not (~(n-k) & 2*k) | (~n & k)) for k in range(n+1)) # Chai Wah Wu, Sep 27 2021

Formula

a(n) = Sum_{k=0..n} ((binomial(n-k,2k)*binomial(n,k)) mod 2). - Chai Wah Wu, Oct 19 2016

A246011 a(n) = Product_{i in row n of A245562} Lucas(i+1), where Lucas = A000204.

Original entry on oeis.org

1, 3, 3, 4, 3, 9, 4, 7, 3, 9, 9, 12, 4, 12, 7, 11, 3, 9, 9, 12, 9, 27, 12, 21, 4, 12, 12, 16, 7, 21, 11, 18, 3, 9, 9, 12, 9, 27, 12, 21, 9, 27, 27, 36, 12, 36, 21, 33, 4, 12, 12, 16, 12, 36, 16, 28, 7, 21, 21, 28, 11, 33, 18, 29, 3, 9, 9, 12, 9, 27, 12, 21, 9, 27, 27, 36, 12, 36, 21, 33, 9, 27, 27, 36, 27
Offset: 0

Views

Author

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

Keywords

Comments

This is the Run Length Transform of S(n) = Lucas(n+1) = 1,3,4,7,11,... (cf. A000204).
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;
3;
3,4;
3,9,4,7;
3,9,9,12,4,12,7,11;
3,9,9,12,9,27,12,21,4,12,12,16,7,21,11,18;
3,9,9,12,9,27,12,21,9,27,27,36,12,36,21,33,4,12,12,16,12,36,16,28,7,21,21,28,11,33,18,29;
...
Right border gives the Lucas numbers (beginning with 1). This is simply a restatement of the theorem that this sequence is the Run Length Transform of A000204.
(End)
		

Crossrefs

Programs

  • Maple
    A000204 := proc(n) option remember; if n <=2 then 2*n-1; else A000204(n-1)+A000204(n-2); fi; end;
    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(A000204(i+1), i in lis);
    ans:=[op(ans),a];
    od:
    ans;
  • Python
    from math import prod
    from re import split
    from sympy import lucas
    def run_length_transform(f): return lambda n: prod(f(len(d)) for d in split('0+', bin(n)[2:]) if d != '') if n > 0 else 1
    def A246011(n): return run_length_transform(lambda n:lucas(n+1))(n) # Chai Wah Wu, Oct 24 2024

A071053 Number of ON cells at n-th generation of 1-D CA defined by Rule 150, starting with a single ON cell at generation 0.

Original entry on oeis.org

1, 3, 3, 5, 3, 9, 5, 11, 3, 9, 9, 15, 5, 15, 11, 21, 3, 9, 9, 15, 9, 27, 15, 33, 5, 15, 15, 25, 11, 33, 21, 43, 3, 9, 9, 15, 9, 27, 15, 33, 9, 27, 27, 45, 15, 45, 33, 63, 5, 15, 15, 25, 15, 45, 25, 55, 11, 33, 33, 55, 21, 63, 43, 85, 3, 9, 9, 15, 9, 27, 15, 33, 9, 27, 27
Offset: 0

Views

Author

Hans Havermann, May 26 2002

Keywords

Comments

Number of 1's in n-th row of triangle in A071036.
Number of odd coefficients in (x^2+x+1)^n. - Benoit Cloitre, Sep 05 2003. This result was given in Wolfram (1983). - N. J. A. Sloane, Feb 17 2015
This is also the odd-rule cellular automaton defined by OddRule 007 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link). - N. J. A. Sloane, Feb 25 2015
This is the Run Length Transform of S(n) = Jacobsthal(n+2) (cf. A001045). 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). - N. J. A. Sloane, Sep 05 2014

Examples

			May be arranged into blocks of sizes 1,1,2,4,8,16,...:
1,
3,
3, 5,
3, 9, 5, 11,
3, 9, 9, 15, 5, 15, 11, 21,
3, 9, 9, 15, 9, 27, 15, 33, 5, 15, 15, 25, 11, 33, 21, 43,
3, 9, 9, 15, 9, 27, 15, 33, 9, 27, 27, 45, 15, 45, 33, 63, 5, 15, 15, 25, 15, 45, 25, 55, 11, 33, 33, 55, 21, 63, 43, 85,
3, 9, 9, 15, 9, 27, 15, 33, 9, 27, 27, ...
... - _N. J. A. Sloane_, Sep 05 2014
.
From _Omar E. Pol_, Mar 15 2015: (Start)
Apart from the initial 1, the sequence can be written also as an irregular tetrahedron T(s,r,k) = A001045(r+2) * a(k), s>=1, 1<=r<=s, 0<=k<=(A011782(s-r)-1) as shown below (see also _Joerg Arndt_'s equivalent program):
3;
..
3;
5;
.......
3,   9;
5;
11;
...............
3,   9,  9, 15;
5,  15;
11;
21;
...............................
3,   9,  9, 15,  9, 27, 15, 33;
5,  15, 15, 25;
11, 33;
21;
43;
..............................................................
3,   9,  9, 15,  9, 27, 15, 33, 9, 27, 27, 45, 15, 45, 33, 63;
5,  15, 15, 25, 15, 45, 25, 55;
11, 33, 33, 55;
21, 63;
43;
85;
...
Note that every row r is equal to A001045(r+2) times the beginning of the sequence itself, thus in 3D every column contains the same number.
(End)
		

References

  • S. Wolfram, A New Kind of Science, Wolfram Media, 2002; Chapter 3.

Crossrefs

Programs

  • Mathematica
    a[n_] := Total[CoefficientList[(x^2 + x + 1)^n, x, Modulus -> 2]];
    Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 05 2018 *)
  • PARI
    b(n) = { (2^n - (-1)^n) / 3; }  \\ A001045
    a(n)=
    {
        if ( n==0, return(1) );
        \\ Use  a( 2^k * t ) = a(t)
        n \= 2^valuation(n,2);
        if ( n==1, return(3) );  \\ Use a(2^k) == 3
        \\ now n is odd
        my ( v1 = valuation(n+1, 2) );
        \\ Use a( 2^k - 1 ) = A001045( 2 + k ):
        if ( n == 2^v1 - 1 ,  return( b( v1 + 2 ) ) );
        my( k2 = 1, k = 0 );
        while ( k2 < n,  k2 <<= 1; k+=1 );
        if ( k2 > n, k2 >>= 1; k-=1 );
        my( t = n - k2 );
        \\ here  n == 2^k + 1 where k maximal
        \\ Use the following:
        \\ a( 2^k + t ) =  3 * a(t)  if  t <= 2^(k-1)
        \\ a( 2^k + 2^(k-1) + t ) =  5 * a(t)  if  t <= 2^(k-2)
        \\ a( 2^k + 2^(k-1) + 2^(k-2) + t ) =  11* a(t)  if  t <= 2^(k-3)
        \\  ... etc. ...
        \\ a( 2^k + ... + 2^(k-s) + t ) = A001045(s+2) * a(t)  if  t <= 2^((k-1)-s)
        my ( s=1 );
        while ( 1 ,
            k2 >>= 1;
            if ( t <= k2 ,  return(  b(s+2) * a(t) ) );
            t -= k2;
            s += 1;
        );
    }
    \\ Joerg Arndt, Mar 15 2015, from SeqFan Mailing List, Mar 09 2015

Formula

a(n) = Product_{i in row n of A245562} A001045(i+2) [Sillke]. For example, a(11) = A001045(3)*A001045(4) = 3*5 = 15. - N. J. A. Sloane, Aug 10 2014
Floor((a(n)-1)/4) mod 2 = A020987(n). - Ralf Stephan, Mar 18 2004
a(2*n) = a(n); a(2*n+1) = a(n) + 2*a(floor(n/2)). - Peter J. Taylor, Mar 26 2020
Sum_{k = 0..2^n-1} a(k) = A087206(n). - Linhua Zou, Jun 13 2025

Extensions

Entry revised by N. J. A. Sloane, Aug 13 2014

A160239 Number of "ON" cells in a 2-dimensional cellular automaton ("Fredkin's Replicator") evolving according to the rule that a cell is ON in a given generation if and only if there was an odd number of ON cells among the eight nearest neighbors in the preceding generation, starting with one ON cell.

Original entry on oeis.org

1, 8, 8, 24, 8, 64, 24, 112, 8, 64, 64, 192, 24, 192, 112, 416, 8, 64, 64, 192, 64, 512, 192, 896, 24, 192, 192, 576, 112, 896, 416, 1728, 8, 64, 64, 192, 64, 512, 192, 896, 64, 512, 512, 1536, 192, 1536, 896, 3328, 24, 192, 192, 576, 192, 1536, 576, 2688, 112, 896, 896, 2688, 416, 3328, 1728, 6784
Offset: 0

Views

Author

John W. Layman, May 05 2009

Keywords

Comments

This is the odd-rule cellular automaton defined by OddRule 757 (see Ekhad-Sloane-Zeilberger "Odd-Rule Cellular Automata on the Square Grid" link). - N. J. A. Sloane, Feb 25 2015
The partial sums are in A245542, in which the structure also looks like an irregular stepped pyramid. - Omar E. Pol, Jan 29 2015

Examples

			From _Omar E. Pol_, Jul 22 2014 (Start):
Written as an irregular triangle in which row lengths is A011782 the sequence begins:
1;
8;
8, 24;
8, 64, 24, 112;
8, 64, 64, 192, 24, 192, 112, 416;
8, 64, 64, 192, 64, 512, 192, 896, 24, 192, 192, 576, 112, 896, 416, 1728;
8, 64, 64, 192, 64, 512, 192, 896, 64, 512, 512, 1536, 192, 1536, 896, 3328, 24, 192, 192, 576, 192, 1536, 576, 2688, 112, 896, 896, 2688, 416, 3328, 1728, 6784;
(End)
Right border gives A246030. - _Omar E. Pol_, Jan 29 2015 [This is simply a restatement of the theorem that this sequence is the Run Length Transform of A246030. - _N. J. A. Sloane_, Jan 29 2015]
.
From _Omar E. Pol_, Mar 18 2015 (Start):
Also, the sequence can be written as an irregular tetrahedron as shown below:
1;
..
8;
..
8;
24;
.........
8,    64;
24;
112;
...................
8,    64,  64, 192;
24,  192;
112;
416;
.....................................
8,    64,  64, 192, 64, 512,192, 896;
24,  192, 192, 576;
112, 896;
416;
1728;
.......................................................................
8,    64,  64, 192, 64, 512,192, 896,64,512,512,1536,192,1536,896,3328;
24,  192, 192, 576,192,1536,576,2688;
112, 896, 896,2688;
416,3328;
1728;
6784;
...
Apart from the initial 1, we have that T(s,r,k) = T(s+1,r,k). On the other hand, it appears that the configuration of ON cells of T(s,r,k) is also the central part of the configuration of ON cells of T(s+1,r+1,k).
(End)
		

Crossrefs

Cf. A122108, A147562, A164032, A245180 (gives a(n)/8, n>=2).
Cf. also A245542 (Partial sums), A245543, A083424, A245562, A246030, A254731 (an "even-rule" version).

Programs

  • Haskell
    import Data.List (transpose)
    a160239 n = a160239_list !! n
    a160239_list = 1 : (concat $
       transpose [a8, hs, zipWith (+) (map (* 2) hs) a8, tail a160239_list])
       where a8 = map (* 8) a160239_list;
             hs = h a160239_list; h (_:x:xs) = x : h xs
    -- Reinhard Zumkeller, Feb 13 2015
    
  • Maple
    # From N. J. A. Sloane, Jan 19 2015:
    f:=proc(n) option remember;
    if n=0 then RETURN(1);
    elif n mod 2 = 0 then RETURN(f(n/2))
    elif n mod 4 = 1 then RETURN(8*f((n-1)/4))
    else RETURN(f(n-2)+2*f((n-1)/2)); fi;
    end;
    [seq(f(n),n=0..255)];
  • Mathematica
    A160239[n_] :=
    CellularAutomaton[{52428, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}}, {{{1}}, 0}, {{n}}][[1]] // Total@*Total (* Charles R Greathouse IV, Aug 21 2014 *)
    ArrayPlot /@ CellularAutomaton[{52428, {2, {{2, 2, 2}, {2, 1, 2}, {2, 2, 2}}}, {1, 1}}, {{{1}}, 0}, 30] (* Charles R Greathouse IV, Aug 21 2014 *)
  • PARI
    A160239=[];a(n)={if(n>#A160239,A160239=concat(A160239,vector(n-#A160239)),n||return(1);A160239[n]&&return(A160239[n]));A160239[n]=if(bittest(n,0),if(bittest(n,1),a(n-2)+2*a(n\2),a(n\4)*8),a(n\2))} \\ M. F. Hasler, May 10 2016

Formula

a(0) = 1; a(2t)=a(t), a(4t+1)=8*a(t), a(4t+3)=2*a(2t+1)+8*a(t) for t >= 0. (Conjectured by Hrothgar, Jul 11 2014; proved by N. J. A. Sloane, Oct 04 2014.)
For n >= 2, a(n) = 8^r * Product_{lengths i of runs of 1 in binary expansion of n} R(i), where r is the number of runs of 1 in the binary expansion of n and R(i) = A083424(i-1) = (5*4^(i-1)+(-2)^(i-1))/6. Note that row i of the table in A245562 lists the lengths of runs of 1 in binary expansion of i. Example: n=7 = 111 in binary, so r=1, i=3, R(3) = A083424(2) = 14, and so a(7) = 8^1*14 = 112. That is, this sequence is the Run Length Transform of A246030. - N. J. A. Sloane, Oct 04 2014
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). - N. J. A. Sloane, Aug 25 2014

Extensions

Offset changed to 1 by Hrothgar, Jul 11 2014
Offset reverted to 0 by N. J. A. Sloane, Jan 19 2015

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

A227349 Product of lengths of runs of 1-bits in binary representation of n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jul 08 2013

Keywords

Comments

This is the Run Length Transform of S(n) = {0, 1, 2, 3, 4, 5, 6, ...}. 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). - N. J. A. Sloane, Sep 05 2014
Like all run length transforms also this sequence satisfies for all i, j: A278222(i) = A278222(j) => a(i) = a(j). - Antti Karttunen, Apr 14 2017

Examples

			a(0) = 1, as zero has no runs of 1's, and an empty product is 1.
a(1) = 1, as 1 is "1" in binary, and the length of that only 1-run is 1.
a(2) = 1, as 2 is "10" in binary, and again there is only one run of 1-bits, of length 1.
a(3) = 2, as 3 is "11" in binary, and there is one run of two 1-bits.
a(55) = 6, as 55 is "110111" in binary, and 2 * 3 = 6.
a(119) = 9, as 119 is "1110111" in binary, and 3 * 3 = 9.
From _Omar E. Pol_, Feb 10 2015: (Start)
Written as an irregular triangle in which row lengths is A011782:
  1;
  1;
  1,2;
  1,1,2,3;
  1,1,1,2,2,2,3,4;
  1,1,1,2,1,1,2,3,2,2,2,4,3,3,4,5;
  1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4,2,2,2,4,2,2,4,6,3,3,3,6,4,4,5,6;
  ...
Right border gives A028310: 1 together with the positive integers. (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;
  2;
  ....
  1,1;
  2;
  3;
  ........
  1,1,1,2;
  2,2;
  3;
  4;
  ................
  1,1,1,2,1,1,2,3;
  2,2,2,4;
  3,3;
  4;
  5;
  ................................
  1,1,1,2,1,1,2,3,1,1,1,2,2,2,3,4;
  2,2,2,4,2,2,4,6;
  3,3,3,6;
  4,4;
  5;
  6;
  ...
Apart from the initial 1, we have that T(s, r, k) = T(s+1, r, k). (End)
		

Crossrefs

Cf. A003714 (positions of ones), A005361, A005940.
Cf. A000120 (sum of lengths of runs of 1-bits), A167489, A227350, A227193, A278222, A245562, A284562, A284569, A283972, A284582, A284583.
Run Length Transforms of other sequences: A246588, A246595, A246596, A246660, A246661, A246674.
Differs from similar A284580 for the first time at n=119, where a(119) = 9, while A284580(119) = 5.

Programs

  • Maple
    a:= proc(n) local i, m, r; m, r:= n, 1;
          while m>0 do
            while irem(m, 2, 'h')=0 do m:=h od;
            for i from 0 while irem(m, 2, 'h')=1 do m:=h od;
            r:= r*i
          od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jul 11 2013
    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, i in lis);
    ans:=[op(ans), a];
    od:
    ans;  # N. J. A. Sloane, Sep 05 2014
  • Mathematica
    onBitRunLenProd[n_] := Times @@ Length /@ Select[Split @ IntegerDigits[n, 2], #[[1]] == 1 & ]; Array[onBitRunLenProd, 100, 0] (* Jean-François Alcover, Mar 02 2016 *)
  • Python
    from operator import mul
    from functools import reduce
    from re import split
    def A227349(n):
        return reduce(mul, (len(d) 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]
    A227349_list = lambda len: RLT(lambda n: n, len)
    A227349_list(88) # Peter Luschny, Sep 07 2014
    
  • Scheme
    (define (A227349 n) (apply * (bisect (reverse (binexp->runcount1list n)) (- 1 (modulo n 2)))))
    (define (bisect lista parity) (let loop ((lista lista) (i 0) (z (list))) (cond ((null? lista) (reverse! z)) ((eq? i parity) (loop (cdr lista) (modulo (1+ i) 2) (cons (car lista) z))) (else (loop (cdr lista) (modulo (1+ i) 2) z)))))
    (define (binexp->runcount1list n) (if (zero? n) (list) (let loop ((n n) (rc (list)) (count 0) (prev-bit (modulo n 2))) (if (zero? n) (cons count rc) (if (eq? (modulo n 2) prev-bit) (loop (floor->exact (/ n 2)) rc (1+ count) (modulo n 2)) (loop (floor->exact (/ n 2)) (cons count rc) 1 (modulo n 2)))))))

Formula

A167489(n) = a(n) * A227350(n).
A227193(n) = a(n) - A227350(n).
a(n) = Product_{i in row n of table A245562} i. - N. J. A. Sloane, Aug 10 2014
From Antti Karttunen, Apr 14 2017: (Start)
a(n) = A005361(A005940(1+n)).
a(n) = A284562(n) * A284569(n).
A283972(n) = n - a(n).
(End)
a(4n+1) = a(2n) = a(n). If n is odd, then a(4n+3) = 2*a(2n+1)-a(n). If n is even, then a(4n+3) = 2*a(2n+1) = 2*a(n/2). - Chai Wah Wu, Jul 17 2025

Extensions

Data section extended up to term a(120) by Antti Karttunen, Apr 14 2017

A384877 Irregular triangle read by rows where row k lists the lengths of maximal anti-runs (increasing by more than 1) in the binary indices of n.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 2, 1, 1, 2, 2, 3, 3, 1, 3, 1, 2, 2, 2
Offset: 0

Views

Author

Gus Wiseman, Jun 17 2025

Keywords

Comments

A binary index of n is any position of a 1 in its reversed binary expansion. The binary indices of n are row n of A048793.

Examples

			The binary indices of 182 are {2,3,5,6,8}, with maximal anti-runs ((2),(3,5),(6,8)) so row 182 is (1,2,2).
Triangle begins:
   0: ()
   1: (1)
   2: (1)
   3: (1,1)
   4: (1)
   5: (2)
   6: (1,1)
   7: (1,1,1)
   8: (1)
   9: (2)
  10: (2)
  11: (1,2)
  12: (1,1)
  13: (2,1)
  14: (1,1,1)
  15: (1,1,1,1)
		

Crossrefs

Row-sums are A000120.
Positions of rows of the form (1,1,...) are A023758.
Positions of first appearances of each distinct row appear to be A052499.
For runs instead of anti-runs we have A245563, reverse A245562.
Row-lengths are A384890.
A355394 counts partitions without a neighborless part, singleton case A355393.
A356606 counts strict partitions without a neighborless part, complement A356607.
A384175 counts subsets with all distinct lengths of maximal runs, complement A384176.

Programs

  • Mathematica
    bpe[n_]:=Join@@Position[Reverse[IntegerDigits[n,2]],1];
    Table[Length/@Split[bpe[n],#2!=#1+1&],{n,0,100}]
Showing 1-10 of 30 results. Next