OFFSET
1,2
LINKS
Paul D. Hanna, Table of n, a(n) for n = 1..200
FORMULA
a(n)=T(n,1), T(n,m)=1/3*(binomial(m,n-m)*9^(n-m)-sum(k=m+1..n-1, T(k,m)*sum(i=k..n, T(n,i)*T(i,k)))-sum(i=m+1..n-1, T(n,i)*T(i,m))), n>m, T(n,n)=1. - Vladimir Kruchinin, Mar 10 2012
EXAMPLE
G.f.: A(x) = x + 3*x^2 - 18*x^3 + 189*x^4 - 2430*x^5 + 34020*x^6 -+ ...
A(A(x)) = x + 6*x^2 - 18*x^3 + 135*x^4 - 1296*x^5 + 13122*x^6 -+ ...
PROG
(PARI) {a(n, m=3)=local(F=x+m*x^2+x*O(x^n), G); if(n<1, 0, for(k=3, n, G=F+x*O(x^k); for(i=1, m-1, G=subst(F, x, G)); F=F+((-polcoeff(G, k))/m)*x^k); return(polcoeff(F, n, x)))}
(Maxima)
T(n, m):=if n=m then 1 else 1/3*(binomial(m, n-m)*9^(n-m)-sum(T(k, m)*sum(T(n, i)*T(i, k), i, k, n), k, m+1, n-1)-sum(T(n, i)*T(i, m), i, m+1, n-1));
makelist((T(n, 1)), n, 1, 7); /* Vladimir Kruchinin, Mar 10 2012 */
(PARI) /* Using Vladimir Kruchinin's formula */
{T(n, k)=if(n==k, 1, if(n>k, 1/3*(binomial(k, n-k)*9^(n-k) - sum(j=k+1, n-1, T(j, k)*sum(i=j, n, T(n, i)*T(i, j)))-sum(i=k+1, n-1, T(n, i)*T(i, k)))))}
{a(n)=T(n, 1)} /* Efficiency can be improved if T(n, k) is stored in an array */
for(n=1, 20, print1(a(n), ", ")) \\ Paul D. Hanna
CROSSREFS
KEYWORD
sign
AUTHOR
Paul D. Hanna, Jun 05 2008
STATUS
approved