For a nn, the factorial of nn is

n!=j=1nj=12n,n!=\prod_{j=1}^{n}j=1\cdot2\cdots n,

with the empty-product convention 0!=10!=1. It satisfies the recursion (n+1)!=(n+1)n!(n+1)!=(n+1)n!.

Factorials encode the prime multiplicities accumulated in an initial interval. For a prime pp, Legendre's formula gives

vp(n!)=r1npr,v_p(n!)=\sum_{r\ge1}\left\lfloor\frac{n}{p^r}\right\rfloor,

where only finitely many summands are nonzero and vpv_p is the .