### Problem 5

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 1: Maths

1*2*3*4*5*6*7*8*9*10 = 3628800 can be divided by each of the numbers from 1 to 10 but not the smallest nor the greatest of this kind.
10*9 which implies it is divisible by 10, 9, 6, 5, 3, 2, 1. We only need to multiply it by 4 to make it divisible by 8. So 10*9*4*7 is divisible for number between 1 to 11.

Similarly:
20*19*9*17*4*7*13*11 = 232792560 would be divisible by number between 1 and 21. That is the answer.

### Solution 2: Brute Forcing

Help yourself!

This is when you dont want to use maths.

n = 20
found = 0

while not found:
for i in range(1,21):
if n%i:
break
found = i//20

n += 1

print(n-1)

This code run: ~484.1459057331085s.

The output: 232792560. Still correct.

Note: We can reduce redundancy of checking for 2, 4, 8 while we know it is divisible by 16. We may iterate for multiples of 20 cause the number we want is also multiples of 20.