02:38

How many number of zeros in factorial of a given number?

let n be the given number.
Z be the no of zero's in n!.

n!=n*(n-1)*(n-2)...*1.


if n=18
18!=18*17*16*15*14*13*12*11*10*.................*1.

simply, z=no of 5's in the n!

18*=18*17*16*(5*3)*14*13*12*11*(5*2)*........*5*........*1.

no/- of 5's in 18! are 3.

actually, 18!=6402373705728000. (so, 
it's correct.)


Direct formula :

Z=(n/5)+(n/5^2)+(n/5^3)+......+(n/5^(k-1)).


where (n/5^k)=0.                                       


here, what i am doing is just adding exponents of 5 in n! expansion.
just remember this:

zero's in n!= highest power of 5 in n! expansion.

0 comments: