document.write( "Question 771895: give a procedure for determining the number of zeros at the end of n!.justify your procedure. \n" ); document.write( "
Algebra.Com's Answer #470554 by Edwin McCravy(20055)\"\" \"About 
You can put this solution on YOUR website!
give a procedure for determining the number of zeros at the end of n!.justify your procedure.
\n" ); document.write( "
\r\n" );
document.write( "We will use the \"floor\" function indicated by  ⌊x⌋ to denote the largest\r\n" );
document.write( "integer that does not exceed x.  Sometimes this is indicated by int(x).\r\n" );
document.write( "\r\n" );
document.write( "A factorial is a product of integers.  The only thing that will cause a \r\n" );
document.write( "zero at the end of a product of integers is a factor of 10, which is a \r\n" );
document.write( "pair of factors 2·5.\r\n" );
document.write( "\r\n" );
document.write( "n! = 1·2·3·4·5·6···n\r\n" );
document.write( "\r\n" );
document.write( "There are a lot more factors of 2 contained in the members of the sequence \r\n" );
document.write( "\r\n" );
document.write( "1,2,3,4,5,6,...,n \r\n" );
document.write( "\r\n" );
document.write( "than there are multiples of 5 contained in them.  So there will always be enough \r\n" );
document.write( "factors of 2 in n! to pair up with every factor of 5 in n! to cause the pair to\r\n" );
document.write( "make a factor of 10 causing another zero at the end of 5! \r\n" );
document.write( "\r\n" );
document.write( "So we only need to count the total number of 5 factors contained in all the members \r\n" );
document.write( "of the sequence\r\n" );
document.write( "\r\n" );
document.write( "1,2,3,4,5,6,...,n \r\n" );
document.write( "\r\n" );
document.write( "Each multiple of 51 contributes a 1st 5 factor.\r\n" );
document.write( "\r\n" );
document.write( "There are n/⌊\"n%2F%285%5E1%29\"⌋ of those. Of those,\r\n" );
document.write( "\r\n" );
document.write( "each multiple of 52 contributes a 2nd 5 factor.  \r\n" );
document.write( "\r\n" );
document.write( "There are n/ ⌊\"n%2F%285%5E2%29\"⌋ of those. Of those,\r\n" );
document.write( "\r\n" );
document.write( "each multiple of 53 contributes a 3rd 5 factor.\r\n" );
document.write( "\r\n" );
document.write( "There are n/ ⌊\"n%2F%285%5E3%29\"⌋ of those. Of those,\r\n" );
document.write( "...\r\n" );
document.write( "\r\n" );
document.write( "n/ ⌊\"n%2F%285%5Ek%29\"⌋ will become 0 when 5k\r\n" );
document.write( "exceeds n.  \r\n" );
document.write( "\r\n" );
document.write( "So the number of 0's at the end of n! is\r\n" );
document.write( "\r\n" );
document.write( "⌊\"n%2F%285%5E1%29\"⌋ + ⌊\"n%2F%285%5E2%29\"⌋ + ⌊\"n%2F%285%5E3%29\"⌋ + ... + ⌊\"n%2F%285%5EM%29\"⌋, \r\n" );
document.write( "\r\n" );
document.write( "where M is the largest power of 5 that does not exceed n, or even\r\n" );
document.write( "larger since values of k > M will all be 0.\r\n" );
document.write( "\r\n" );
document.write( "We can calculate M, which is the largest value of k such that\r\n" );
document.write( "\r\n" );
document.write( "5k ≦ n\r\n" );
document.write( "\r\n" );
document.write( "ln(5k) ≦ n\r\n" );
document.write( "\r\n" );
document.write( "k·ln(5) ≦ n\r\n" );
document.write( "\r\n" );
document.write( "      k ≦ \"n%2Fln%285%29\"\r\n" );
document.write( "\r\n" );
document.write( "So M = ⌊\"n%2Fln%285%29\"⌋\r\n" );
document.write( "\r\n" );
document.write( "You can write the result as a summation:\r\n" );
document.write( "\r\n" );
document.write( "Number of 0's at end of n! = \"sum%28%22%22%2Ck=1%2CM%29\"\"n%2F%285%5Ek%29\"⌋, where M = ⌊\"n%2F%28ln%285%29%29\"⌋ \r\n" );
document.write( "\r\n" );
document.write( "Edwin
\n" ); document.write( "
\n" );