FunctionRacerProblemsRace

LCM of a Range

EasyMathPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Math problems