Re: Re: discrete math, how many zeroes in 125!

*To*: mathgroup at smc.vnet.net*Subject*: [mg13483] Re: [mg13440] Re: [mg13418] discrete math, how many zeroes in 125!*From*: Robert Pratt <rpratt at math.unc.edu>*Date*: Sun, 26 Jul 1998 02:33:42 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Just to clarify the problem, I believe Tim wants the number of TERMINAL zeroes in 125! Jurgen interpreted the problem as asking for the number of zeroes that appear ANYWHERE among the digits. While Ken's idea below works in theory, my copy of Mathematica doesn't evaluate the infinite sum unless I change "Sum to "NSum". If we help Mathematica out by telling it the upper value of the index k is Floor[Log[p,n]] instead of Infinity, Sum works fine. It's also faster, although the (NSum, Infinity) method was already pretty fast to begin with. > If p is a prime, the number of factors of p in n! is equal to > Sum[Floor[n/(p^k)],{k,1,Infinity}]. The sum is finite since all but a > finite number of terms are zero. Since there are plenty of 2's in > 125!, you need only count the 5's. > > how can I solve this problem by counting the factors of 2 and 5 without > > doing each factor individually? thanks for any real quick help! Tim Rob Pratt Department of Mathematics The University of North Carolina at Chapel Hill CB# 3250, 331 Phillips Hall Chapel Hill, NC 27599-3250 rpratt at math.unc.edu http://www.math.unc.edu/Grads/rpratt/