ellenckh wrote:
Hi, I have a question about the formula for trailing zeros. The example gives us something like 32, which cannot be wholly divided by 5. However, if our number is something like 350, where 5 is a factor of 350, can we still use 5 in the formula? In this case, wouldn't it be that the number of 2 is not equal to the number of 5 any more?
The factorial of a positive integer n, denoted by n!, is composed of the product of integers from 1 to n: n! = 1*2*3*4*5*... Since half of these integers are even, while only one-fifth of the integers are multiples of 5, the power of 2 in n! is always greater than the power of 5 (for n > 1). To calculate the number of trailing zeros in n!, we need to find the power of 5 in prime factorization of n!, since for each 5, there will always be a corresponding 2 in n!, to multiply with it and produce a trailing zero.
For example, the number of trailing zeros in 350! is 86, because the power of 5 in prime prime factorization of n! is 86.
350/5 + 350/25 + 350/125 = 70 + 14 + 2 = 86 (remember to consider only the quotient of the division).
However, the power of 2 in prime prime factorization of n! is 344:
350/2 + 350/4 + 350/8 + 350/16 + 350/32 + 350/64 + 350/128 + 350/256 = 175 + 87 + 43 + 21 + 10 + 5 + 2 + 1 = 344 (remember to consider only the quotient of the division).
Factoring 350! gives:
2^344*3^171*
5^86*7^58*11^33*13^28*17^21*19^18*23^15*29^12*31^11*37^9*41^8*43^8*47^7*53^6*59^5*61^5*67^5*71^4*73^4*79^4*83^4*89^3*97^3*101^3*103^3*107^3*109^3*113^3*127^2*131^2*137^2*139^2*149^2*151^2*157^2*163^2*167^2*173^2*179*181*191*193*197*199*211*223*227*229*233*239*241*251*257*263*269*271*277*281*283*293*307*311*313*317*331*337*347*349
Notice that the power of 2 (344) is higher than the power of 5 (86). Additionally, note that the number of trailing zeros in 350! is equal to the power of 5 in its prime factorization.
Hope it helps.