Given an integer n and a number base b, write a function that calculates the number of trailing zeros of the factorial of n when written in base-b.
For example, for and , the function should return 5, because:
>> dec2base(factorial(15),4)
>> '103001313131311200000'
For and , the function should return 4.
>> dec2base(factorial(10),12)
>> '1270000'

Solution Stats

10 Solutions

5 Solvers

Last Solution submitted on Jul 31, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers5

Suggested Problems

More from this Author116

Community Treasure Hunt

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

Start Hunting!