-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path005.py
More file actions
34 lines (27 loc) · 824 Bytes
/
005.py
File metadata and controls
34 lines (27 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# COMPLETED
"""
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?
Answer: bc0d0a22a7a46212135ed0ba77d22f3a
"""
from common import check, is_factor
PROBLEM_NUMBER = 5
ANSWER_HASH = "bc0d0a22a7a46212135ed0ba77d22f3a"
FACTORS = [20, 19, 18, 17, 16, 15, 14, 13, 12, 11]
number = 2520
not_found_answer = True
while not_found_answer:
found_answer = True
for factor in FACTORS:
if not is_factor(number, factor):
found_answer = False
break
if found_answer:
not_found_answer = False
else:
number += 1
check(number, PROBLEM_NUMBER, ANSWER_HASH)