Cayley's formula states that the number of labeled trees on $n$ vertices is $n^{n-2}$. My question is: Is there a generalization of this formula for forests?


Let $f\_{n,k}$ denote the number of forests with $k$ connected components on $n$ vertices. For example, $f\_{n,1} = n^{n-2}$ by Cayley's formula and $f\_{n,n-1} = \binom{n}{2}$. Is there a known closed formula for $f\_{n,k}$? If not, is there an asymptotic formula?



Is there a formula for the number of labeled forests with $k$ components on $n$ vertices?
A formula as a single sum is 
$$f\_{n,k} = \binom nk \sum\_{i=0}^k \left(-\frac12\right)^i (k+i)\,i!\, \binom{k}{i}\binom{n-k}{i} n^{n-k-i-1}.$$
This formula can be found in J. W. Moon's *Counting Labelled Trees*, Theorem 4.1. He attributes it to A. Rényi, *Some remarks on the theory of trees*, Publications of the Mathematical Institute of the Hungarian Academy of Sciences 4 (1959), 73--85.


To prove it, let $T= \sum\_{n=1}^\infty n^{n-1} x^n/n!$ be the exponential generating function for rooted trees and let $U=\sum\_{n=1}^\infty n^{n-2} x^n/n!$ be the exponential generating function for unrooted trees. It is well known that 
$$T^k = k! \sum\_{n=k}^\infty \binom nk k n^{n-k-1}\frac{x^n}{n!}.\tag{$\*$}$$
Then $U = T-T^2/2$ so the exponential generating for forests of $k$ trees is 
$$\sum\_{n=k}^\infty f\_{n,k} \frac{x^n}{n!} = \frac{U^n}{n!}=\frac{(T-T^2/2)^k}{k!},$$
and the formula for $f\_{n,k}$ follows by expanding the right side by the binomial theorem and using $(\*)$.


