OFFSET
1,2
COMMENTS
FORMULA
a(n) = [x^n] x*((1-n+n^2) - n^2*(n+1)*x - n*(1-(n+2)*x)*C(x) )/(1-n+n^2*x)^2, where C(x) = (1-sqrt(1-4*x))/(2*x) is the Catalan function (A000108).
a(n) = n^(n-1) - Sum_{k=2..n-2} n^(k-1)*k*(k-1)*(n-k-1)*(2*n-k-2)!/(n-k)!/n!
EXAMPLE
Successive iterations of F(x), the g.f. of A120009, begin:
F(x) = (1)x + x^2 + x^3 - 6x^5 - 33x^6 - 143x^7 - 572x^8 - 2210x^9 +...
F(F(x)) = x + (2)x^2 + 4x^3 + 6x^4 - 4x^5 - 100x^6 - 664x^7 +...
F(F(F(x))) = x + 3x^2 + (9)x^3 + 24x^4 + 42x^5 - 87x^6 - 1575x^7 +...
F(F(F(F(x)))) = x + 4x^2 + 16x^3 + (60)x^4 + 192x^5 + 360x^6 +...
F(F(F(F(F(x))))) = x + 5x^2 + 25x^3 + 120x^4 + (530)x^5 +1955x^6 +...
F(F(F(F(F(F(x)))))) = x + 6x^2 + 36x^3 +210x^4 +1164x^5 + (5892)x^6 +...
PROG
(PARI) a(n)=local(k=n, x=X+X^3*O(X^n)); polcoeff( x*((1-k+k^2)-k^2*(k+1)*x-k*(1-(k+2)*x)*(1-sqrt(1-4*x))/2/x)/(1-k+k^2*x)^2, n, X)
(PARI) /* Generated as the n-th self-composition of A120009: */ a(n)=local(F=((1-3*x)*sqrt(1-4*x+x^3*O(x^n)) - (1-x)*(1-4*x))/(2*x^2), G=x+x*O(x^n)); if(n<1, 0, for(i=1, n, G=subst(F, x, G)); return(polcoeff(G, n, x)))
(PARI) a(n)=n^(n-1)-sum(k=2, n-2, n^(k-1)*k*(k-1)*(n-k-1)*(2*n-k-2)!/(n-k)!)/n!
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul D. Hanna, Jun 07 2006, Jun 09 2006
STATUS
approved