Lovefilm, yes or no?
Abigail
abigail at abigail.be
Wed Apr 14 18:29:36 BST 2010
On Wed, Apr 14, 2010 at 09:47:14AM -0700, David Alban wrote:
> On Wed, Apr 14, 2010 at 9:36 AM, Merijn Broeren <merijnb at iloquent.com> wrote:
> > Does 128! end in a zero? If so, how many?
>
> i would think that any factorial N! would end in zero if N > 9. but i
> have no idea how many zeroes are at the end of <128!>.
5! multiples 2 and 5.
The trick is to count the number of factors of 5.
floor (128 / 5) + floor (128 / 25) + floor (128 / 125) = 25 + 5 + 1 = 31.
$ perl -E'$,="*";say 1..128'|bc|perl -0ne's/\D+//g;print/0+$/g'|wc -c
31
Abigail
More information about the london.pm
mailing list