
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?
#initialize variables x = 1 #function to check if number is evenly divisible by numbers from 1 to 20 def check_d(x): for i in range(1,20): if x % i != 0: return False return True #while statement to iterate through all whole numbers until check_d returns True while not check_d(x): x = x + 1 print(x)
That was pretty straightforward!