Back to Problems

Problem 5: Smallest Multiple

$2520$ is the smallest number that can be divided by each of the numbers from $1$ to $10$ without any remainder.

What is the smallest positive number that is evenly divisible by all of the numbers from $1$ to $20$?

Solution Approach

This question can simply be restated as: find the LCM (lowest common multiple) of the first 20 natural numbers starting from 1. Thankfully python has a built-in function to compute the LCM of many numbers.

import math
l = list(range(1, 21))
print(math.lcm(*l))

Explained line by line:

Running the above code leads to an answer of $232792560$