multiplication of all odd number from 1 to 1 milion

84 Views Asked by At

I'm trying to find the third digit in a multiplication of all odd numbers from $1$ to $1$ milion.

I found that the formula is:

Product of the first $N$ odd numbers : $\frac{(2N)!}{(2N\cdot N!)}$

This is what I'm trying: 1*3*5*7*11*13...999999

1

There are 1 best solutions below

0
On BEST ANSWER

There are $500,000$ odd numbers. $125,000$ of them are equivalent to $1,3,5,7 \mod 8$.

So the product is equiv to $1*3^{125,000}*5^{125,000}*7^{125,000}\equiv 1 \mod 8$.

Now more than three of these numbers are multiples of $5$ so the product is equivalent to $0 \mod 125$.

$125 \equiv 5 \mod 8$ but $5*125=625 \equiv 1 \mod 8$.

By Chinese remainder theorem this is the only solution mod $1000$.

So the last three digits are $625$