Let $a_n$ be the number of mappings $f : [n] \rightarrow [n]$ such that if $f$ takes on a value $i$,then it takes on all the values $j: 1\le j\le i$. Find a closed form(i.e. a form that can be evaluated in a finite number of operations) of the generating function of $a_n$.
For a mapping that satisfies the above condition, its image $f([n])$ must be one of ${[1],[2],\dots,[n]}$.
#surjections from $[n]$ to $[k]$ = $k!S(n,k)$, where $S(n,k)$ stands for Stirling number of the second kind.
Thus the generating function
$$A(x)=\sum_{n=0}^{\infty}x^n\sum_{k=1}^n k!S(n,k)=\sum_{k=0}^\infty k! \sum_{n=k}^\infty x^n S(n,k)$$
And we already know the generating function of S(n,k) has a closed form:
$$\sum_{n=k}^\infty x^n S(n,k)=\frac{x^k}{(1-x)(1-2x)\dots(1-kx)}$$
But how do I obtain a closed form of the generating function of $a_n$ using the above equations?
Proceeding along your line.....
The # required mappings f that takes n =n!.
The # required mappings f that doesn't take n at all=(n-1) $a_{n-1} $.
(Reason:
Now for no i in [n], f(i)=n. So f(n) has to take one of the values in the set [n-1]. Now each mapping $[n-1] \rightarrow [n-1]$ can be extended to [n] by giving a value for f(n) in [n-1]. Thus given a map [n-1] $\rightarrow$ [n-1] satisfying the given conditions, it can be extended to [n] in n-1 ways. And #mappings f:[n-1]$\rightarrow$ [n-1] satisfying the given conditions = $a_{n-1} $.
So #mappings f that doesn't take n at all= (n-1)$a_{n-1} $.) Hope it helps!?