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 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

81.08% Correct | 18.92% Incorrect
Last Solution submitted on Nov 03, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers27

Suggested Problems

More from this Author241

Community Treasure Hunt

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

Start Hunting!