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

82.5% Correct | 17.5% Incorrect
Last Solution submitted on Sep 08, 2024

Problem Comments

Solution Comments

Show comments
R2025a Pre-release highlights
This topic is for discussing highlights to the current R2025a Pre-release.
18
8

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