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

A238343 Triangle T(n,k) read by rows: T(n,k) is the number of compositions of n with k descents, n>=0, 0<=k<=n.

Original entry on oeis.org

1, 1, 0, 2, 0, 0, 3, 1, 0, 0, 5, 3, 0, 0, 0, 7, 9, 0, 0, 0, 0, 11, 19, 2, 0, 0, 0, 0, 15, 41, 8, 0, 0, 0, 0, 0, 22, 77, 29, 0, 0, 0, 0, 0, 0, 30, 142, 81, 3, 0, 0, 0, 0, 0, 0, 42, 247, 205, 18, 0, 0, 0, 0, 0, 0, 0, 56, 421, 469, 78, 0, 0, 0, 0, 0, 0, 0, 0, 77, 689, 1013, 264, 5, 0, 0, 0, 0, 0, 0, 0, 0, 101, 1113, 2059, 786, 37, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 25 2014

Keywords

Comments

Counting ascents gives the same triangle.
For n > 0, also the number of compositions of n with k + 1 maximal weakly increasing runs. - Gus Wiseman, Mar 23 2020

Examples

			Triangle starts:
00:    1;
01:    1,    0;
02:    2,    0,    0;
03:    3,    1,    0,    0;
04:    5,    3,    0,    0,   0;
05:    7,    9,    0,    0,   0, 0;
06:   11,   19,    2,    0,   0, 0, 0;
07:   15,   41,    8,    0,   0, 0, 0, 0;
08:   22,   77,   29,    0,   0, 0, 0, 0, 0;
09:   30,  142,   81,    3,   0, 0, 0, 0, 0, 0;
10:   42,  247,  205,   18,   0, 0, 0, 0, 0, 0, 0;
11:   56,  421,  469,   78,   0, 0, 0, 0, 0, 0, 0, 0;
12:   77,  689, 1013,  264,   5, 0, 0, 0, 0, 0, 0, 0, 0;
13:  101, 1113, 2059,  786,  37, 0, 0, 0, 0, 0, 0, 0, 0, 0;
14:  135, 1750, 4021, 2097, 189, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
15:  176, 2712, 7558, 5179, 751, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
...
From _Gus Wiseman_, Mar 23 2020: (Start)
Row n = 5 counts the following compositions:
  (5)          (3,2)
  (1,4)        (4,1)
  (2,3)        (1,3,1)
  (1,1,3)      (2,1,2)
  (1,2,2)      (2,2,1)
  (1,1,1,2)    (3,1,1)
  (1,1,1,1,1)  (1,1,2,1)
               (1,2,1,1)
               (2,1,1,1)
(End)
		

Crossrefs

T(3n,n) gives A000045(n+1).
T(3n+1,n) = A136376(n+1).
Row sums are A011782.
Compositions by length are A007318.
The version for co-runs or levels is A106356.
The case of partitions (instead of compositions) is A133121.
The version for runs is A238279.
The version without zeros is A238344.
The version for weak ascents is A333213.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, expand(
           add(b(n-j, j)*`if`(j (p-> seq(coeff(p, x, i), i=0..n))(b(n, 0)):
    seq(T(n), n=0..20);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n-j, j]*If[jJean-François Alcover, Jan 08 2015, translated from Maple *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],n==0||Length[Split[#,LessEqual]]==k+1&]],{n,0,9},{k,0,n}] (* Gus Wiseman, Mar 23 2020 *)

Formula

Sum_{k=0..n} k * T(n,k) = A045883(n-2) for n>=2.

A045883 a(n) = ((3*n+1)*2^n - (-1)^n)/9.

Original entry on oeis.org

0, 1, 3, 9, 23, 57, 135, 313, 711, 1593, 3527, 7737, 16839, 36409, 78279, 167481, 356807, 757305, 1601991, 3378745, 7107015, 14913081, 31224263, 65244729, 136081863, 283348537, 589066695, 1222872633, 2535223751, 5249404473, 10856722887, 22429273657, 46290203079
Offset: 0

Views

Author

Keywords

Comments

Without the initial zero, PSumSIGN transform of A001787. - Michael Somos, Jul 10 2003
Number of rises (drops) in the compositions of n+2 with parts in N.
From Michel Lagneau, Jan 13 2012: (Start)
This sequence is connected with the Collatz problem. We consider the array T(i,j) where the i-th row gives the parity trajectory of i, for example for i = 6, the infinite trajectory is 6 -> 3 -> 10 ->5 -> 16 ->8 -> 4 -> 2 -> 1 -> 4 -> 2 -> 1 -> 4->2-> 1 ... and T(6,j) = [0,1,0,1,0,0,0,0,1,0,0,1,...,1,0,0,1,...]. Now, we consider the sum of the digits 1 of each array T(i,j), where
a(1) = sum of the digits "1" of T(i,j), i = 1..2^1 and j = 1;
a(2) = sum of the digits "1" of T(i,j), i = 1..2^2 and j = 1..2;
a(3) = sum of the digits "1" of T(i,j), i = 1..2^3 and j = 1..3;
a(n) = Sum_{i=1..2^n}(Sum_{j=1..n} T(i,j)) = Sum_{i=1..n} A001045(n)*2^(n-i) = convolution of A001045 and A000079 (see the formula below).
The number of digits "0" equals A113861(n) = n*2^n - a(n) because n and 2^n are the dimensions of each array.
An important result is that the ratio r = A113861(n) / A045883(n) tends towards 2 when n tends towards infinity. In other words, when the array tends towards infinity, the ratio r = (number of divisions by 2) / (number of multiplications by 3) tends towards 2, even if there exists divergent trajectories. That is the problem! For each possible divergent infinite trajectory, r < 2 even though the global ratio r is 2.
Conclusion:
1. For each number n with a convergent trajectory T(n,k), k = 1..infinity, or for each row of the array T(i,j), the ratio r tends towards 2 (the proof is easy because the trajectory becomes periodic from a certain index 1001001001...).
2. For each array of dimension n X 2^n, the radio r tends towards 2.
3. If there exists a number n such that the trajectory is divergent, this trajectory is random and r tends towards a real x such that 1 < = r < = x < 2.
4. In order to establish a proof of the Collatz problem from this considerations (if that is possible), it is necessary to prove that a ratio < 2 for an infinite row (or several rows) of an infinite array T(i,j) is incompatible with r = 2, the exact ratio for this array. (End)
a(n) is the distance spectral radius of the dimension-regular generalized recursive circulant graph (commonly known as multiplicative circulant graph) of order 2^n. - John Rafael M. Antalan, Sep 25 2020
Total sum over all compositions of n of the absolute differences between consecutive parts, assuming an initial part 0. - Alois P. Heinz, Apr 30 2025

Crossrefs

Partial sums of A059570, bisection: A014916.
Row sums of triangle A094953.

Programs

  • Magma
    [((3*n+1)*2^n-(-1)^n)/9: n in [0..35]]; // Vincenzo Librandi, Jun 15 2017
  • Maple
    A045883:=n->((3*n+1)*2^n-(-1)^n)/9; seq(A045883(n), n=0..30); # Wesley Ivan Hurt, Mar 21 2014
  • Mathematica
    nn=31;a=x^2(1-x)/(1-x-2x^2)/(1-2x);b=x^2/(1-2x)^2;Drop[CoefficientList[Series[(b-a)/2,{x,0,nn}],x],2] (* Geoffrey Critzer, Mar 21 2014 *)
    CoefficientList[Series[x / ((1 + x) (1 - 2 x)^2), {x, 0, 33}], x] (* Vincenzo Librandi, Jun 15 2017 *)
    LinearRecurrence[{3, 0, -4}, {0, 1, 3}, 33] (* Jean-François Alcover, Sep 27 2017 *)
  • PARI
    {a(n) = if( n<-1, 0, ((3*n + 1)*2^n - (-1)^n) / 9)};
    

Formula

G.f.: x/((1+x)*(1-2*x)^2).
a(n) = 3*a(n-1) - 4*a(n-3).
Convolution of A001045 and A000079. G.f.: x/((1-2*x)(1-x-2*x^2)). - Paul Barry, May 21 2004
Starting with "1" = triangle A049260 * the odd integers as a vector. - Gary W. Adamson, Mar 06 2012
a(n) = A140960(n)/2. - J. M. Bergot, May 21 2013
From Wolfdieter Lang, Jun 14 2017: (Start)
a(n) = f(n)*2^n, where f(n) is a rational Fibonacci type sequence based on fuse(a,b) = (a+b+1)/2 with f(0) = 0, f(1) = 1/2 and f(n) = fuse(f(n-1), f(n-2)), for n >= 2. For fuse(a,b) see the Jeff Erickson link under A188545. Proof with f(n) = (3*n+1 - (-1)^n/2^n)/9, n >= 0, by induction.
a(n) = a(n-1) + 2*a(n-2) + 2^(n-1), n >= 0, with input a(-2) = 1/4 and a(-1) = 0. See also A127984. (End)
E.g.f.: (exp(2*x)*(1 + 6*x) - cosh(x) + sinh(x))/9. - Stefano Spezia, Apr 09 2025
a(n) = Sum_{k=0..n+2} k * A238343(n+2,k). - Alois P. Heinz, Apr 30 2025

Extensions

Simpler description from Vladeta Jovovic, Jul 18 2002

A241701 Number T(n,k) of Carlitz compositions of n with exactly k descents; triangle T(n,k), n>=0, 0<=k<=floor(n/3), read by rows.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 3, 4, 4, 8, 2, 5, 13, 5, 6, 21, 12, 8, 33, 27, 3, 10, 50, 53, 11, 12, 73, 98, 31, 15, 106, 174, 78, 5, 18, 150, 296, 175, 22, 22, 209, 486, 363, 72, 27, 289, 781, 715, 204, 8, 32, 393, 1222, 1342, 510, 43, 38, 529, 1874, 2421, 1168, 159
Offset: 0

Views

Author

Alois P. Heinz, Apr 27 2014

Keywords

Comments

No two adjacent parts of a Carlitz composition are equal.

Examples

			T(6,0) = 4: [6], [1,5], [2,4], [1,2,3].
T(6,1) = 8: [4,2], [5,1], [3,1,2], [1,3,2], [1,4,1], [2,3,1], [2,1,3], [1,2,1,2].
T(6,2) = 2: [3,2,1], [2,1,2,1].
T(7,0) = 5: [7], [3,4], [1,6], [2,5], [1,2,4].
T(7,1) = 13: [4,3], [6,1], [5,2], [2,1,4], [4,1,2], [1,4,2], [2,3,2], [3,1,3], [1,5,1], [2,4,1], [1,2,3,1], [1,3,1,2], [1,2,1,3].
T(7,2) = 5: [4,2,1], [2,1,3,1], [3,1,2,1], [1,3,2,1], [1,2,1,2,1].
Triangle T(n,k) begins:
00:   1;
01:   1;
02:   1;
03:   2,   1;
04:   2,   2;
05:   3,   4;
06:   4,   8,   2;
07:   5,  13,   5;
08:   6,  21,  12;
09:   8,  33,  27,   3;
10:  10,  50,  53,  11;
11:  12,  73,  98,  31;
12:  15, 106, 174,  78,   5;
13:  18, 150, 296, 175,  22;
14:  22, 209, 486, 363,  72;
15:  27, 289, 781, 715, 204, 8;
		

Crossrefs

Row sums give A003242.
T(3n,n) = A000045(n+1).
T(3n+1,n) = A129715(n) for n>0.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, expand(
          add(`if`(j=i, 0, b(n-j, j)*`if`(j (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0)):
    seq(T(n), n=0..20);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, Expand[Sum[If[j == i, 0, b[n-j, j]*If[jJean-François Alcover, Feb 13 2015, after Alois P. Heinz *)

Formula

Sum_{k=0..floor(n/3)} (k+1) * T(n,k) = A285994(n) (for n>0).

A136376 a(n) = n*F(n) + (n-1)*F(n-1).

Original entry on oeis.org

1, 3, 8, 18, 37, 73, 139, 259, 474, 856, 1529, 2707, 4757, 8307, 14428, 24942, 42941, 73661, 125951, 214739, 365166, 619508, 1048753, 1771943, 2988457, 5031843, 8459504, 14201994, 23811349, 39873841, 66695539, 111440227, 186016962
Offset: 1

Views

Author

Gary W. Adamson, Dec 28 2007

Keywords

Comments

For n>2, mod 2 = (0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, ...), i.e., two evens followed by four odds (repeating).
Inverse binomial transform of A117202: (1, 4, 15, 52, ...). - Gary W. Adamson, Sep 03 2008

Examples

			a(5) = 37 = a(n)*F(n) + (n-1)*F(n-1) = 5*5 + 4*3 = 25 + 12.
		

Crossrefs

Programs

  • Mathematica
    Table[n*Fibonacci[n] + (n - 1)*Fibonacci[n - 1], {n, 1, 50}] (* Stefan Steinerberger, Dec 28 2007 *)
  • PARI
    a(n)=n*fibonacci(n)+(n-1)*fibonacci(n-1) \\ Charles R Greathouse IV, Oct 07 2015
    
  • PARI
    Vec(x*(1+x)*(1+x^2)/(x^2+x-1)^2 + O(x^100)) \\ Altug Alkan, Oct 28 2015

Formula

a(n) = n*F(n) + (n-1)*F(n-1). Equals the matrix product A128064 (unsigned) * A000045.
From R. J. Mathar, Jul 13 2009: (Start)
a(n) = A045925(n) + A045925(n-1).
a(n) = 2*a(n-1) + a(n-2) - 2*a(n-3) - a(n-4).
G.f.: x*(1+x)*(1+x^2)/(x^2+x-1)^2. (End)
a(n) = A238344(3n-2,n-1). - Alois P. Heinz, Apr 11 2014
From Vladimir Reshetnikov, Oct 28 2015: (Start)
a(n) = ((n+1)*F(n)+(n-1)*L(n))/2, where L(n) are Lucas numbers (A000032).
E.g.f.: (exp(phi*x)*(phi^3*x-1)-exp(-x/phi)*(phi^3+x)/phi)/(sqrt(5)*phi)+1, where phi=(1+sqrt(5))/2.
(End)

Extensions

More terms from Stefan Steinerberger, Dec 28 2007

A241627 Number of compositions of n with exactly two descents.

Original entry on oeis.org

2, 8, 29, 81, 205, 469, 1013, 2059, 4021, 7558, 13780, 24440, 42358, 71867, 119715, 196084, 316362, 503410, 791043, 1228636, 1888003, 2872541, 4330299, 6471778, 9594556, 14116745, 20622825, 29925512, 43149302, 61843197, 88130983, 124912824, 176132457
Offset: 6

Views

Author

Joerg Arndt and Alois P. Heinz, Apr 26 2014

Keywords

Examples

			a(6) = 2: [3,2,1], [2,1,2,1].
a(7) = 8: [4,2,1], [3,2,1,1], [3,1,2,1], [1,3,2,1], [2,1,3,1], [1,2,1,2,1], [2,1,1,2,1], [2,1,2,1,1].
		

Crossrefs

Column k=2 of A238343 and of A238344.

Programs

  • Maple
    b:= proc(n, i) option remember;
          `if`(n=0, 1, convert(series(add(b(n-j, j)*
          `if`(j coeff(b(n, 0), x, 2):
    seq(a(n), n=6..50);
  • Mathematica
    k = 2;
    b[n_, i_] := b[n, i] =  If[n == 0, 1, Sum[b[n - j, j]*
         If[j < i, x, 1], {j, n}] + O[x]^(k+1)];
    a[n_] := SeriesCoefficient[b[n, 0], {x, 0, k}];
    a /@ Range[6, 50] (* Jean-François Alcover, Aug 27 2021, after Maple code *)

A241626 Number of compositions of n with exactly one descent.

Original entry on oeis.org

1, 3, 9, 19, 41, 77, 142, 247, 421, 689, 1113, 1750, 2712, 4128, 6208, 9201, 13502, 19585, 28158, 40109, 56689, 79486, 110703, 153129, 210536, 287752, 391172, 528961, 711837, 953429, 1271421, 1688293, 2232899, 2941798, 3861621, 5051174, 6584958, 8556655
Offset: 3

Views

Author

Joerg Arndt and Alois P. Heinz, Apr 26 2014

Keywords

Examples

			a(3) = 1: [2,1].
a(4) = 3: [3,1], [1,2,1], [2,1,1].
a(5) = 9: [3,2], [4,1], [2,1,2], [3,1,1], [1,3,1], [2,2,1], [2,1,1,1], [1,1,2,1], [1,2,1,1].
		

Crossrefs

Column k=1 of A238343 and of A238344.

Programs

  • Maple
    b:= proc(n, i) option remember;
          `if`(n=0, 1, convert(series(add(b(n-j, j)*
          `if`(j coeff(b(n, 0), x, 1):
    seq(a(n), n=3..50);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, Normal[Series[Sum[b[n - j, j]* If[j < i, x, 1], {j, 1, n}], {x, 0, 2}]]]; a[n_] := Coefficient[b[n, 0], x, 1]; Table[a[n], {n, 3, 50}] (* Jean-François Alcover, Feb 06 2015, after Maple *)

A241628 Number of compositions of n with exactly three descents.

Original entry on oeis.org

3, 18, 78, 264, 786, 2097, 5179, 11998, 26400, 55593, 112814, 221639, 423318, 788518, 1436302, 2564135, 4494967, 7750068, 13160903, 22039386, 36434095, 59514365, 96139570, 153699716, 243345157, 381779187, 593848668, 916277405, 1403004758, 2132797015
Offset: 9

Views

Author

Joerg Arndt and Alois P. Heinz, Apr 26 2014

Keywords

Examples

			a(9) = 3: [2,1,3,2,1], [3,2,1,2,1], [2,1,2,1,2,1].
		

Crossrefs

Column k=3 of A238343 and of A238344.

Programs

  • Maple
    b:= proc(n, i) option remember;
          `if`(n=0, 1, convert(series(add(b(n-j, j)*
          `if`(j coeff(b(n, 0), x, 3):
    seq(a(n), n=9..50);
  • Mathematica
    k = 3;
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j]*
         If[j < i, x, 1], {j, n}] + O[x]^(k + 1)];
    a[n_] := SeriesCoefficient[b[n, 0], {x, 0, k}];
    a /@ Range[9, 50] (* Jean-François Alcover, Aug 27 2021, after Maple code *)

A241629 Number of compositions of n with exactly four descents.

Original entry on oeis.org

5, 37, 189, 751, 2558, 7762, 21577, 55867, 136478, 317416, 707817, 1521755, 3168262, 6410970, 12646075, 24378923, 46028497, 85269218, 155238256, 278130152, 490983234, 854910432, 1469679627, 2496560526, 4193815403, 6971437570, 11474937414, 18712755604
Offset: 12

Views

Author

Joerg Arndt and Alois P. Heinz, Apr 26 2014

Keywords

Examples

			a(12) = 5: [3,2,1,3,2,1], [2,1,2,1,3,2,1], [2,1,3,2,1,2,1], [3,2,1,2,1,2,1], [2,1,2,1,2,1,2,1].
		

Crossrefs

Column k=4 of A238343 and of A238344.

Programs

  • Maple
    b:= proc(n, i) option remember;
          `if`(n=0, 1, convert(series(add(b(n-j, j)*
          `if`(j coeff(b(n, 0), x, 4):
    seq(a(n), n=12..50);
  • Mathematica
    k = 4;
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j]*
         If[j < i, x, 1], {j, n}] + O[x]^(k + 1)];
    a[n_] := SeriesCoefficient[b[n, 0], {x, 0, k}];
    a /@ Range[12, 50] (* Jean-François Alcover, Aug 27 2021, after Maple code *)

A241630 Number of compositions of n with exactly five descents.

Original entry on oeis.org

8, 73, 429, 1945, 7465, 25317, 78068, 222963, 597644, 1518370, 3683950, 8586866, 19320391, 42127208, 89307361, 184578961, 372786467, 737212357, 1429992711, 2724852920, 5107392644, 9427895421, 17157142969, 30810379849, 54643242181, 95783964110, 166059755226
Offset: 15

Views

Author

Joerg Arndt and Alois P. Heinz, Apr 26 2014

Keywords

Examples

			a(15) = 8: [3,2,1,2,1,3,2,1], [3,2,1,3,2,1,2,1], [2,1,3,2,1,3,2,1], [2,1,2,1,3,2,1,2,1], [2,1,3,2,1,2,1,2,1], [3,2,1,2,1,2,1,2,1], [2,1,2,1,2,1,3,2,1], [2,1,2,1,2,1,2,1,2,1].
		

Crossrefs

Column k=5 of A238343 and of A238344.

Programs

  • Maple
    b:= proc(n, i) option remember;
          `if`(n=0, 1, convert(series(add(b(n-j, j)*
          `if`(j coeff(b(n, 0), x, 5):
    seq(a(n), n=15..50);
  • Mathematica
    k = 5;
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - j, j]*
         If[j < i, x, 1], {j, n}] + O[x]^(k + 1)];
    a[n_] := SeriesCoefficient[b[n, 0], {x, 0, k}];
    a /@ Range[15, 50] (* Jean-François Alcover, Aug 27 2021, after Maple code *)

A241631 Number of compositions of n with exactly six descents.

Original entry on oeis.org

13, 139, 927, 4719, 20122, 75317, 254805, 794475, 2315005, 6369689, 16681342, 41842970, 101039601, 235855414, 534058830, 1176497139, 2527742988, 5308195367, 10915439320, 22015220687, 43612884462, 84970442998, 162994589899, 308155639555, 574716486444
Offset: 18

Views

Author

Joerg Arndt and Alois P. Heinz, Apr 26 2014

Keywords

Examples

			a(18) = 13: [3,2,1,3,2,1,3,2,1], [2,1,3,2,1,3,2,1,2,1], [2,1,2,1,3,2,1,3,2,1], [3,2,1,3,2,1,2,1,2,1], [2,1,3,2,1,2,1,3,2,1], [3,2,1,2,1,2,1,3,2,1], [3,2,1,2,1,3,2,1,2,1], [2,1,2,1,2,1,3,2,1,2,1], [2,1,2,1,3,2,1,2,1,2,1], [2,1,3,2,1,2,1,2,1,2,1], [2,1,2,1,2,1,2,1,3,2,1], [3,2,1,2,1,2,1,2,1,2,1], [2,1,2,1,2,1,2,1,2,1,2,1].
		

Crossrefs

Column k=6 of A238343 and of A238344.

Programs

  • Maple
    b:= proc(n, i) option remember;
          `if`(n=0, 1, convert(series(add(b(n-j, j)*
          `if`(j coeff(b(n, 0), x, 6):
    seq(a(n), n=18..50);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n-j, j]*
       If[j < i, x, 1], {j, 1, n}] // Expand];
    a[n_] := Coefficient[b[n, 0], x, 6];
    Table[a[n], {n, 18, 50}] (* Jean-François Alcover, Nov 28 2023, from Maple code *)
Showing 1-10 of 14 results. Next