| The numbers in the sequence obtained, 1, 2, 9, 44, 265, 1854, 14833, 133496,
1334961 are known as subfactorials (written !n, for example, !4=9, read as
subfactorial 4 equals 9). The numbers are also known as Rencontre Numbers
after the famous "Le Probleme des rescontres". These numbers
represent the number of derangements of the first n integers (see
"derangements" in the math notes concordance), that is, the number
of permutations of 1,2,3,...,n leaving no number fixed.
A good reference is Daniel I. A. Cohen, Basic Techniques of Combinatorial
Theory, pp 89-92. Other references are Riordan, Introduction to Combinatorial
Analysis, page 188, and Ryser, Combinatorial Mathematics p. 23. See also
Comtet, Advanced Combinatorics. Many books on recreational mathematics
also talk about these numbers.
There is no closed form formula for the nth subfactorial.
A one line non-recursive formula is
f(n)=n!(1-1/1!+1/2!-1/3!+1/4!-1/5!+...-...+(-1)^n/n!).
A simple way to evaluate f(n) for large n is that it is approximately n!/e.
In fact, f(n) is precisely the nearest integer to n!/e. For even larger n,
apply Stirlings approximation for n! to get a formula easier to calculate.
If we divide each term by (n-1), we get the related sequence,
1, 1, 3, 11, 53, 309, 2119, 16687, 148329. It is defined by the
recurrence g(n)=ng(n-1)+(n-1)g(n-2).
|