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.

A181365 Triangle read by rows: T(n,k) is the number of 2-compositions of n having least entry equal to k (n >= 1; 0 <= k <= floor(n/2)).

Original entry on oeis.org

2, 6, 1, 22, 2, 78, 3, 1, 272, 6, 2, 940, 13, 2, 1, 3232, 28, 2, 2, 11080, 58, 3, 2, 1, 37920, 118, 6, 2, 2, 129648, 239, 12, 2, 2, 1, 443008, 484, 22, 2, 2, 2, 1513248, 979, 37, 3, 2, 2, 1, 5168000, 1976, 60, 6, 2, 2, 2, 17647552, 3980, 97, 12, 2, 2, 2, 1, 60258304, 8004
Offset: 1

Views

Author

Emeric Deutsch, Oct 15 2010

Keywords

Comments

A 2-composition of n is a nonnegative matrix with two rows, such that each column has at least one nonzero entry and whose entries sum up to n.
Row n contains 1 + floor(n/2) entries.

Examples

			T(4,1) = 3 because we have (1/3), (3/1), and (1,1/1,1) (the 2-compositions are written as (top row / bottom row)).
Triangle starts:
    2;
    6,  1;
   22,  2;
   78,  3, 1;
  272,  6, 2;
  940, 13, 2, 1;
		

Crossrefs

Programs

  • Maple
    h := proc (k) if k = 0 then (1-z)^2/(1-4*z+2*z^2) else (1-z)^2/(1-2*z+z^2-z^(2*k)) end if end proc: f := proc (k) options operator, arrow: h(k)-h(k+1) end proc; G := f(0)+sum(f(k)*t^k, k = 1 .. 30): Gser := simplify(series(G, z = 0, 20)): for n to 15 do P[n] := sort(coeff(Gser, z, n)) end do: for n to 15 do seq(coeff(P[n], t, k), k = 0 .. floor((1/2)*n)) end do; # yields sequence in triangular form
    # second Maple program:
    A:= proc(n, k) option remember; `if`(n=0, 1, add(add(
         `if`(i=0 and j=0, 0, A(n-i-j, k)), i=k..n-j), j=k..n))
        end:
    T:= (n, k)-> A(n, k) -A(n, k+1):
    seq(seq(T(n, k), k=0..n/2), n=1..15); # Alois P. Heinz, Mar 16 2014
  • Mathematica
    A[n_, k_] := A[n, k] = If[n == 0, 1, Sum[Sum[If[i == 0 && j == 0, 0, A[n-i-j, k]], {i, k, n-j}], {j, k, n}]]; T[n_, k_] := A[n, k] - A[n, k+1]; Table[Table[T[n, k], {k, 0, n/2}], {n, 1, 15}] // Flatten (* Jean-François Alcover, May 28 2015, after Alois P. Heinz *)

Formula

G.f. for 2-compositions with all entries >= k is h(k,z) = (1-z)^2/(1-2*z+z^2-z^(2*k)) if k>0 and h(0,z) = (1-z)^2/(1-4*z+2*z^2) if k=0.
G.f. for 2-compositions with least entry k is f(k,z) = h(k,z)-h(k+1,z) (these are the column g.f.'s).
G.f.: G(t,z) = f(0,z) + Sum_{k>=1} f(k,z)*t^k.
Sum_{k >= 0} T(n,k) = A003480(n).
T(n,1) = A181367(n).
Sum_{k >= 0} k*T(n,k) = A181366(n).