5

I came across a problem of how to calculate total number of divisors of factorial of a number. I know that total number of divisor of a number $n= p_1^a p_2^b p_3^c $ is $(a+1)*(b+1)*(c+1)$ where $a,b,c$ are the powers of a number $n$ and $1<n<100000$. But how to calculate total number of divisiors for $n!$

DCoder
  • 278

2 Answers2

6

Just an addition to Ross Millikan's answer:

Remember that the highest power of a prime $p$ dividing $n!$ is given by the procedure:

  1. Greatest integer less than or equal to $\frac{n}{p}$
  2. Greatest integer less than or equal to $\frac{n}{p^2}$
  3. Greatest integer less than or equal to $\frac{n}{p^3}$
  4. Repeat until the greatest integer less than or equal to $\frac{n}{p^k}$ is $0$.
  5. Add all of your numbers up!

Example: Power of $3$ in the factorization of $100!$:

  1. Greatest integer less than or equal to $\frac{100}{3}$ is $33$
  2. Greatest integer less than or equal to $\frac{100}{3^2}$ is $11$
  3. Greatest integer less than or equal to $\frac{100}{3^3}$ is $3$
  4. Greatest integer less than or equal to $\frac{100}{3^4}$ is $1$
  5. Greatest integer less than or equal to all the fractions after this is zero: $\frac{100}{3^5} > \frac{100}{3^6} > \cdots$
  6. Add: $33 + 11 + 3 + 1 = 48$.

I would assume you would do this for every prime under $n$ and use the formula in Ross's answer.

Ant
  • 2,407
5

You have to assess the powers of all the primes less than $n$ in $n!$ and use the formula you cite. For example, $8!=40320=2^7\cdot3^2\cdot 5 \cdot 7$, so it has $(7+1)(2+1)(1+1)(1+1)=96$ factors. The way to calculate the power of the primes is given here

Ross Millikan
  • 374,822