TITLE: How to show $\sum_{k=1}^n \binom{n-1}{k-1} n^{n-k} k! = n^n$
QUESTION [5 upvotes]: To me it appears that lhs is some fancy way to count all functions from $[n]$ to $[n]$. I tried several approaches, including interpreting $\binom{n-1}{k-1}$ as number of solutions for $n=x_1+\dots +x_k$ where $\forall_i x_i \ge 1$. But it didn't lend me to anything significant.
I'd appreciate some hints or solutions to this.

REPLY [5 votes]: Using the recurrence for Pascal's Triangle and a telescoping sum,
$$
\begin{align}
\sum_{k=1}^n\binom{n-1}{k-1}\frac{k!}{n^k}
&=\sum_{k=1}^n\left[\binom{n}{k}-\binom{n-1}{k}\right]\frac{k!}{n^k}\\
&=\sum_{k=1}^n\binom{n-1}{k-1}\frac{(k-1)!}{n^{k-1}}-\sum_{k=1}^n\binom{n-1}{k}\frac{k!}{n^k}\\
&=\sum_{k=0}^{n-1}\binom{n-1}{k}\frac{k!}{n^k}-\sum_{k=1}^n\binom{n-1}{k}\frac{k!}{n^k}\\[6pt]
&=1-0\tag{1}
\end{align}
$$
Multiply $(1)$ by $n^n$ and we get
$$
\sum_{k=1}^n\binom{n-1}{k-1}n^{n-k}k!=n^n\tag{2}
$$