Factorial
✖
Factorial
gives the factorial of n.
Details

- Mathematical function, suitable for both symbolic and numerical manipulation.
- For non‐integer n, the numerical value of n! is given by Gamma[1+n].
- For integers and half integers, Factorial automatically evaluates to exact values.
- Factorial can be evaluated to arbitrary numerical precision.
- Factorial automatically threads over lists.
- Factorial can be used with Interval and CenteredInterval objects. »
Background & Context
- Factorial represents the factorial function. In particular, Factorial[n] returns the factorial
of a given number
, which, for positive integers, is defined as
. For n1,2,…, the first few values are therefore 1,2,6,24,120,720,…. The special case
is defined as 1, consistent with the combinatorial interpretation of there being exactly one way to arrange zero objects. For a general complex number
,
, where the Gamma function
is defined by
for all complex values of
except when
is a negative integer (in which case
is complex infinity). Factorials of half integers are given by rational multiples of
.
- Factorials are best known for counting fixed orderings of the elements of a list, known as permutations, which can be generated using Permutations. There are
permutations of a list of
(distinct) elements, a fact that follows from there being
spots to place the first element,
spots to place the second element once the first is placed,
spots to place the third element once the first two elements are placed and so on until a single spot remains in which to place the last element. There are therefore
permutations of
, namely
,
,
,
,
and
.
- More generally, for an
-element multiset having
distinct elements with
copies of the
distinct element (so
), the number of permutations equals the multinomial coefficient
, given by Multinomial. The multinomial coefficient
also counts the ways to partition an
-element set into
labeled subsets of sizes n1,…,nk. Hence the binomial coefficient
, given by Binomial and defined to count the
-element subsets of an
-element set, satisfies
.
- The factorial function satisfies the recurrences
and
. It grows faster than any exponential function, as shown by Stirling's approximation
. Factorials also appear in fundamental results in number theory and analysis. Wilson's theorem states that
if and only if
is prime. If
is an infinitely differentiable scalar function, then its Taylor series representation about a point
(computable using Series) is given by
. Setting
and
in the Taylor series of the exponential function
yields the beautiful identity for E (the base of the natural logarithm)
.
- Other functions associated with or generalizing Factorial include Factorial2, FactorialPower,
, QFactorial, BarnesG and Pochhammer.
Examples
open allclose allBasic Examples (7)Summary of the most common use cases
Compute the factorial for the first few integers:

https://wolfram.com/xid/0lddmma-bx2b22


https://wolfram.com/xid/0lddmma-e2pfyq


https://wolfram.com/xid/0lddmma-1tb0k

Plot over a subset of the reals:

https://wolfram.com/xid/0lddmma-gi13sj

Plot over a subset of the complexes:

https://wolfram.com/xid/0lddmma-kiedlx

Series expansion at the origin:

https://wolfram.com/xid/0lddmma-ej957w

Series expansion at Infinity:

https://wolfram.com/xid/0lddmma-cugjvu

Series expansion at a singular point:

https://wolfram.com/xid/0lddmma-ii6s9p

Scope (34)Survey of the scope of standard use cases
Numerical Evaluation (6)

https://wolfram.com/xid/0lddmma-l274ju


https://wolfram.com/xid/0lddmma-whe1w


https://wolfram.com/xid/0lddmma-b0wt9

The precision of the output tracks the precision of the input:

https://wolfram.com/xid/0lddmma-y7k4a


https://wolfram.com/xid/0lddmma-hfml09

Evaluate efficiently at high precision:

https://wolfram.com/xid/0lddmma-di5gcr


https://wolfram.com/xid/0lddmma-bq2c6r

Compute worst-case guaranteed intervals using Interval and CenteredInterval objects:

https://wolfram.com/xid/0lddmma-gnclzo


https://wolfram.com/xid/0lddmma-dtvr5v

Or compute average-case statistical intervals using Around:

https://wolfram.com/xid/0lddmma-cw18bq

Compute the elementwise values of an array:

https://wolfram.com/xid/0lddmma-thgd2

Or compute the matrix Factorial function using MatrixFunction:

https://wolfram.com/xid/0lddmma-o5jpo

Specific Values (5)
Values of Factorial at fixed points:

https://wolfram.com/xid/0lddmma-nww7l


https://wolfram.com/xid/0lddmma-e41pf2


https://wolfram.com/xid/0lddmma-gxbgq


https://wolfram.com/xid/0lddmma-cndv4n

Evaluate for half-integer arguments:

https://wolfram.com/xid/0lddmma-c6yk4v

Find the positive minimum of Factorial[x]:

https://wolfram.com/xid/0lddmma-f2hrld


https://wolfram.com/xid/0lddmma-cj5txq

Visualization (2)
Plot the Factorial function:

https://wolfram.com/xid/0lddmma-ecj8m7


https://wolfram.com/xid/0lddmma-ouu484


https://wolfram.com/xid/0lddmma-fz1xl5

Function Properties (10)

https://wolfram.com/xid/0lddmma-cl7ele


https://wolfram.com/xid/0lddmma-de3irc

Factorial threads elementwise over lists:

https://wolfram.com/xid/0lddmma-c3oe4

The factorial has the mirror property :

https://wolfram.com/xid/0lddmma-heoddu

Factorial is not an analytic function:

https://wolfram.com/xid/0lddmma-gva6yl

However, it is a meromorphic function in the complex plane:

https://wolfram.com/xid/0lddmma-vflufa

Factorial is neither nondecreasing nor nonincreasing:

https://wolfram.com/xid/0lddmma-2ra8g

Factorial is not injective:

https://wolfram.com/xid/0lddmma-c9npzh


https://wolfram.com/xid/0lddmma-b5buvp

Factorial is not surjective:

https://wolfram.com/xid/0lddmma-patce


https://wolfram.com/xid/0lddmma-bcrbvs

Factorial is neither non-negative nor non-positive:

https://wolfram.com/xid/0lddmma-dvzykj

Factorial has both singularity and discontinuity for negative integers:

https://wolfram.com/xid/0lddmma-fyfbxx


https://wolfram.com/xid/0lddmma-5vh4e

Factorial is neither convex nor concave:

https://wolfram.com/xid/0lddmma-l0srvu

Differentiation (2)
Series Expansions (5)
Find the Taylor expansion using Series:

https://wolfram.com/xid/0lddmma-ewr1h8

Plots of the first three approximations around :

https://wolfram.com/xid/0lddmma-binhar

Find the series expansion at Infinity (Stirling's approximation):

https://wolfram.com/xid/0lddmma-syq


https://wolfram.com/xid/0lddmma-b5vva5


https://wolfram.com/xid/0lddmma-bf2qwg

Find series expansion for an arbitrary symbolic direction :

https://wolfram.com/xid/0lddmma-t5t

Taylor expansion at a generic point:

https://wolfram.com/xid/0lddmma-jwxla7

Recurrence Identities and Simplifications (2)
Function Representations (2)
Integral representation of the factorial function:

https://wolfram.com/xid/0lddmma-kgkzwa

TraditionalForm formatting:

https://wolfram.com/xid/0lddmma-ppzpg3

Generalizations & Extensions (4)Generalized and extended use cases

https://wolfram.com/xid/0lddmma-mn7jd8

The precision of the output tracks the precision of the input:

https://wolfram.com/xid/0lddmma-b40evc

Infinite arguments give symbolic results:

https://wolfram.com/xid/0lddmma


https://wolfram.com/xid/0lddmma

Factorial allows derivatives:

https://wolfram.com/xid/0lddmma-ensplw

Applications (6)Sample problems that can be solved with this function
Make a table of half-integer factorials:

https://wolfram.com/xid/0lddmma-f8vy62

Number of permutations of 6 elements:

https://wolfram.com/xid/0lddmma


https://wolfram.com/xid/0lddmma

Plot of the absolute value of Factorial in the complex plane:

https://wolfram.com/xid/0lddmma-fnm8z0

Find the asymptotic expansion of ratios of factorials:

https://wolfram.com/xid/0lddmma

Volume of an n‐dimensional unit hypersphere:

https://wolfram.com/xid/0lddmma

Low‐dimensional cases:

https://wolfram.com/xid/0lddmma

Plot the volume of the unit hypersphere as a function of dimension:

https://wolfram.com/xid/0lddmma

Find the series expansion at -∞:

https://wolfram.com/xid/0lddmma-bsrx9a


https://wolfram.com/xid/0lddmma-kyip1d

Properties & Relations (9)Properties of the function, and connections to other functions
Use FullSimplify to simplify expressions involving Factorial:

https://wolfram.com/xid/0lddmma-eezh32

Compute a generating function sum involving Factorial:

https://wolfram.com/xid/0lddmma-gqn7vx

Compute numerical sums involving Factorial:

https://wolfram.com/xid/0lddmma


https://wolfram.com/xid/0lddmma

The generating function is divergent:

https://wolfram.com/xid/0lddmma-vlcl6


Use regularization to obtain a closed-form generating function:

https://wolfram.com/xid/0lddmma-dltyxn


https://wolfram.com/xid/0lddmma-c6fcia

Generating function as a formal series:

https://wolfram.com/xid/0lddmma-b2m5tf


https://wolfram.com/xid/0lddmma-b3ros8


https://wolfram.com/xid/0lddmma-dwxqsh


https://wolfram.com/xid/0lddmma-flehi8


https://wolfram.com/xid/0lddmma-i6cllf

Factorial can be represented as a DifferenceRoot:

https://wolfram.com/xid/0lddmma-pxkma

FindSequenceFunction can recognize the Factorial sequence:

https://wolfram.com/xid/0lddmma-hj2mn6


https://wolfram.com/xid/0lddmma-5okec

The exponential generating function for Factorial:

https://wolfram.com/xid/0lddmma-gaiyeu

Possible Issues (2)Common pitfalls and unexpected behavior
Large arguments can give results too large to be computed explicitly, even approximately:

https://wolfram.com/xid/0lddmma-b18m9u



https://wolfram.com/xid/0lddmma-bqnowb

Machine-number inputs can give high‐precision results:

https://wolfram.com/xid/0lddmma


https://wolfram.com/xid/0lddmma

Neat Examples (3)Surprising or curious use cases

https://wolfram.com/xid/0lddmma-j4hze

Nested factorials over the complex plane:

https://wolfram.com/xid/0lddmma

Plot Factorial at infinity:

https://wolfram.com/xid/0lddmma

Wolfram Research (1988), Factorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Factorial.html (updated 2022).
Text
Wolfram Research (1988), Factorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Factorial.html (updated 2022).
Wolfram Research (1988), Factorial, Wolfram Language function, https://reference.wolfram.com/language/ref/Factorial.html (updated 2022).
CMS
Wolfram Language. 1988. "Factorial." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Factorial.html.
Wolfram Language. 1988. "Factorial." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/Factorial.html.
APA
Wolfram Language. (1988). Factorial. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Factorial.html
Wolfram Language. (1988). Factorial. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Factorial.html
BibTeX
@misc{reference.wolfram_2025_factorial, author="Wolfram Research", title="{Factorial}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/Factorial.html}", note=[Accessed: 24-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_factorial, organization={Wolfram Research}, title={Factorial}, year={2022}, url={https://reference.wolfram.com/language/ref/Factorial.html}, note=[Accessed: 24-May-2025
]}