In number theory, de Polignac's formula, named after Alphonse de Polignac, gives the prime decomposition of the factorial n!, where n ≥ 1 is an integer. L. E. Dickson attributes the formula to Legendre.
The formula
Let n ≥ 1 be an integer. The prime decomposition of n! is given by
where
and the brackets represent the floor function. The former product only needs to be taken for primes less than or equal to n, so the latter sum only needs to be taken for j ranging from 1 to floor( logp(n) ), i.e.:
The small disadvantage of the De Polignac's formula is that we need to know all the primes up to n. In fact,
where