LCM of a Range
Return the smallest positive integer that is divisible by every whole number from 1 up to n.
Example 1
n 4
returns 12
12 is divisible by 1, 2, 3 and 4.
Example 2
n 10
returns 2520
2520.
Constraints
1 <= n <= 15
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.