Course


Big Factorial

Learn factorials

Factorials

How can we compute the factorial of big numbers? Here is a code that can show the factorials up to 1000. We pre-calculate all the 1000th factorials in a two dimensional array. In the main function just takes input and then just print.

C++ (GCC 9.2.0)
  • Input  

Factorial Frequencies

Now how many digits in the factorial of N numbers..? Yes we can count them by the above process. But we can do it simply!

C++ (GCC 9.2.0)
  • Input  

How many trailing zeros in Factorials ?

We know that factorials of any number has so many zeros (0’s) at last…example 17! = 355687428096000. It has 3 last zero digits. So we now see how many trailing zeros have in N factorials.

C++ (GCC 9.2.0)
  • Input