Problem 51950. Find the smallest integer m such that n divides m!
Write a function that takes an integer n and finds the smallest integer m whose factorial is divisible by n. For example, if
, then the smallest factorial that is a multiple of n is 5! = 120; therefore,
.
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
ChrisR
on 3 Jun 2021
David, you are correct for Kempner(1535238), but that test asks for Kempner(Kempner(Kempner(1535238))).
Rafael S.T. Vieira
on 25 Nov 2022
Unfortunately, it does not stop lookup tables since 134 factors to 2 and 67, which means it obtains the same result as a lookup table. Kempner(Kempner(Kempner(1535238))) will do 134 -> 67 -> 67 and a lookup table 67->67->67.
Rafael S.T. Vieira
on 25 Nov 2022
May I suggest using Kempner(Kempner(Kempner(123456787654321))+10) as a test against lookup tables?
Solution Comments
Show commentsGroup

Sequences & Series V
- 16 Problems
- 5 Finishers
- Solve a nonlinear difference equation
- Iterate the sum of divisors and totient
- Sum the elements in rows of the Levine triangle
- Find the smallest integer m such that n divides m!
- Identify Ruth-Aaron numbers
- Find numbers in the Popular Computing Z-sequence
- Find the nth nude number
- Determine whether a number is a fibodiv number
- List modest numbers up to n
- List the vile numbers
- List the dopey numbers
- Compute the Sequence of the Day
- Classify product/digit-sum sequences
- Count unique orderings of vertices of a polygon
- Count the ways to draw non-intersecting chords between points on a circle
- Fill a rectangle with 1x1 and 2x2 tiles
Problem Recent Solvers15
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!