TheInfoList

In
mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no general consensus abo ...
, the factorial of a non-negative denoted is the product of all positive integers less than or equal The factorial also equals the product of $n$ with the next smaller factorial: $\begin n! &= n \times (n-1) \times (n-2) \times (n-3) \times \cdots \times 3 \times 2 \times 1 \\ &= n\times(n-1)!\\ \end$ For example, $5! = 5 \times 4 \times 3 \times 2 \times 1 = 5\times 24 = 120.$ The value of 0! is 1, according to the convention for an
empty product In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
. Factorials have been discovered in several ancient cultures, notably in
Indian mathematics Indian mathematics emerged in the Indian subcontinent from 1200 BCE until the end of the 18th century. In the classical period of Indian mathematics (400 CE to 1200 CE), important contributions were made by scholars like Aryabhata, Brahmagupta, ...
in the canonical works of
Jain literature Jain literature refers to the literature of the Jain religion. It is a vast and ancient literary tradition, which was initially transmitted orally. The oldest surviving material is contained in the canonical ''Jain Agamas,'' which are written ...
, and by Jewish mystics in the Talmudic book ''
Sefer Yetzirah ''Sefer Yetzirah'' ( ''Sēp̄er Yəṣīrā'', ''Book of Formation'', or ''Book of Creation'') is the title of the earliest extant book on Jewish mysticism, although some early commentators treated it as a treatise on mathematical and linguistic t ...
''. The factorial operation is encountered in many areas of mathematics, notably in
combinatorics Combinatorics is an area of mathematics primarily concerned with counting, both as a means and an end in obtaining results, and certain properties of finite set, finite Mathematical structure, structures. It is closely related to many other are ...
, where its most basic use counts the possible distinct
sequence In , a sequence is an enumerated collection of in which repetitions are allowed and matters. Like a , it contains (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is called the ''length'' of the sequence. Unl ...

s – the
permutation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...

s – of $n$ distinct objects: there In
mathematical analysis Analysis is the branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical ...
, factorials are used in
power series In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
for the
exponential function The exponential function is a mathematical function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of a ...

and other functions, and they also have applications in
algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In its most ge ...

,
number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of devoted primarily to the study of the s and . German mathematician (1777–1855) said, "Mathematics is the queen of the sciences—and number theory is the queen ...

,
probability theory Probability theory is the branch of concerned with . Although there are several different , probability theory treats the concept in a rigorous mathematical manner by expressing it through a set of . Typically these axioms formalise probability ...
, and
computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , , and . Computer science ...
. Much of the mathematics of the factorial function was developed beginning in the late 18th and early 19th centuries.
Stirling's approximation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
provides an accurate approximation to the factorial of large numbers, showing that it grows more quickly than
exponential growth Exponential growth is a process that increases quantity over time. It occurs when the instantaneous Rate (mathematics)#Of change, rate of change (that is, the derivative) of a quantity with respect to time is proportionality (mathematics), proport ...

.
Legendre's formulaIn mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime A prime number (or a prime) is a natural number In mathematics, the natural numbers are those used for counting (as in "there are ''six' ...
describes the exponents of the prime numbers in a prime factorization of the factorials, and can be used to count the trailing zeros of the factorials.
Daniel Bernoulli Daniel Bernoulli Fellows of the Royal Society, FRS (; – 27 March 1782) was a Swiss people, Swiss mathematician and physicist and was one of the many prominent mathematicians in the Bernoulli family from Basel. He is particularly remembered for ...
and
Leonhard Euler Leonhard Euler ( ; ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who made important and influential discoveries in many branches of mathematics, such as infinitesimal c ...

interpolated the factorial function to a continuous function of
complex number In mathematics, a complex number is an element of a number system that contains the real numbers and a specific element denoted , called the imaginary unit, and satisfying the equation . Moreover, every complex number can be expressed in the for ...

s, except at the negative integers, the (offset)
gamma function In mathematics, the gamma function (represented by \Gamma or , the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers ...

. Many other notable functions and number sequences are closely related to the factorials, including the
binomial coefficient In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
s,
double factorial In mathematics, the double factorial or semifactorial of a number , denoted by , is the product of all the integers from 1 up to that have the same Parity (mathematics), parity (odd or even) as . That is, :n!! = \prod_^ (n-2k) = n (n-2) (n-4) \cd ...
s,
falling factorial In mathematics, the falling factorial (sometimes called the descending factorial, falling sequential product, or lower factorial) is defined as the polynomial :(x)_n = x^ = x(x-1)(x-2)\cdots(x-n+1) = \prod_^n(x-k+1) = \prod_^(x-k). The rising fac ...
s,
primorial In mathematics, and more particularly in number theory, primorial, denoted by “#”, is a Function (mathematics), function from natural numbers to natural numbers similar to the factorial function, but rather than successively multiplying positi ...
s, and
subfactorial In combinatorial mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis ...
s. Implementations of the factorial function are commonly used as an example of different
computer programming Computer programming is the process of designing and building an executable In computing, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform in ...
styles, and are included in
scientific calculator Casio fx-77, a solar-powered calculator, solar-powered digital calculator from the 1980s using a single-line LCD A digital calculator is a type of Electronics, electronic calculator, usually but not always handheld, designed to calculate proble ...

s and scientific computing sofware libraries. Although directly computing large factorials using the product formula or recurrence is not efficient, faster algorithms are known, nearly matching the time for fast
multiplication algorithm A multiplication algorithm is an algorithm (or method) to multiplication, multiply two numbers. Depending on the size of the numbers, different algorithms are used. Efficient multiplication algorithms have existed since the advent of the decimal sy ...

s for numbers with the same number of digits.

# History

The concept of factorials has arisen independently in many cultures: *In
Indian mathematics Indian mathematics emerged in the Indian subcontinent from 1200 BCE until the end of the 18th century. In the classical period of Indian mathematics (400 CE to 1200 CE), important contributions were made by scholars like Aryabhata, Brahmagupta, ...
, one of the earliest known descriptions of factorials comes from the Anuyogadvāra-sūtra, one of the canonical works of
Jain literature Jain literature refers to the literature of the Jain religion. It is a vast and ancient literary tradition, which was initially transmitted orally. The oldest surviving material is contained in the canonical ''Jain Agamas,'' which are written ...
, likely dating from 200 BCE to 100 CE. It separates out the sorted and reversed order of a set of items from the other ("mixed") orders, evaluating the number of mixed orders by subtracting two from the usual product formula for the factorial. The product rule for permutations was also described by 6th-century CE Jain monk Jinabhadra. Hindu scholars have been using factorial formulas since at least 1150, when
Bhāskara II Bhāskara (c. 1114–1185) also known as Bhāskarācārya ("Bhāskara, the teacher"), and as Bhāskara II to avoid confusion with Bhāskara I, was an Indian people, Indian Indian mathematicians, mathematician and astronomer. He was born in Bij ...
mentioned factorials in his work
Līlāvatī ''Līlāvatī'' is Indian mathematician Bhāskara II's treatise on mathematics, written in 1150. It is the first volume of his main work, the ''Siddhānta Shiromani'', alongside the ''Bijaganita'', the ''Grahaganita'' and the ''Golādhyāya''. ...
, in connection with a problem of how many ways
Vishnu Vishnu (; ; , ), also known as Narayana and Hari, is one of the Hindu deities, principal deities of Hinduism. He is the supreme being within Vaishnavism, one of the major traditions within contemporary Hinduism. Vishnu is known as "The Prese ...

could hold his four characteristic objects (a
conch shell Conch () is a common name of a number of different medium- to large-sized sea snail or shells, generally those of large snails whose shell has a high spire and a noticeable siphonal canal (in other words, the shell comes to a noticeable po ...

, ,
mace Mace may refer to: Arts and entertainment * Mace (G.I. Joe), a fictional character in the G.I. Joe universe * Mace, a fictional character in the 1995 film ''Strange Days (film), Strange Days'' * Mace, a fictional character in the 2007 film ''Sunsh ...
, and
lotus flower ''Nelumbo nucifera'', also known as Indian lotus, sacred lotus, or simply lotus, is one of two extant species of aquatic plant in the family Nelumbonaceae. It is often colloquially called a water lily. Lotus plants are adapted to grow in th ...
) in his four hands, and a similar problem for a ten-handed god. *In the mathematics of the Middle East, the Hebrew mystic book of creation ''
Sefer Yetzirah ''Sefer Yetzirah'' ( ''Sēp̄er Yəṣīrā'', ''Book of Formation'', or ''Book of Creation'') is the title of the earliest extant book on Jewish mysticism, although some early commentators treated it as a treatise on mathematical and linguistic t ...
'', from the
Talmudic period The Talmud (; he, תַּלְמוּד ''Tálmūḏ'') is the central text of Rabbinic Judaism and the primary source of Jewish religious law (''halakha'') and Jewish theology. Until the advent of modernity, in nearly all Jewish communities, the ...

(200 to 500 CE), lists factorials up to 7! as part of an investigation into the number of words that can be formed from the
Hebrew alphabet The Hebrew alphabet ( he, wikt:אלפבית, אָלֶף־בֵּית עִבְרִי, ), known variously by scholars as the Ktav Ashuri, Jewish script, square script and block script, is an abjad script used in the writing of the Hebrew language ...

. Factorials were also studied for similar reasons by 8th-century Arab grammarian
Al-Khalil ibn Ahmad al-Farahidi Abu ‘Abd ar-Raḥmān al-Khalīl ibn Aḥmad ibn ‘Amr ibn Tammām al-Farāhīdī al-Zahrāni al-Azdī al-Yaḥmadī ( ar, أبو عبدالرحمن الخليل بن أحمد الفراهيدي الزهراني; 718 – 786 CE), known as Al-F ...
. Arab mathematician
Ibn al-Haytham Ḥasan Ibn al-Haytham (Latinization of names, Latinized as Alhazen ; full name ; ) was a Muslim Arab Mathematics in medieval Islam, mathematician, Astronomy in the medieval Islamic world, astronomer, and Physics in the medieval Islamic world, ...

(also known as Alhazen, c. 965 – c. 1040) was the first to formulate
Wilson's theorem In number theory, Wilson's theorem states that a natural number In mathematics, the natural numbers are those used for counting (as in "there are ''six'' coins on the table") and total order, ordering (as in "this is the ''third'' largest city ...
connecting the factorials with the
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...
s. *In Europe, although
Greek mathematics Greek mathematics refers to mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical ...
included some combinatorics, and
Plato Plato ( ; grc-gre, wikt:Πλάτων, Πλάτων ; 428/427 or 424/423 – 348/347 BC) was an Classical Athens, Athenian philosopher during the Classical Greece, Classical period in Ancient Greece, founder of the Platonist school of thoug ...

famously used 5040 (a factorial) as the population of an ideal community, in part because of its divisibility properties, there is no direct evidence of ancient Greek study of factorials. Instead, the first work on factorials in Europe was by Jewish scholars such as Shabbethai Donnolo, explicating the Sefer Yetzirah passage. In 1677, British author
Fabian Stedman Fabian Stedman (1640–1713) was a British author and a leading figure in the early history of campanology, particularly in the field of method ringing. He had a key role in publishing two books ''Tintinnalogia'' (1668 with Richard Duckworth) and ' ...
described the application of factorials to
change ringing Change ringing is the art of ringing a set of tuning (music), tuned bell (instrument), bells in a tightly controlled manner to produce precise variations in their successive striking sequences, known as "changes". This can be by method ringing in wh ...
, a musical art involving the ringing of several tuned bells. From the late 15th century onward, factorials became the subject of study by western mathematicians. In a 1494 treatise, Italian mathematician
Luca Pacioli Fra Luca Bartolomeo de Pacioli (sometimes ''Paccioli'' or ''Paciolo''; 1447 – 19 June 1517) was an Italian mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, G ...

calculated factorials up to 11!, in connection with a problem of dining table arrangements.
Christopher Clavius Christopher Clavius (25 March 1538 – 6 February 1612) was a Jesuit The Society of Jesus (SJ; la, Societas Iesu) is a religious order of the Catholic Church The Catholic Church, often referred to as the Roman Catholic Church, ...

discussed factorials in a 1603 commentary on the work of
Johannes de Sacrobosco Johannes de Sacrobosco, also written Ioannis de Sacro Bosco, later called John of Holywood or John of Holybush ( 1195 – 1256), was a scholar, monk A monk (, from el, μοναχός, ''monachos'', "single, solitary" via Latin Latin (, ...
, and in the 1640s, French polymath
Marin Mersenne Marin Mersenne (also known as Marinus Mersennus or ''le Père'' Mersenne; ; 8 September 1588 – 1 September 1648) was a French whose works touched a wide variety of fields. He is perhaps best known today among mathematicians for numbers, thos ...

published large (but not entirely correct) tables of factorials, up to 64!, based on the work of Clavius. The
power series In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
for the
exponential function The exponential function is a mathematical function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of a ...

, with the reciprocals of factorials for its coefficients, was first formulated in 1676 by
Isaac Newton Sir Isaac Newton (25 December 1642 – 20 March 1726/27) was an English mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Greek: ) includes the study of such topics a ...

in a letter to
Gottfried Wilhelm Leibniz Gottfried Wilhelm (von) Leibniz ; see inscription of the engraving depicted in the " 1666–1676" section. ( – 14 November 1716) was a German polymath A polymath ( el, πολυμαθής, ', "having learned much"; Latin Latin (, or , ...

. Other important works of early European mathematics on factorials include extensive coverage in a 1685 treatise by
John Wallis John Wallis (; la, Wallisius; ) was an English clergyman and mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), f ...

, a study of their approximate values for large values of $n$ by
Abraham de Moivre Abraham de Moivre (; 26 May 166727 November 1754) was a French mathematician known for de Moivre's formula, a formula that links complex number In mathematics, a complex number is a number that can be expressed in the form , where and are r ...

in 1721, a 1729 letter from James Stirling to de Moivre stating what became known as
Stirling's approximation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
, and work at the same time by
Daniel Bernoulli Daniel Bernoulli Fellows of the Royal Society, FRS (; – 27 March 1782) was a Swiss people, Swiss mathematician and physicist and was one of the many prominent mathematicians in the Bernoulli family from Basel. He is particularly remembered for ...
and
Leonhard Euler Leonhard Euler ( ; ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who made important and influential discoveries in many branches of mathematics, such as infinitesimal c ...

formulating the continuous extension of the factorial function to the
gamma function In mathematics, the gamma function (represented by \Gamma or , the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers ...

.
Adrien-Marie Legendre Adrien-Marie Legendre (; ; 18 September 1752 – 9 January 1833) was a French mathematician who made numerous contributions to mathematics. Well-known and important concepts such as the Legendre polynomials and Legendre transformation are named a ...
included
Legendre's formulaIn mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime A prime number (or a prime) is a natural number In mathematics, the natural numbers are those used for counting (as in "there are ''six' ...
, describing the exponents in the
factorization In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). I ...
of factorials into
prime power In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
s, in an 1808 text on
number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of devoted primarily to the study of the s and . German mathematician (1777–1855) said, "Mathematics is the queen of the sciences—and number theory is the queen ...

. The notation $n!$ for factorials was introduced by the French mathematician
Christian Kramp Christian Kramp ( 8 July 1760 Events January–March * January 9 – At the Battle of Barari Ghat, Durrani Empire, Afghan forces defeat the Maratha Empire, Marathas. * January 22 – Seven Years' War: Battle of Wandiwash, ...

in 1808. Many other notations have also been used. Another later notation, in which the argument of the factorial was half-enclosed by the left and bottom sides of a box, was popular for some time in Britain and America but fell out of use, perhaps because it is difficult to typeset. The word "factorial" (originally French: ''factorielle'') was first used in 1800 by Louis François Antoine Arbogast, in the first work on Faà di Bruno's formula, but referring to a more general concept of products of
arithmetic progression An Arithmetic progression (AP) or arithmetic sequence is a sequence of numbers such that the difference between the consecutive terms is constant. For instance, the sequence 5, 7, 9, 11, 13, 15, . . . is an arithmetic progression with a common diffe ...

s. The "factors" that this name refers to are the terms of the product formula for the factorial.

# Definition

The factorial function of a positive integer $n$ is defined by the product $n! = 1 \cdot 2 \cdot 3 \cdots (n-2) \cdot (n-1) \cdot n.$ This may be written more concisely in product notation as $n! = \prod_^n i.$ If this product formula is changed to keep all but the last term, it would define a product of the same form, for a smaller factorial. This leads to a
recurrence relation In mathematics, a recurrence relation is an equation that expresses the ''n''th term of a sequence (mathematics), sequence as a function (mathematics), function of the ''k'' preceding terms, for some fixed ''k'' (independent from ''n''), which is ca ...
, according to which each value of the factorial function can be obtained by multiplying the previous value $n! = n\cdot (n-1)!.$ For example,

## Factorial of zero

The factorial or in symbols, There are several motivations for this definition: * For the definition of $n!$ as a product involves the product of no numbers at all, and so is an example of the broader convention that the
empty product In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
, a product of no factors, is equal to the multiplicative identity. * There is exactly one permutation of zero objects: with nothing to permute, the only rearrangement is to do nothing. * This convention makes many identities in
combinatorics Combinatorics is an area of mathematics primarily concerned with counting, both as a means and an end in obtaining results, and certain properties of finite set, finite Mathematical structure, structures. It is closely related to many other are ...
valid for all valid choices of their parameters. For instance, the number of ways to choose all $n$ elements from a set of $n$ is $\tbinom = \tfrac = 1,$ a
binomial coefficient In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
identity that would only be valid * With the recurrence relation for the factorial remains valid Therefore, with this convention, a
recursive Recursion (adjective: ''recursive'') occurs when a thing is defined in terms of itself or of its type. Recursion is used in a variety of disciplines ranging from linguistics Linguistics is the science, scientific study of language. It e ...

computation of the factorial needs to have only the value for zero as a
base case Base or BASE may refer to: Brands and enterprises *Base (mobile telephony provider), a Belgian mobile telecommunications operator *Base CRM, an enterprise software company founded in 2009 with offices in Mountain View and Kraków, Poland *Base De ...
, simplifying the computation and avoiding the need for additional special cases. * Setting $0!=1$ allows for the compact expression of many formulae, such as the
exponential function The exponential function is a mathematical function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of a ...

, as a
power series In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
: * This choice matches the
gamma function In mathematics, the gamma function (represented by \Gamma or , the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers ...

and the gamma function must have this value to be a
continuous function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...
.

# Applications

The earliest uses of the factorial function involve counting
permutations In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...
: there are $n!$ different ways of arranging $n$ distinct objects into a sequence. Factorials appear more broadly in many formulas in
combinatorics Combinatorics is an area of mathematics primarily concerned with counting, both as a means and an end in obtaining results, and certain properties of finite set, finite Mathematical structure, structures. It is closely related to many other are ...
, to account for different orderings of objects. For instance the
binomial coefficient In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
s $\tbinom$ count the
combination In mathematics, a combination is a selection of items from a collection, such that the order of selection does not matter (unlike permutations). For example, given three fruits, say an apple, an orange and a pear, there are three combinations of t ...

s (subsets of from a set with and can be computed from factorials using the formula $\binom=\frac.$ The
Stirling numbers of the first kind In mathematics, especially in combinatorics, Stirling numbers of the first kind arise in the study of permutations. In particular, the Stirling numbers of the first kind count permutations according to their number of Cycles and fixed points, cycl ...
sum to the factorials, and count the permutations grouped into subsets with the same numbers of cycles. Another combinatorial application is in counting
derangement In combinatorial Combinatorics is an area of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, ...
s, permutations that do not leave any element in its original position; the number of derangements of $n$ items is the In
algebra Algebra (from ar, الجبر, lit=reunion of broken parts, bonesetting, translit=al-jabr) is one of the areas of mathematics, broad areas of mathematics, together with number theory, geometry and mathematical analysis, analysis. In its most ge ...

, the factorials arise through the
binomial theorem In elementary algebra Elementary algebra encompasses some of the basic concepts of algebra, one of the main branches of mathematics. It is typically taught to secondary school students and builds on their understanding of arithmetic. Whereas a ...
, which uses binomial coefficients to expand powers of sums. They also occur in the coefficients used to relate certain families of polynomials to each other, for instance in
Newton's identities In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
for
symmetric polynomial In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It h ...
s. Their use in counting permutations can also be restated algebraically: the factorials are the
orders Orders is a surname In some cultures, a surname, family name, or last name is the portion of one's personal name that indicates their family, tribe or community. Practices vary by culture. The family name may be placed at either the start of ...
of finite
symmetric group In abstract algebra In algebra, which is a broad division of mathematics, abstract algebra (occasionally called modern algebra) is the study of algebraic structures. Algebraic structures include group (mathematics), groups, ring (mathematic ...
s. In
calculus Calculus, originally called infinitesimal calculus or "the calculus of infinitesimals", is the mathematics, mathematical study of continuous change, in the same way that geometry is the study of shape and algebra is the study of generalizations ...

, factorials occur in Faà di Bruno's formula for chaining higher derivatives. In
mathematical analysis Analysis is the branch of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical ...
, factorials frequently appear in the denominators of
power series In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
, most notably in the series for the
exponential function The exponential function is a mathematical function Function or functionality may refer to: Computing * Function key A function key is a key on a computer A computer is a machine that can be programmed to carry out sequences of a ...

, $e^x=1+\frac+\frac+\frac+\cdots=\sum_^\frac,$ and in the coefficients of other
Taylor series In , the Taylor series of a is an of terms that are expressed in terms of the function's s at a single point. For most common functions, the function and the sum of its Taylor series are equal near this point. Taylor's series are named after ...
, where they cancel factors of $n!$ coming from the This usage of factorials in power series connects back to
analytic combinatorics ''Analytic Combinatorics'' is a book on the mathematics of combinatorial enumeration, using generating functions and complex analysis to understand the growth rates of the numbers of combinatorial objects. It was written by Philippe Flajolet and Rob ...
through the
exponential generating function In mathematics, a generating function is a way of encoding an infinite sequence of numbers (''a'n'') by treating them as the coefficients of a formal power series. This series is called the generating function of the sequence. Unlike an ordinar ...
, which for a
combinatorial classIn mathematics, a combinatorial class is a countable set of mathematical objects, together with a size function mapping each object to a non-negative integer, such that there are finitely many objects of each size. Counting sequences and isomorphism ...
with $n_i$ elements of is defined as the power series $\sum_^ \frac.$ In
number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of devoted primarily to the study of the s and . German mathematician (1777–1855) said, "Mathematics is the queen of the sciences—and number theory is the queen ...

, the most salient property of factorials is the
divisibility In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). ...
of $n!$ by all positive integers up described more precisely for prime factors by
Legendre's formulaIn mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime A prime number (or a prime) is a natural number In mathematics, the natural numbers are those used for counting (as in "there are ''six' ...
. It follows that arbitrarily large
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...
s can be found as the prime factors of the numbers $n!\pm 1$, leading to a proof of
Euclid's theorem Euclid's theorem is a fundamental statement in number theory Number theory (or arithmetic or higher arithmetic in older usage) is a branch of devoted primarily to the study of the s and . German mathematician (1777–1855) said, "Mathematics ...
that the number of primes is infinite. When $n!\pm 1$ is itself prime it is called a
factorial prime A factorial prime is a prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a compos ...
; relatedly, Brocard's problem, also posed by
Srinivasa Ramanujan Srinivasa Ramanujan (; born Srinivasa Ramanujan Aiyangar; 22 December 188726 April 1920) was an Indian mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) ...
, concerns the existence of
square number In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...
s of the form In contrast, the numbers $n!+2,n!+3,\dots n!+n$ must all be composite, proving the existence of arbitrarily large
prime gap A prime gap is the difference between two successive prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that i ...
s. An elementary
proof of Bertrand's postulate In mathematics, Bertrand's postulate (actually a theorem) states that for each n\ge 2 there is a prime number, prime p such that n. It was first proven by Chebyshev, and a short but advanced proof was given by Ramanujan. The following ...
on the existence of a prime in any interval of the one of the first results of
Paul Erdős Paul Erdős ( hu, Erdős Pál ; 26 March 1913 – 20 September 1996) was a renowned Hungarian mathematician. He was one of the most prolific mathematicians and producers of mathematical conjectures of the 20th century. He was known both for his ...

, was based on the divisibility properties of factorials. The
factorial number system In combinatorics, the factorial number system, also called factoradic, is a mixed radix numeral system adapted to numbering permutations. It is also called factorial base, although factorials do not function as radix, base, but as place value of ...
is a
mixed radix Mixed radix numeral system A numeral system (or system of numeration) is a writing system A writing system is a method of visually representing verbal communication Communication (from Latin ''communicare'', meaning "to share") is th ...
notation for numbers in which the place values of each digit are factorials. Factorials are used extensively in
probability theory Probability theory is the branch of concerned with . Although there are several different , probability theory treats the concept in a rigorous mathematical manner by expressing it through a set of . Typically these axioms formalise probability ...
, for instance in the
Poisson distribution In probability theory and statistics, the Poisson distribution (; ), named after France, French mathematician Siméon Denis Poisson, is a discrete probability distribution that expresses the probability of a given number of events occurring in a f ...
and in the probabilities of
random permutationA random permutation is a random In common parlance, randomness is the apparent or actual lack of pattern or predictability in events. A random sequence of events, symbols or steps often has no :wikt:order, order and does not follow an intell ...
s. In
computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , , and . Computer science ...
, beyond appearing in the analysis of
brute-force search In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algor ...
es over permutations, factorials arise in the
lower bound Lower may refer to: * Lower (surname) * Lower Township, New Jersey *Lower Receiver (firearms) * Lower Wick Gloucestershire, England See also * Nizhny {{Disambiguation ...
of $\log_2 n!$ on the number of comparisons needed to
comparison sort upright=1.1, Sorting a set of unlabelled weights by weight using only a balance scale requires a comparison sort algorithm. A comparison sort is a type of sorting algorithm In computer science, a sorting algorithm is an algorithm that puts elements ...
a set of $n$ items, and in the analysis of chained
hash table In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and development of both computer hardware , hardware and ...
s, where the distribution of keys per cell can be accurately approximated by a Poisson distribution. Moreover, factorials naturally appear in formulae from
quantum In physics Physics is the natural science that studies matter, its Elementary particle, fundamental constituents, its Motion (physics), motion and behavior through Spacetime, space and time, and the related entities of energy and force. ...
and
statistical physics Statistical physics is a branch of physics Physics (from grc, φυσική (ἐπιστήμη), physikḗ (epistḗmē), knowledge of nature, from ''phýsis'' 'nature'), , is the natural science that studies matter, its Motion (physics), ...
, where one often considers all the possible permutations of a set of particles. In
statistical mechanics In physics Physics is the that studies , its , its and behavior through , and the related entities of and . "Physical science is that department of knowledge which relates to the order of nature, or, in other words, to the regular ...
, calculations of
entropy Entropy is a scientific concept as well as a measurable physical property that is most commonly associated with a state of disorder, randomness, or uncertainty. The term and the concept are used in diverse fields, from classical thermodynamic ...

such as
Boltzmann's entropy formula In statistical mechanics In physics, statistical mechanics is a mathematical framework that applies Statistics, statistical methods and probability theory to large assemblies of microscopic entities. It does not assume or postulate any natural ...
or the
Sackur–Tetrode equationThe Sackur–Tetrode equation is an expression for the entropy of a monatomic ideal gas. It is named for Hugo Martin Tetrode (1895–1931) and Otto Sackur (1880–1914), who developed it independently as a solution of Boltzmann's gas statistics and ...
must correct the count of Microstate (statistical mechanics), microstates by dividing by the factorials of the numbers of each type of identical particles, indistinguishable particle to avoid the Gibbs paradox. Quantum physics provides the underlying reason for why these corrections are necessary.

# Properties

## Growth and approximation

As a function the factorial has faster than
exponential growth Exponential growth is a process that increases quantity over time. It occurs when the instantaneous Rate (mathematics)#Of change, rate of change (that is, the derivative) of a quantity with respect to time is proportionality (mathematics), proport ...

, but grows more slowly than a double exponential function. Its growth rate is similar but slower by an exponential factor. One way of approaching this result is by taking the natural logarithm of the factorial, which turns its product formula into a sum, and then estimating the sum by an integral: $\ln n! = \sum_^n \ln x \approx \int_1^n\ln x\, dx=n\ln n-n+1.$ Exponentiating the result (and ignoring the negligible $+1$ term) approximates $n!$ as More carefully bounding the sum both above and below by an integral, using the trapezoid rule, shows that this estimate needs a correction term proportional The constant of proportionality for this correction can be found from the Wallis product, which expresses $\pi$ as a limiting ratio of factorials and powers of two. The result of these corrections is
Stirling's approximation In mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis, analysis). It ...
: $n!\sim\sqrt\left(\frac\right)^n\,.$ Here, the $\sim$ symbol means that, as $n$ goes to infinity, the ratio between the left and right sides approaches one in the Limit (mathematics), limit. Stirling's formula provides the first term in an asymptotic series that becomes even more accurate when taken to greater numbers of terms: $n! \sim \sqrt\left(\frac\right)^n \left(1 +\frac+\frac - \frac -\frac+ \cdots \right).$ An alternative version uses only odd exponents in the correction terms: $n! \sim \sqrt\left(\frac\right)^n \exp\left(\frac - \frac + \frac -\frac+ \cdots \right).$ Many other variations of these formulas have also been developed, by
Srinivasa Ramanujan Srinivasa Ramanujan (; born Srinivasa Ramanujan Aiyangar; 22 December 188726 April 1920) was an Indian mathematician A mathematician is someone who uses an extensive knowledge of mathematics Mathematics (from Ancient Greek, Greek: ) ...
, Bill Gosper, and others. The binary logarithm of the factorial, used to analyze
comparison sort upright=1.1, Sorting a set of unlabelled weights by weight using only a balance scale requires a comparison sort algorithm. A comparison sort is a type of sorting algorithm In computer science, a sorting algorithm is an algorithm that puts elements ...
ing, can be very accurately estimated using Stirling's approximation. In the formula below, the $O\left(1\right)$ term invokes big O notation. $\log_2 n! = n\log_2 n-(\log_2 e)n + \frac12\log_2 n + O(1).$

## Divisibility and digits

The product formula for the factorial implies that $n!$ is divisible by all
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...
s that are at and by no larger prime numbers. More precise information about its divisibility is given by
Legendre's formulaIn mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime A prime number (or a prime) is a natural number In mathematics, the natural numbers are those used for counting (as in "there are ''six' ...
, which gives the exponent of each prime $p$ in the prime factorization of $n!$ as $\sum_^\infty \left \lfloor \frac n \right \rfloor=\frac.$ Here $s_p\left(n\right)$ denotes the sum of the digits and the exponent given by this formula can also be interpreted in advanced mathematics as the p-adic order, -adic valuation of the factorial. Applying Legendre's formula to the product formula for
binomial coefficient In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no g ...
s produces Kummer's theorem, a similar result on the exponent of each prime in the factorization of a binomial coefficient. The special case of Legendre's formula for $p=5$ gives the number of trailing zero#Factorial, trailing zeros in the decimal representation of the factorials. Legendre's formula implies that the exponent of the prime $p=2$ is always larger than the exponent for so each factor of five can be paired with a factor of two to produce one of these trailing zeros. The leading digits of the factorials are distributed according to Benford's law. Every sequence of digits, in any base, is the sequence of initial digits of some factorial number in that base. Another result on divisibility of factorials,
Wilson's theorem In number theory, Wilson's theorem states that a natural number In mathematics, the natural numbers are those used for counting (as in "there are ''six'' coins on the table") and total order, ordering (as in "this is the ''third'' largest city ...
, states that $\left(n-1\right)!+1$ is divisible by $n$ if and only if $n$ is a
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...
. For any given the Kempner function of $x$ is given by the smallest $n$ for which $x$ divides For almost all numbers (all but a subset of exceptions with asymptotic density zero), it coincides with the largest prime factor The product of two factorials, always evenly divides There are infinitely many factorials that equal the product of other factorials: if $n$ is itself any product of factorials, then $n!$ equals that same product multiplied by one more factorial, The only known examples of factorials that are products of other factorials but are not of this "trivial" form are and It would follow from the abc conjecture, conjecture that there are only finitely many nontrivial examples. The greatest common divisor of the values of a Primitive part and content, primitive polynomial over the integers must be a divisor of the factorial of the polynomial's degree.

## Continuous interpolation and non-integer generalization

There are infinitely many ways to extend the factorials to a
continuous function In mathematics Mathematics (from Greek: ) includes the study of such topics as numbers ( and ), formulas and related structures (), shapes and spaces in which they are contained (), and quantities and their changes ( and ). There is no gen ...
. The most widely used of these uses the
gamma function In mathematics, the gamma function (represented by \Gamma or , the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers ...

, which can be defined for positive real numbers as the integral $\Gamma(z) = \int_0^\infty x^ e^\,dx.$ The resulting function is related to the factorial of a non-negative integer $n$ by the equation $n!=\Gamma(n+1),$ which can be used as a definition of the factorial for non-integer arguments. At all values $x$ for which both $\Gamma\left(x\right)$ and $\Gamma\left(x-1\right)$ are defined, the gamma function obeys the functional equation $\Gamma(n)=(n-1)\Gamma(n-1),$ generalizing the
recurrence relation In mathematics, a recurrence relation is an equation that expresses the ''n''th term of a sequence (mathematics), sequence as a function (mathematics), function of the ''k'' preceding terms, for some fixed ''k'' (independent from ''n''), which is ca ...
for the factorials. The same integral converges more generally for any
complex number In mathematics, a complex number is an element of a number system that contains the real numbers and a specific element denoted , called the imaginary unit, and satisfying the equation . Moreover, every complex number can be expressed in the for ...

$z$ whose real part is positive. It can be extended to the rest of the complex plane by solving for Euler's reflection formula $\Gamma(z)\Gamma(1-z)=\frac.$ However, this fails to assign a value to the gamma function at the non-positive integers, because it would lead to a division by zero. The result of this extension process is an analytic function, the analytic continuation of the integral formula for the gamma function. It has a nonzero value at all complex numbers, except for the non-positive integers where it has Zeros and poles, simple poles. Correspondingly, this provides a definition for the factorial at all complex numbers other than the negative integers. One property of the gamma function, distinguishing it from other continuous interpolations of the factorials, is given by the Bohr–Mollerup theorem, which states that the gamma function (offset by one) is the only log-convex function on the positive real numbers that interpolates the factorials and obeys the same functional equation. A related uniqueness theorem of Helmut Wielandt states that the complex gamma function and its scalar multiples are the only holomorphic functions on the positive complex half-plane that obey the functional equation and remain bounded for complex numbers with real part between 1 and 2. Other complex functions that interpolate the factorial values include Hadamard's gamma function, which is an entire function over all the complex numbers, including the non-positive integers. In the p-adic number, -adic numbers, it is not possible to continuously interpolate the factorial function directly, because the factorials of large integers (a dense subset of the -adics) converge to zero according to Legendre's formula, forcing any continuous function that is close to their values to be zero everywhere. Instead, the p-adic gamma function, -adic gamma function provides a continuous interpolation of a modified form of the factorial, omitting the factors in the factorial that are divisible by . The digamma function is the logarithmic derivative of the gamma function. Just as the gamma function provides a continuous interpolation of the factorials, offset by one, the digamma function provides a continuous interpolation of the harmonic numbers, offset by the Euler–Mascheroni constant.

## Computation

The factorial function is a common feature in
scientific calculator Casio fx-77, a solar-powered calculator, solar-powered digital calculator from the 1980s using a single-line LCD A digital calculator is a type of Electronics, electronic calculator, usually but not always handheld, designed to calculate proble ...

s. It is also included in scientific programming libraries such as the Python (programming language), Python mathematical functions module and the Boost (C++ libraries), Boost C++ library. If efficiency is not a concern, computing factorials is trivial: just successively multiply a variable initialized by the integers up The simplicity of this computation makes it a common example in the use of different computer programming styles and methods. The computation of $n!$ can be expressed in pseudocode using iteration as or using Recursion (computer science), recursion based on its recurrence relation as Other methods suitable for its computation include memoization, dynamic programming, and functional programming. The computational complexity of these algorithms may be analyzed using the unit-cost random-access machine model of computation, in which each arithmetic operation takes constant time and each number uses a constant amount of storage space. In this model, these methods can compute $n!$ in time and the iterative version uses space Unless optimized for tail recursion, the recursive version takes linear space to store its call stack. However, this model of computation is only suitable when $n$ is small enough to allow $n!$ to fit into a machine word. The values 12! and 20! are the largest factorials that can be stored in, respectively, the 32-bit computing, 32-bit and 64-bit computing, 64-bit integers. Floating point can represent larger factorials, but approximately rather than exactly, and will still overflow for factorials larger than The exact computation of larger factorials involves arbitrary-precision arithmetic, and its time can be analyzed as a function of the number of digits or bits in the result. By Stirling's formula, $n!$ has $b=O\left(n\log n\right)$ bits. The Schönhage–Strassen algorithm can produce a product in time and faster
multiplication algorithm A multiplication algorithm is an algorithm (or method) to multiplication, multiply two numbers. Depending on the size of the numbers, different algorithms are used. Efficient multiplication algorithms have existed since the advent of the decimal sy ...

s taking time $O\left(b\log b\right)$ are known. However, computing the factorial involves repeated products, rather than a single multiplication, so these time bounds do not apply directly. In this setting, computing $n!$ by multiplying the numbers from 1 in sequence is inefficient, because it involves $n$ multiplications, a constant fraction of which take time $O\left(n\log^2 n\right)$ each, giving total time A better approach is to perform the multiplications as a divide-and-conquer algorithm that multiplies a sequence of $i$ numbers by splitting it into two subsequences of $i/2$ numbers, multiplies each subsequence, and combines the results with one last multiplication. This approach to the factorial takes total time one logarithm comes from the number of bits in the factorial, a second comes from the multiplication algorithm, and a third comes from the divide and conquer. Even better efficiency is obtained by computing from its prime factorization, based on the principle that exponentiation by squaring is faster than expanding an exponent into a product. The resulting algorithm performs the following steps: *Construct a list of the primes up for instance using the sieve of Eratosthenes, and use Legendre's formula to compute the exponent for each prime. *For each power of two $2^i$ in the range from 1 find the primes whose exponent's binary representation has a nonzero bit in multiply these primes together using divide and conquer, and square the result of this multiplication $i$ times. *Use divide and conquer to multiply together the numbers resulting from the previous step. It evaluates $n!$ in time This is slower by a factor of $O\left(\log\log n\right)$ than a single multiplication with the same number of bits in its result; this factor comes from the divide and conquer in the last step, which multiplies together logarithmically many numbers.

# Related sequences and functions

Several other integer sequences are similar to or related to the factorials: ;Alternating factorial :The alternating factorial is the absolute value of the alternating sum of the first $n$ factorials, These have mainly been studied in connection with their primality; only finitely many of them can be prime, but a complete list of primes of this form is not known. ;Bhargava factorial :The Bhargava factorials are a family of integer sequences defined by Manjul Bhargava with similar number-theoretic properties to the factorials, including the factorials themselves as a special case. ;Double factorial :The product of all the odd integers up to some odd positive is called the
double factorial In mathematics, the double factorial or semifactorial of a number , denoted by , is the product of all the integers from 1 up to that have the same Parity (mathematics), parity (odd or even) as . That is, :n!! = \prod_^ (n-2k) = n (n-2) (n-4) \cd ...
and denoted by That is, $(2k-1)!! = \prod_^k (2i-1) = \frac.$ For example, . Double factorials are used in List of integrals of trigonometric functions, trigonometric integrals, in expressions for the
gamma function In mathematics, the gamma function (represented by \Gamma or , the capital letter gamma from the Greek alphabet) is one commonly used extension of the factorial function to complex numbers. The gamma function is defined for all complex numbers ...

at half-integers and the Volume of an n-ball, volumes of hyperspheres, and in counting rooted binary tree, binary trees and perfect matchings. ;Exponential factorial :Just as triangular numbers sum the numbers from $1$ and factorials take their product, the exponential factorial exponentiates. The exponential factorial denoted is defined recursively with the base case For example, $4\= 4^=262144.$ These numbers grow much more quickly than regular factorials. ;Falling factorial :The notations $\left(x\right)_$ or $x^$ are sometimes used to represent the product of the $n$ integers counting up to and equal to This is also known as a Falling and rising factorials, falling factorial or backward factorial, and the $\left(x\right)_$ notation is a Pochhammer symbol. Falling factorials count the number of different sequences of $n$ distinct items that can be drawn from a universe of $x$ items. They occur as coefficients in the higher derivatives of polynomials, and in the factorial moments of random variables. ;Hyperfactorials :The hyperfactorial of $n$ is the product $1^1\cdot 2^2\cdots n^n$. These numbers form the discriminants of Hermite polynomials. They can be continuously interpolated by the K-function, and obey analogues to Stirling's formula and Wilson's theorem. ;Jordan–Pólya numbers :The Jordan–Pólya numbers are the products of factorials, allowing repetitions. Every Tree (graph theory), tree has a symmetry group whose number of symmetries is a Jordan–Pólya number, and every Jordan–Pólya number counts the symmetries of some tree. ;Primorial :The
primorial In mathematics, and more particularly in number theory, primorial, denoted by “#”, is a Function (mathematics), function from natural numbers to natural numbers similar to the factorial function, but rather than successively multiplying positi ...
$n\#$ is the product of
prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...
s less than or equal this construction gives them some similar divisibility properties to factorials, but unlike factorials they are squarefree. As with the
factorial prime A factorial prime is a prime number A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a compos ...
s researchers have studied primorial primes ;Subfactorial :The
subfactorial In combinatorial mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, change (mathematical analysis ...
yields the number of
derangement In combinatorial Combinatorics is an area of mathematics Mathematics (from Ancient Greek, Greek: ) includes the study of such topics as quantity (number theory), mathematical structure, structure (algebra), space (geometry), and calculus, ...
s of a set of $n$ objects. It is sometimes denoted $!n$, and equals the closest integer ;Superfactorial :The superfactorial of $n$ is the product of the first $n$ factorials. The superfactorials are continuously interpolated by the Barnes G-function.