Count trailing zeros in a primorial - MATLAB Cody - MATLAB Central

Problem 46054. Count trailing zeros in a primorial

Difficulty:Rate
Cody Problem 44068 asked us to count the trailing zeros in a factorial. This problem deals with the primorial. If p_n is the nth prime number, then the primorial p_n# is the product of the prime numbers up to and including p_n. For example, if n = 5, then p_5# = 2*3*5*7*11 = 2310, which has one trailing zero.
Count the trailing zeros in the primorial p_n#. 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.
*;-)

Solution Stats

78.57% Correct | 21.43% Incorrect
Last Solution submitted on Feb 26, 2025

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
3
5

Problem Recent Solvers29

Suggested Problems

More from this Author291

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page