A161898 Incorrect version of A159772.
1, 2, 5, 14, 41, 124, 384, 1211, 3871, 12503, 40721, 133539, 440483
Offset: 0
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.
The Catalan number C_6=132 counts the parenthesizations of x_1*...*x_7 where * is arbitrary. Defining * and w as above and writing x_i compactly as xi, we have x1*(x2*(x3*(x4*(x5*(x6*(x7)))))) = x1+wx2+w^2x3+w^3x4+w^4x5+x6+wx7 = x1*(x2*(x3*(x4*(x5*(x6)))))*(x7). For n=6 and k=5, these are the only parenthesizations that give the same value for x1*...*x7, so C_{6,5}=132-1=131.
terms = 30; col[k_] := Module[{G}, G = InverseSeries[x*(1 - x)/(1 - x^k) + O[x]^terms, x]; CoefficientList[1/(1 - G), x]]; col[5] (* Jean-François Alcover, Dec 05 2017, after Andrew Howroyd *)
Vec(1/(1-serreverse(x*(1-x)/(1-x^5) + O(x*x^25)))) \\ Andrew Howroyd, Dec 04 2017
def C(k): print(1) for n in range(1,51): f = ((1-x^k)/(1-x))^n # ((x+1)^2-x^2*(x/(x+1))^(k-2))^n f = f.simplify_full() C = 0 for i in range(n): C = C + (n-i)*f.coefficient(x,i)/n print(C) time C(5)
The Catalan number C_7=429 counts the parenthesizations of x_1*...*x_8 where * is arbitrary. Defining * and w as above and writing x_i compactly as xi, we have x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8))))))) = x1+wx2+w^2x3+w^3x4+w^4x5+w^5x6+x7+wx8 = x1*(x2*(x3*(x4*(x5*(x6*(x7))))))*(x8). For n=7 and k=6, these are the only parenthesizations that give the same value for x1*...*x8, so C_{7,6}=429-1=428.
terms = 30; col[k_] := Module[{G}, G = InverseSeries[x*(1 - x)/(1 - x^k) + O[x]^terms, x]; CoefficientList[1/(1 - G), x]]; col[6] (* Jean-François Alcover, Dec 05 2017, after Andrew Howroyd *)
Vec(1/(1-serreverse(x*(1-x)/(1-x^6) + O(x*x^25)))) \\ Andrew Howroyd, Dec 04 2017
def C(k): print(1) for n in range(1,51): f = ((1-x^k)/(1-x))^n # ((x+1)^2-x^2*(x/(x+1))^(k-2))^n f = f.simplify_full() C = 0 for i in range(n): C = C + (n-i)*f.coefficient(x,i)/n print(C) time C(6)
The Catalan number C_8=1430 counts the parenthesizations of x_1*...*x_9 where * is arbitrary. Defining * and w as above and writing x_i compactly as xi, we have x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8*(x9)))))))) = x1+wx2+w^2x3+w^3x4+w^4x5+w^5x6+w^6x7+x8+wx9 = x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8)))))))*(x9). For n=8 and k=7, these are the only parenthesizations that give the same value for x1*...*x9, so C_{8,7}=1430-1=1429.
terms = 30; col[k_] := Module[{G}, G = InverseSeries[x*(1 - x)/(1 - x^k) + O[x]^terms, x]; CoefficientList[1/(1 - G), x]]; col[7] (* Jean-François Alcover, Dec 05 2017, after Andrew Howroyd *)
Vec(1/(1-serreverse(x*(1-x)/(1-x^7) + O(x*x^25)))) \\ Andrew Howroyd, Dec 04 2017
def C(k): print(1) for n in range(1,51): f = ((1-x^k)/(1-x))^n # ((x+1)^2-x^2*(x/(x+1))^(k-2))^n f = f.simplify_full() C = 0 for i in range(n): C = C + (n-i)*f.coefficient(x,i)/n print(C) time C(7)
The Catalan number C_9=4862 counts the parenthesizations of x_1*...*x_10 where * is arbitrary. Defining * and w as above and writing x_i compactly as xi, we have x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8*(x9*(x10))))))))) = x1+wx2+w^2x3+w^3x4+w^4x5+w^5x6+w^6x7+w^7x8+x9+wx10 = x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8*(x9))))))))*(x10). For n=9 and k=8, these are the only parenthesizations that give the same value for x1*...*x10, so C_{9,8}=4862-1=4861.
terms = 30; col[k_] := Module[{G}, G = InverseSeries[x*(1 - x)/(1 - x^k) + O[x]^terms, x]; CoefficientList[1/(1 - G), x]]; col[8] (* Jean-François Alcover, Dec 05 2017, after Andrew Howroyd *)
Vec(1/(1-serreverse(x*(1-x)/(1-x^8) + O(x*x^25)))) \\ Andrew Howroyd, Dec 04 2017
def C(k): print(1) for n in range(1,51): f = ((1-x^k)/(1-x))^n # ((x+1)^2-x^2*(x/(x+1))^(k-2))^n f = f.simplify_full() C = 0 for i in range(n): C = C + (n-i)*f.coefficient(x,i)/n print(C) time C(8)
The Catalan number C_10=16796 counts the parenthesizations of x_1*...*x_11 where * is arbitrary. Defining * and w as above and writing x_i compactly as xi, we have x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8*(x9*(x10*(x11)))))))))) = x1+wx2+w^2x3+w^3x4+w^4x5+w^5x6+w^6x7+w^7x8+w^8x9+x10+wx11 = x1*(x2*(x3*(x4*(x5*(x6*(x7*(x8*(x9*(x10)))))))))*(x11). For n=10 and k=9, these are the only parenthesizations that give the same value for x1*...*x11, so C_{10,9}=16796-1=16795.
terms = 30; col[k_] := Module[{G}, G = InverseSeries[x*(1 - x)/(1 - x^k) + O[x]^terms, x]; CoefficientList[1/(1 - G), x]]; col[9] (* Jean-François Alcover, Dec 05 2017, after Andrew Howroyd *)
Vec(1/(1-serreverse(x*(1-x)/(1-x^9) + O(x*x^25)))) \\ Andrew Howroyd, Nov 29 2017
def C(k): print(1) for n in range(1,51): f = ((1-x^k)/(1-x))^n # ((x+1)^2-x^2*(x/(x+1))^(k-2))^n f = f.simplify_full() C = 0 for i in range(n): C = C + (n-i)*f.coefficient(x,i)/n print(C) time C(9)
Triangle begins: 1; 1, 1; 1, 2, 2; 1, 3, 5, 5; 1, 4, 9, 14, 13; 1, 5, 14, 28, 40, 36; ...
a[n_, k_] /; 0 <= k <= n = a[n, k] = a[n - 1, k] + a[n - 1, k - 1] + a[n - 1, k - 2] + a[n - 1, k - 3]; a[0, 0] = 1; a[, ] = 0; Table[a[n, k], {n, 0, 10}, {k, 0, n}] // Flatten (* Jean-François Alcover, Jul 30 2018 *)
# uses[riordan_array from A256893] M = riordan_array(1, x/(1+x+x^2+x^3), 12).inverse() for m in M[1:]: print([r for r in reversed(list(m)) if r != 0]) # Peter Luschny, Aug 17 2016
Representatives of the a(6) = 7 equivalence classes of 6-leaf binary trees are given in A036766, A159768, A159769, A159770, A159771, A159772, and A159773.
Comments
Examples
Links
Crossrefs
Programs
Maple
Mathematica
PARI
Formula