14.
 
There is a neat trick you can use with any factorial to know the number of 
zeroes at the end. All the zeros come from multiples of 10=2*5.
There are a lot of 2s in the prime factors of 60!, so you only need to find all 
the multiples of 5 because you'll have as many zeroes at the end as factors of 
5. 
 
To find the factors that are multiples of 5 just keep dividing by 5 until you 
get to a number below 1, discard all the decimals and add all the integers, 
like so:
 
60/5 = 12   (the 12 factors are: 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60)
12/5 = 2.4  (the next 2 factors are: 25 and 50. Yes they count twice because 
they have 2 fives as factors: 25=5*5, 50=5*5*2)
 
Answer 12+2 = 14. There are 14 zeroes at the end of 60!.
 
By the way, if you google for it you will find the number, and it does indeed 
have 14 zeroes at the end! :-)
 
Not all problems requires a program. Happy coding!
Z

________________________________

From: java-ee-j2ee-programming-with-passion@googlegroups.com 
[mailto:java-ee-j2ee-programming-with-pass...@googlegroups.com] On Behalf Of 
ANUJ KUMAR
Sent: sábado, 18 de Julho de 2009 22:01
To: java-ee-j2ee-programming-with-passion@googlegroups.com
Subject: [java ee programming]


how many zero's are there at the end of 60 factorial



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Java EE (J2EE) Programming with Passion!" group.
To post to this group, send email to
java-ee-j2ee-programming-with-passion@googlegroups.com
To unsubscribe from this group, send email to
java-ee-j2ee-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to