Skip to content

Instantly share code, notes, and snippets.

@mcvarer
Last active October 20, 2020 10:38
Show Gist options
  • Save mcvarer/609d0a7b865197dba46b499b17f9026d to your computer and use it in GitHub Desktop.
Save mcvarer/609d0a7b865197dba46b499b17f9026d to your computer and use it in GitHub Desktop.
projecteuler: 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?
"""
check_list = [11, 13, 14, 16, 17, 18, 19, 20]
def find_solution(step):
for num in range(step, 999999999, step):
if all(num % n == 0 for n in check_list):
return num
return None
print("smallest positive number is: {}".format(find_solution(20)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment