Problem 46054. Count trailing zeros in a primorial
Cody Problem 44068 asked us to count the trailing zeros in a factorial. This problem deals with the primorial. If is the nth prime number, then the primorial # is the product of the prime numbers up to and including . For example, if n = 5, then # = = 2310, which has one trailing zero.
Count the trailing zeros in the primorial #. Because primorials become large quickly, for large n it helps to derive a formula for the number of trailing zeros.*
Please make your code general because I might add more tests later.
See also Cody Problems 46057 "Find the last non-zero digit in a primorial" and 46060 "Identify primorial primes".
*;-)
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers29
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15587 Solvers
-
1229 Solvers
-
Fix the last element of a cell array
1528 Solvers
-
263 Solvers
-
740 Solvers
More from this Author282
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!