how (a!)/(b!) = (b + 1)×(b + 2)×⋯×(a − 1)×a

64 Views Asked by At

I was solving a problem in which i need to figure out the prime factorization of $\frac{a!}{b!}$ and i did that by computing (a!) and then (b!) by looping ((1 to a) & (1 to b)) and then derived n by dividing them ($n = \frac{a!}{b!}$) and then prime factors of n, but it gives me to TLE(Time limit exceeded) so i refered editorial and in editorial they describe an alternate method , they says factorization of number $\frac{a!}{b!}$ is this same as factorization of numbers $(b + 1)\times(b + 2)\times \cdots\times (a - 1)\times a$.

I am unable to figure out how

$\frac{a!}{b!}$ == $(b + 1)\times(b + 2)\times \cdots\times (a - 1)\times a$ ?

3

There are 3 best solutions below

4
On BEST ANSWER

Assume $a > b$. Then:

$$\frac{a!}{b!} = \frac{a(a-1)(a-2) \cdots (b+1) \cdot (b)(b-1)(b-2) \cdots (3)(2)(1)}{b(b-1)(b-2) \cdots (3)(2)(1)}$$ $$= \frac{a(a-1)(a-2) \cdots (b+1) \cdot \require{cancel} \cancel{(b)(b-1)(b-2) \cdots (3)(2)(1)}}{\cancel{(b(b-1)(b-2) \cdots (3)(2)(1)}}$$

Do you see how this works?

0
On

Expand the factorial!

If $a!/b!$ is factorable at all, it is greater than one, so it follows that $a>b$.

Note that $a!=(a)(a-1)(a-2)\cdots(2)(1)$ can now be faithfully expressed as $a!=(a)(a-1)\cdots(b+1)(b)(b-1)\cdots(2)(1)$

And just divide through.

Hopefully this helps!

2
On

"I am unable to figure out how":

  • observe that the product is made of consecutive integer factors up to $a$;

  • recall that a factorial is a product of consecutive integers;

  • see that the product is a subproduct of $a!$;

  • understand that the missing factors are precisely those of $b!$;

  • conclude.

Observation of the patterns is the key.