Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: discrete math, how many zeroes in 125!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg13484] Re: [mg13418] discrete math, how many zeroes in 125!
  • From: BobHanlon at aol.com
  • Date: Sun, 26 Jul 1998 02:33:43 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

zeroes[(n_Integer)?NonNegative] := Plus @@ 
	Cases[Flatten[FactorInteger /@ 
	Table[k, {k, 5, n, 5}], 1], {5, m_} :> m]; 

zeroes2[(n_Integer)?NonNegative] := 
   Cases[FactorInteger[n!], {5, m_} :> m][[1]]; 

SetOptions[NumberForm, DigitBlock -> 5, 
   NumberSeparator -> "  "]; 

n = 125; zeroes[n]

NumberForm[n!]

To compare timing:

TableForm[Table[{n=125k, Timing[zeroes[n]], 
    Timing[zeroes2[n]]}, {k, 1, 15, 2}]]

Bob Hanlon

In a message dated 7/23/98 5:58:55 AM, trafh at AOL.com wrote:

>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


  • Prev by Date: Re: polar coordinates
  • Next by Date: Re: Re: discrete math, how many zeroes in 125!
  • Previous by thread: Re: discrete math, how many zeroes in 125!
  • Next by thread: Re: Re: discrete math, how many zeroes in 125!