The last non-zero digit of a factorial - MATLAB Cody - MATLAB Central

Problem 44067. The last non-zero digit of a factorial

Difficulty:Rate

For given positive integer n, what is the last non-zero digit of n!?

Example: factorial(11) = 39916800

Last non-zero digit is 8.

Optional: Can you make an efficient algorithm for very large n?

Solution Stats

68.75% Correct | 31.25% Incorrect
Last Solution submitted on Apr 20, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers71

Suggested Problems

More from this Author9

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page