44 lines
1.8 KiB
Plaintext
44 lines
1.8 KiB
Plaintext
'''Left factorials''', <big><big>!n</big></big>, may refer to either ''subfactorials'' or to ''factorial sums'';
|
|
<br>the same notation can be confusingly seen being used for the two different definitions.
|
|
|
|
Sometimes, ''subfactorials'' (also known as ''derangements'') may use any of the notations:
|
|
:::::::* <big><big> <b> <span style="font-family:serif">!''n''`</span> </b> </big></big>
|
|
:::::::* <big><big> <b> <span style="font-family:serif">!''n''</span> </b> </big></big>
|
|
:::::::* <big><big> <b> <span style="font-family:serif">''n''¡</span> </b> </big></big>
|
|
|
|
|
|
(It may not be visually obvious, but the last example uses an upside-down exclamation mark.)
|
|
|
|
|
|
This Rosetta Code task will be using this formula (''factorial sums'') for '''left factorial''':
|
|
<big><big>
|
|
::::: <math> !n = \sum_{k=0}^{n-1} k! </math>
|
|
</big></big>
|
|
:::: where
|
|
<big><big>
|
|
::::: <math>!0 = 0</math>
|
|
</big></big>
|
|
|
|
|
|
;Task
|
|
Display the left factorials for:
|
|
* zero through ten (inclusive)
|
|
* 20 through 110 (inclusive) by tens
|
|
|
|
<br>
|
|
Display the length (in decimal digits) of the left factorials for:
|
|
* 1,000 through 10,000 (inclusive), by thousands.
|
|
|
|
|
|
;Also see:
|
|
* The OEIS entry: [http://oeis.org/A003422 A003422 left factorials]
|
|
* The MathWorld entry: [http://mathworld.wolfram.com/LeftFactorial.html left factorial]
|
|
* The MathWorld entry: [http://mathworld.wolfram.com/FactorialSums.html factorial sums]
|
|
* The MathWorld entry: [http://mathworld.wolfram.com/Subfactorial.html subfactorial]
|
|
|
|
|
|
;Related task:
|
|
* [http://rosettacode.org/wiki/Permutations/Derangements permutations/derangements (subfactorials)]
|
|
<br><br>
|
|
|