Left factorials

From Fōrmulæ wiki
Jump to: navigation, search

This page is a solution to the task Left factorials in the Rosetta Code, written in Fōrmulæ.

Description (from Rosetta Code)

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 Rosetta Code task will be using this formula for left factorial:



Display the left factorials for:

  • Zero through ten (inclusive)
  • 20 through 110 (inclusive) by tens

Display the length (in decimal digits) of the left factorials for:

  • 1,000, 2,000 through 10,000 (inclusive), by thousands.

Also see

Related task


The definition can perfectly work:


However, the following is much faster:


Case 1

Showing left factorials from zero to ten:


Case 2

Showing left factorials from 20 to 110, by tens:


Case 3

Showing length of left factorials, from 1,000 to 10,000 by thousands: