TITLE: Prove that $n! \equiv \sum_{k=0}^{n}(-1)^{k}\binom{n}{k}(n-k+r)^{n} $
QUESTION [16 upvotes]: Basically I had some fun doing this:
0
    1
1       6
    7       6
8       12
    19      6
27      18
    37      6
64      24
    61
125

etc.

starting with $k^n$ ($n=3$) and then calculating the differences.
It turns out that the result after n steps is always $n!$.
Pretty neat, heh? :)
Therefore:
$$
n! \equiv \sum_{k=0}^{n}(-1)^{k}\binom{n}{k}(n-k+r)^{n}
$$
where $n \in \mathbb{N}$ and $r \in \mathbb{Z}$
But how do I prove that?

REPLY [3 votes]: Since the question is tagged "combinatorics," here's a combinatorial proof. :)
Let $A_k$ be the set of all functions $f: \{1, 2, \ldots, n\} \mapsto \{1, 2, \ldots, n+r\}$ such that $f(i) = k$ for at least one $i$, where $1 \leq k \leq n$.  The identity counts the number of functions in $\cap_{k=1}^n A_k$ in two different ways.
First way: The set $\cap_{k=1}^n A_k$ is the set of onto functions from $\{1, 2, \ldots, n\}$ to itself.  Since an onto function from a finite set to itself must be one-to-one as well, the intersection of the $A_k$'s is the set of bijections on $\{1, 2, \ldots, n\}$.  There are $n$ choices for $f(1)$, followed by $n-1$ choices for $f(2)$ given $f(1)$, and so forth.  Thus: $$\text{There are $n!$ functions in } \bigcap_{k=1}^n A_k.$$
Second way: Now we want to use the principle of inclusion-exclusion.  The functions in the intersection of $\bar{A}_{i_1}, \bar{A}_{i_2}, \ldots, \bar{A}_{i_k}$ are those that map from $\{1, 2, \ldots, n\}$ to $\{1, 2, \ldots, n+r\} - \{i_1, i_2, \ldots i_k\}$.  There are $n-k+r$ elements in this latter set, and so there are $(n-k+r)^n$ functions in $\cap_{j=1}^k \bar{A}_{i_j}$.  In addition, there are $n^n$ total functions from $\{1, 2, \ldots, n\}$ to itself.  By inclusion, exclusion, then, we also have the following: $$\text{There are } \sum_{k=0}^n (-1)^k \binom{n}{k} (n-k+r)^n \text{ functions in } \bigcap_{k=1}^n A_k.$$