How many labeled trees exist on n vertices with exactly 3 vertices of degree 1? My combinatorics class is covering spanning trees right now and one of the questions being asked is "What is the number of labeled trees on n vertices with exactly $3$ vertices of degree $1$?"
I've tried a couple different ways of doing this and none of them seem to work. I tried examining the degree sequence, looking at the Prüfer code as words from an $[n-3]$ length alphabet, but it seems fruitless. 
Any help would be greatly appreciated. Thanks!
Edit: I mis-read the problem, this was first posted with at least 3 vertices of degree 1, but the actual problem states exactly 3 vertices of degree 1.
 A: Here's a way to find the number.  It looks like it might not be the best (Sloane's A055315 has other formulas), but it works.
Let $n$ be the number of vertices and $e=n-1$ be the number of edges.
Claim: There is exactly one vertex of degree $3$, all others have degree $2$ or $1$.  (Assume otherwise, and we violate the Handshaking Lemma, which stipulates the sum of degrees is $2e=2(n-1)$.)
So, the trees look like this:

If we delete the degree-$3$ vertex, we obtain three components.  These three components only have vertices of degree $1$ and $2$, and so must be paths.  Suppose the paths have $a$, $b$ and $c$ vertices.  Then $a+b+c=n-1$ and $a,b,c$ are all positive integers.  Conversely, given three paths of lengths $a \geq 1$, $b \geq 1$ and $c \geq 1$ and $a+b+c=n-1$, we can join their endpoints to a new vertex to create an $n$-vertex tree with exactly three $3$ leaves.
Let $a(n)$ be the number of partitions of $n-1$ into $3$ non-zero parts; this is equivalent to Sloane's A001399 which includes the formula $$a(n)=1+\left\lfloor\frac{(n-1)^2+6(n-1)}{12}\right\rfloor$$ among others.
Given an unlabeled tree, we can label the vertices in $n!$ (not necessarily distinct) ways.  In this way, we generate $a(n)\ n!$ labeled trees.
In some cases (not many), there are symmetries which need to be accounted for.  Because of symmetry, in this case

we count every labeling twice.  This happens whenever $\{a,b,c\}$ have two parts of the same size.
And in this case

we count every labeling six times.  This happens when $\{a,b,c\}$ has all three parts of the same size.
In these cases, we'll need to add a correction.


*

*In the first case: we subtract $$\sum_{a \geq 1:n-1-a \text{ is even and } \geq 2} \tfrac{1}{2}n!=\frac{\lfloor (n-2)/2 \rfloor\ n!}{2}$$ since we have double-counted the $\frac{1}{2} n!$ graphs with $b=c=\tfrac{n-1-a}{2}$.

*In the second case: if $n-1 \equiv 0 \pmod 3$, we first "uncorrect" the first correction, so we add back in $\tfrac{1}{2}n!$ and then subtract $\frac{5}{6}n!$ since we originally counted six times the $\frac{1}{6} n!$ graphs with $a=b=c$.
This gives $$\begin{cases} a(n)\ n!-\tfrac{\lfloor (n-2)/2 \rfloor\ n!}{2} & \text{if } n-1 \not\equiv 0 \pmod 3 \\ a(n)\ n!-\tfrac{\lfloor (n-2)/2 \rfloor\ n!}{2}+\tfrac{1}{2}n!-\tfrac{1}{6} n! & \text{if } n-1 \equiv 0 \pmod 3. \end{cases}$$ in agreement with Sloane's A055315.
A: Here is a solution that is remarkably compact and uses exponential generating functions. First, the claim that the maximum vertex degree is three and there is only one vertex of degree three. Suppose there were a vertex of degree at least four. But there are four subtrees attached to that vertex, each contributing at least one leaf, giving at least four leaves, a contradiction. Now suppose there were at least two vertices of degree three. Pick two of them, connected by a path. That leaves two subtrees attached to each vertex and not on the path, again producing at least four leaves, a contradiction. This proves the claim, which was also done by Rebecca.
Second, introduce the combinatorial species $\mathcal{L}$ consisting of oriented chains. Then the combinatorial class $\mathcal{T}_3$ being counted in this problem is 
$$\def\textsc#1{\dosc#1\csod}
\def\dosc#1#2\csod{{\rm #1{\small #2}}}\mathcal{T}_3 =\mathcal{Z}\times\textsc{SET}_{=3}(\mathcal{L_{\ge 1}(\mathcal{Z})}).$$
Translating to generating functions and letting the generating function of $\mathcal{L}_{\ge 1}(\mathcal{Z})$ be $L(z)$ this gives the generating function $$T_3(z) = \frac{1}{3!} z L(z)^3.$$
But there are $k!$ oriented chains on $k$ nodes, giving $$L(z) = \sum_{k\ge 1} k! \frac{z^k}{k!} = \frac{z}{1-z}.$$
Therefore
$$ T_3(z) = \frac{1}{3!} z \left(\frac{z}{1-z}\right)^3.$$
Extracting coeffcients we obtain for $n\ge 4$, which is the count where this generating function starts, 
$$ n! [z^n] T_3(z) =
n! [z^n] \frac{1}{3!} z^4 \left(\frac{1}{1-z}\right)^3
= n! \frac{1}{3!} [z^{n-4}] \left(\frac{1}{1-z}\right)^3
\\= \frac{1}{6} n! [z^{n-4}] \sum_{k\ge 0} {k+2 \choose 2} z^k
= \frac{1}{6} n!  {n-2 \choose 2}.$$
A: I would recommend looking at the Prüfer code of the tree. You should know something special about degree one vertices and their involvement in the code!
A: Adding to Rebecca's answer: It is easier to consider the compositions of $n-1$ into three parts, which are the ordered partitions.  Think of them being (in order) the length of each horizontal line.  There are ${n-2 \choose 2}$ of these.  Each of them can be labeled in $n!$ ways.  Then (regardless of whether some lengths are the same) after the labeling, there are $6$ ways to show any given tree.  So the total number is $\frac 16n!{n-2 \choose 2}=\frac 1{12}(n-2)(n-3)n!$
A: In fact, the problem can be solved by Prufer code only. Consider first we choose $3$ nodes, they are not in Prufer code and there are $C(n,3)$ ways to choose. Then for last $n-3$ nodes, they must be in the code. It's easily to find that only one of them show 2 times and the other shows exactly one times. Then we can choose the position for the 2 times' number , there are $(n-3)C(n-2,2)$ ways, for the last $n-4$ numbers, we have $(n-4)!$ ways to arrange them.
As all above, we have $C(n,3)(n-3)C(n-2,2)(n-4)!$ such trees.
You can simplify the result, it is same to the other answers.
