Left factorials

FCC link

Left factorials, $ !n $, may refer to either subfactorials or to factorial sums. The same notation can be confusingly seen used for the two different definitions. Sometimes, subfactorials (also known as derangements) may use any of the notations:

  • $!n`$
  • $!n$
  • $n¡$

(It may not be visually obvious, but the last example uses an upside-down exclamation mark.) This task will be using this formula for left factorial:

$ !n = \sum_{k=0}^{n-1} k! $

where $!0 = 0$

Test

{{test}}

Console output