In how many ways can the word "WORD" be rearranged so that no letter is in its original position?
The answer is $9$, but what is the formula for it?
In how many ways can the word "WORD" be rearranged so that no letter is in its original position?
The answer is $9$, but what is the formula for it?
The keyword here is derangements. The formula for the number of derangements of $n$ things is a bit messy:
$$d_n=n!\sum_{k=0}^n\frac{(-1)^k}{k!}\;.$$
You’ll find some other formulas, less easy to prove but more usable, at the link; perhaps the nicest is
$$d_n=\left\lfloor\frac{n!}e+\frac12\right\rfloor\;,$$
for $n\ge 1$.