Googology Wiki
Googology Wiki
No edit summary
Tags: Visual edit apiedit
m (Reverted edits by 2.126.17.129 (talk | block) to last version by Vel!)
Line 12: Line 12:
 
The first few values of !''n'' for ''n'' = 0, 1, 2, 3, 4, 5, etc. are 1, 0, 1, 2, 9, 44, 265, 1854, 14833, ...
 
The first few values of !''n'' for ''n'' = 0, 1, 2, 3, 4, 5, etc. are 1, 0, 1, 2, 9, 44, 265, 1854, 14833, ...
   
In base 10, only one number is equal to the sum of the subfactorials of its digits: 148349 = !1 + !4 + !8 + !3 + !4 + !9.\[\sum^{2}_{n=1}n\]
+
In base 10, only one number is equal to the sum of the subfactorials of its digits: 148349 = !1 + !4 + !8 + !3 + !4 + !9.
   
 
=== Pseudocode ===
 
=== Pseudocode ===

Revision as of 17:57, 24 November 2015

The subfactorial or left factorial, written \(!n\), is the number of ways that n objects can be arranged where no object appears in its natural position (known as "derangements.")[1] There are many formulas for \(!n\):

\begin{eqnarray*} !n &=& n! \displaystyle\sum^{n}_{i = 0} \frac{(-1)^i}{i!}\\ &=& \displaystyle\sum^{n}_{i = 0} i! (-1)^{n - i} \binom{n}{i}\\ &=& \displaystyle\frac{\Gamma(n + 1, -1)}{e}\\ &=& \left[\frac{n!}{e}\right] \text{ (only for $n > 0$)} \end{eqnarray*}

In the last formula, [n] means the nearest integer to n. (It is a direct consequence of the first formula — the summation converges to \(1/e\).)

The first few values of !n for n = 0, 1, 2, 3, 4, 5, etc. are 1, 0, 1, 2, 9, 44, 265, 1854, 14833, ...

In base 10, only one number is equal to the sum of the subfactorials of its digits: 148349 = !1 + !4 + !8 + !3 + !4 + !9.

Pseudocode

// Standard factorial function
function factorial(z):
    result := 1
    for i from 1 to z:
        result := result * i
    return result

// Subfactorial
function subfactorial(z):
    return floor(factorial(z) / e + 0.5)

Sources

See also

Main article: Factorial
Multifactorials: Double factorial · Multifactorial
Falling and rising: Falling factorial · Rising factorial
Other mathematical variants: Alternating factorial · Hyperfactorial · q-factorial · Roman factorial · Subfactorial · Weak factorial · Primorial · Compositorial · Semiprimorial
Tetrational growth: Exponential factorial · Expostfacto function · Superfactorial by Clifford Pickover
Nested Factorials: Tetorial · Petorial · Ectorial · Zettorial · Yottorial
Array-based extensions: Hyperfactorial array notation · Nested factorial notation
Other googological variants: · Tetrofactorial · Superfactorial by Sloane and Plouffe · Torian · Factorexation · Mixed factorial · Bouncing Factorial