Re: discrete math, how many zeroes in 125!
- To: mathgroup at smc.vnet.net
- Subject: [mg13467] Re: discrete math, how many zeroes in 125!
- From: "Allan Hayes" <hay at haystack.demon.cc.uk>
- Date: Sun, 26 Jul 1998 02:33:30 -0400
- References: <6p6rjm$5lk@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Timothy Anderson wrote in message <6p6rjm$5lk at smc.vnet.net>... >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 > I assume that you mean the zeroes at the end. Here are two ways - I change 125 to 1250 to ccompare speeds Min[Cases[FactorInteger[1250!], {2|5, n_}->n]]//Timing {1.48 Second, 312} Position[Reverse[IntegerDigits[1250!]],Alternatives@@Range[9], {1},1][[1,1]]-1//Timing {0.28 Second, 312} ------------------------------------------------------------- Allan Hayes Training and Consulting Leicester UK http://www.haystack.demon.co.uk hay at haystack.demon.co.uk voice: +44 (0)116 271 4198 fax: +44(0)116 271 8642