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-4 of 4 results.

A120981 Triangle read by rows: T(n,k) is the number of ternary trees with n edges and having k vertices of outdegree 1 (n >= 0, k >= 0).

Original entry on oeis.org

1, 0, 3, 3, 0, 9, 1, 27, 0, 27, 18, 12, 162, 0, 81, 15, 270, 90, 810, 0, 243, 138, 270, 2430, 540, 3645, 0, 729, 189, 2898, 2835, 17010, 2835, 15309, 0, 2187, 1218, 4536, 34776, 22680, 102060, 13608, 61236, 0, 6561, 2280, 32886, 61236, 312984, 153090, 551124
Offset: 0

Views

Author

Emeric Deutsch, Jul 21 2006

Keywords

Comments

A ternary tree is a rooted tree in which each vertex has at most three children and each child of a vertex is designated as its left or middle or right child.

Examples

			T(2,0)=3 because we have (Q,L,M), (Q,L,R) and (Q,M,R), where Q denotes the root and L (M,R) denotes a left (middle, right) child of Q.
Triangle starts:
   1;
   0,   3;
   3,   0,   9;
   1,  27,   0,  27;
  18,  12, 162,   0, 81;
  15, 270,  90, 810,  0, 243;
		

Crossrefs

Diagonals include A129530, A036216.

Programs

  • Maple
    T:=proc(n,k) if k<=n then (1/(n+1))*binomial(n+1,k)*sum(3^(3*j-n+2*k)*binomial(n+1-k,j)*binomial(j,n-k-2*j),j=0..n+1-k) else 0 fi end: for n from 0 to 10 do seq(T(n,k),k=0..n) od; # yields sequence in triangular form
  • Mathematica
    T[n_, k_] := (1/(n+1))*Binomial[n+1, k]*Sum[3^(2k - n + 3j)*Binomial[n + 1 - k, j]*Binomial[j, n - k - 2j], {j, 0, n - k + 1}];
    Table[T[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jul 02 2018 *)
  • PARI
    T(n,k) = binomial(n+1, k)*sum(j=0, n+1-k, 3^(2*k-n+3*j)*binomial(n+1-k, j)*binomial(j, n-k-2*j))/(n+1); \\ Andrew Howroyd, Nov 06 2017
    
  • Python
    from sympy import binomial
    def T(n, k): return binomial(n + 1, k)*sum([3**(2*k - n + 3*j)*binomial(n + 1 - k, j)*binomial(j, n - k - 2*j) for j in range(n + 2 - k)])//(n + 1)
    for n in range(21): print([T(n, k) for k in range(n + 1)]) # Indranil Ghosh, Nov 07 2017

Formula

T(n,0) = A120984(n).
Sum_{k>=1} k*T(n,k) = 3*binomial(3n,n-1) = 3*A004319(n).
T(n,k) = (1/(n+1))*binomial(n+1,k)*Sum_{j=0..n+1-k} 3^(2k-n+3j)*binomial(n+1-k,j)*binomial(j,n-k-2j).
G.f.: G=G(t,z) satisfies G = 1 + 3tzG + 3z^2*G^2 + z^3*G^3.

A120985 Number of ternary trees with n edges and having no vertices of degree 2. A ternary tree is a rooted tree in which each vertex has at most three children and each child of a vertex is designated as its left or middle or right child.

Original entry on oeis.org

1, 3, 9, 28, 93, 333, 1272, 5085, 20925, 87735, 372879, 1602450, 6953824, 30438138, 134255403, 596154495, 2662813341, 11955684591, 53927330037, 244250703252, 1110401393067, 5065143385647, 23176155530394, 106344639962973
Offset: 0

Views

Author

Emeric Deutsch, Jul 21 2006

Keywords

Comments

Column 0 of A120982.

Examples

			a(1)=3 because we have (Q,L), (Q,M) and (Q,R), where Q denotes the root and L (M,R) denotes a left (middle, right) child of Q.
		

Crossrefs

Cf. A120982.

Programs

  • Maple
    a:=n->sum(3^(n-3*j)*binomial(n+1,2*j+1)*binomial(n-2*j,j),j=0..n/2)/(n+1): seq(a(n),n=0..27);
  • Mathematica
    Table[1/(n+1)*Sum[3^(n-3*j)*Binomial[n+1,2*j+1]*Binomial[n-2*j,j],{j,0,n/2}],{n,0,20}] (* Vaclav Kotesovec, Oct 19 2012 *)

Formula

a(n) = (1/(n+1)) * Sum_{j..floor(n/3)} 3^(n-3*j) * binomial(n+1,2*j+1) * binomial(n-2*j,j).
G.f.=G(z) satisfies G=1+3zG + z^3*G^3.
Recurrence: 2*n*(2*n+3)*a(n) = 6*(6*n^2-1)*a(n-1) - 54*(n-1)*(2*n-1)*a(n-2) + 135*(n-2)*(n-1)*a(n-3). - Vaclav Kotesovec, Oct 19 2012
a(n) ~ (3+3/2^(2/3))^(n+3/2)/(2*sqrt(3*Pi)*n^(3/2)). - Vaclav Kotesovec, Oct 19 2012
a(n) = (1/(n+1)) * Sum_{k=0..floor(n/2)} (-3)^k * binomial(n+1,k) * binomial(3*n-3*k+3,n-2*k). - Seiichi Manyama, Mar 23 2024

A120429 Triangle read by rows: T(n,k) is the number of ternary trees with n edges and having k leaves (i.e., vertices of degree 0; n>=0, k>=1). A ternary tree is a rooted tree in which each vertex has at most three children and each child of a vertex is designated as its left or middle or right child.

Original entry on oeis.org

1, 3, 9, 3, 27, 27, 1, 81, 162, 30, 243, 810, 360, 15, 729, 3645, 2970, 405, 3, 2187, 15309, 19845, 5670, 252, 6561, 61236, 115668, 56700, 6426, 84, 19683, 236196, 612360, 459270, 98658, 4536, 12, 59049, 885735, 3018060, 3214890, 1122660
Offset: 0

Views

Author

Emeric Deutsch, Jul 21 2006

Keywords

Comments

Row n has n + 1 - ceiling(n/3) terms.
Row sums yield A001764.
T(n,1) = 3^n = A000244(n).
Sum_{k>=1} k*T(n,k) = binomial(3n,n) = A005809(n).

Examples

			T(2,2)=3 because we have (Q,L,M), (Q,L,R) and (Q,M,R), where Q denotes the root and L (M,R) denotes a left (middle, right) child of Q.
Triangle starts:
    1;
    3;
    9,   3;
   27,  27,   1;
   81, 162,  30;
  243, 810, 360,  15;
		

Crossrefs

Programs

  • Maple
    T:=proc(n,k) if k<=n+1-ceil(n/3) then (1/(n+1))*binomial(n+1,k)*sum(3^(n+j-2*k+2)*binomial(n+1-k,j)*binomial(j,k-1-j),j=0..n+1-k) else 0 fi end: 1; for n from 1 to 11 do seq(T(n,k),k=1..n+1-ceil(n/3)) od; # yields sequence in triangular form

Formula

T(n,k) = (1/(n+1))*binomial(n+1,k)*Sum_{j=0..n+1-k}3^(n-2k+j+2)*binomial(n+1-k,j)*binomial(j,k-1-j).
G.f. = G = G(t,z) satisfies G = (1+z(G-1+t))^3.

A120983 Triangle read by rows: T(n,k) is the number of ternary trees with n edges and having k vertices of outdegree 3 (n >= 0, k >= 0).

Original entry on oeis.org

1, 3, 12, 54, 1, 261, 12, 1323, 105, 6939, 810, 3, 37341, 5859, 63, 205011, 40824, 840, 1143801, 277830, 9072, 12, 6466230, 1861380, 86670, 360, 36960300, 12335895, 764478, 6435, 213243435, 81120204, 6377778, 89100, 55, 1240219269, 530408736
Offset: 0

Views

Author

Emeric Deutsch, Jul 21 2006

Keywords

Comments

A ternary tree is a rooted tree in which each vertex has at most three children and each child of a vertex is designated as its left or middle or right child.

Examples

			T(3,1)=1 because we have (Q,L,M,R), where Q denotes the root and L (M,R) denotes a left (middle, right) child of Q.
Triangle starts:
     1;
     3;
    12;
    54,   1;
   261,  12;
  1323, 105;
  6939, 810, 3;
		

Crossrefs

Programs

  • Maple
    T:=(n,k)->(1/(n+1))*binomial(n+1,k)*sum(3^j*binomial(n+1-k,j)*binomial(j,n-3*k-j),j=0..n+1-k): for n from 0 to 14 do seq(T(n,k),k=0..floor(n/3)) od; # yields sequence in triangular form

Formula

T(n,k) = (1/(n+1))*binomial(n+1,k)*Sum_{j=0..n+1-k} 3^j*binomial(n+1-k, j)*binomial(j, n-3k-j).
G.f.: G = G(t,z) satisfies G = 1 + 3zG + 3z^2*G^2 + tz^3*G^3.
Row n has 1+floor(n/3) terms.
Row sums yield A001764.
T(n,0) = A107264(n).
Sum_{k>=1} k*T(n,k) = binomial(3n, n-3) = A004321(n).
Showing 1-4 of 4 results.