← Back to challenges

The Smallest Number

JavaScriptHardmathnumbers

Instructions

Given a positive integer n, implement a function that finds the smallest number that is evenly divisible by the integers 1 through n inclusive.

Examples

smallest(1) ➞ 1

smallest(5) ➞ 60

smallest(10) ➞ 2520

smallest(20) ➞ 232792560

Notes

N/A

javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.