Assigning values to permutations $N$ objects can be arranged in $N!$ different orders. For example, $10$ playing cards can be stacked $10! = 3,628,800$ different ways. Is there a way to assign a numerical value to each permutation so that every integer from $1$ to $N!$ corresponds to exactly one permutation? Is there a way to derive the permutation from the corresponding numerical value?
 A: I don't know if there is a standard way of doing this but you could do something like this:  
Lets take 4 playing cards b/c it is more managable.  Order them some way, say label them a,b,c,d and put them in the order (a,b,c,d).  Then 
$$1:(a,b,c,d)\\
2:(a,b,d,c)\\
3:(a,c,b,d)\\
4:(a,c,d,b)\\
5:(a,d,b,c)\\
6:(a,d,c,b)
$$
So fixing "a" as the first entry gives 6 possible permutations, repeating this for b,c,d in the first entry will give you the other 18, for a total of 24.  The method is to first fix an ordering and then permute only the last 2, then once thats done permute the last 3 and so on.
A: Yes.  The easiest way is to order them lexicographically.  So for $\{0,1,2,3,4\}$ there are $120$ permutations, from $01234$ to $43210$.  It is easiest if our permutation numbers run from $0$ to $119$.  Of these $4!=24$ have each number first, so if you want permuation $n$, the first number is $a_0=\lfloor \frac n{24} \rfloor$.  Then of those, there are $3!=6$ that have each of the remaining numbers first.  To find it, compute $a_1=\lfloor \frac {n-24a_0}6 \rfloor$, then increment by $1$ if $a_0 \le a_1$ because you want the $a_1$st of what is left.  Now recurse.
A: Notice that for one and the same letter kept, out of $n$, in one position, you have $(n-1)!$ possible choices. And that is all that you need.
$4231, n=4$
Before we reached $4$ we had $(4-1)(n-1)!$ permutations. With $4$ fixed we had $(2-1)(n-2)!$ options. With $42$ fixed we had $(3-1-1)(n-3)!$ options as $2$ is preceding $3$ and is to the left of it. With $423$ fixed we had $(1-1)(n-4)!$ options. It is $18$th permutation.
Formula is then:
$$P(a_1a_2...a_m)=\sum_{k=1}^{m}(\alpha_r(a_k)-1)(m-k)!$$
where $\alpha_r(a_k)$ is $1$-based alphabetical position of symbol $a_k$ reduced by the number of symbols that appear earlier in the alphabet and appear to the left of it.
Inverse is more or less obvious. Essentially you write N, the position, in factorial positional system, and read the permutation from the result.
$$18=3110_!$$
We start
$$1234$$
$$3110$$
Pick the one at position $3$, remove the position handled and the element ($4$).
$$4$$
$$123$$
$$110$$
Pick the next one at position $1$, remove the position handled and the element ($2$).
$$42$$
$$13$$
$$10$$
Pick the next one at position $1$, remove the position handled and the element ($3$).
$$423$$
$$1$$
$$0$$
Finally take the last element to have $4231$ as expected.
(You can read the order directly. Start from the left and use order in the alphabet, if you find the same position twice, just increment it. Therefore
$3110_!$ is $3, 31, 311=312, 3120 \to 4231$
$1210_!$ would be $1,12,121=122=123,1230 \to 2341$)
