FiSGO.PIrrepsSearch.factorial_factor

factorial_factor(n, p)[source]

An implementation of Legendre’s formula to compute the largest power of p dividing n!.

The formula is:

\[\nu_p(n!) = \sum_{i=1}^{\infty} \lfloor \frac{n}{p^{i}}\rfloor\]
Parameters:
  • n (int) – value of n whose factorial is to be checked.

  • p (int) – prime number.

Return type:

int

Returns:

the largest power of p that divides n!.