Published: May 14 2013 / 18:50
for 1000! numbers contributing to zeroes are: numbers ending with 0, 00 and 000: 111 and numbers ending with 2 multiply by numbers ending with 5: 100; total 211.
I'm afraid but you're missing quite a few zeros this way! There are three correct solutions in my post.
the variable count would return 248???
In the script posted by Jay, make sure count is set to 0 before you run the code and n is equal to 1000. I get something different but you are very close ;-)
i think it will return 249??
Yes, 249 is the correct result!
The problem is slightly more complicated than expected, without of course computing the 2560+ digits of 1000!
Yes, the problem is a bit tricky but I managed to figure it out and thought I'd try the brute-force way too ;-)
Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.