5 kyu
Number of trailing zeros of N!
146 of 56,955Ivan Diachenko
Description:
Write a program that will calculate the number of trailing zeros in a factorial of a given number.
N! = 1 * 2 * 3 * ... * N
Be careful 1000!
has 2568 digits...
For more info, see: http://mathworld.wolfram.com/Factorial.html
Examples
N | Product | N factorial | Trailing zeros |
---|---|---|---|
6 |
1*2*3*4*5*6 |
720 |
1 |
12 |
1*2*3*4*5*6*7*8*9*10*11*12 |
479001600 |
2 |
Hint: You're not meant to calculate the factorial. Find another way to find the number of zeros.
Algorithms
Logic
Mathematics
Similar Kata:
Stats:
Created | Feb 9, 2014 |
Published | Feb 9, 2014 |
Warriors Trained | 128362 |
Total Skips | 24297 |
Total Code Submissions | 346641 |
Total Times Completed | 56955 |
CoffeeScript Completions | 146 |
JavaScript Completions | 13249 |
Ruby Completions | 1735 |
Haskell Completions | 1074 |
Clojure Completions | 331 |
Python Completions | 21055 |
Java Completions | 8664 |
C# Completions | 3515 |
Objective-C Completions | 25 |
C++ Completions | 4585 |
C Completions | 2061 |
R Completions | 149 |
NASM Completions | 31 |
Rust Completions | 1199 |
Groovy Completions | 48 |
Scala Completions | 316 |
Prolog Completions | 25 |
F# Completions | 46 |
Crystal Completions | 19 |
COBOL Completions | 13 |
Go Completions | 658 |
Lua Completions | 109 |
Factor Completions | 13 |
Swift Completions | 175 |
D Completions | 15 |
OCaml Completions | 38 |
Julia Completions | 18 |
Total Stars | 2288 |
% of votes with a positive feedback rating | 84% of 4869 |
Total "Very Satisfied" Votes | 3611 |
Total "Somewhat Satisfied" Votes | 924 |
Total "Not Satisfied" Votes | 334 |