Friday, October 12, 2007

General Knowledge Questions for Interview

100 factorial aha:!

how many trailing zeroes are there in 100! (100 factorial)?










solution: 100 factorial

One per factor of 10, and one per factor of 5 (there are more than enough 2's to pair with the 5's), plus one per factor of ten squared (one occurrence) and one per factor of 5 squared (three occurrences).

So if I'm counting correctly, that'd be 10 + 10 + 1 + 3== 24 zeroes.

Assuming the question meant *trailing* zeroes. It'd be much harder to also count the intermingled zero digits in the entire expansion.

No comments: