You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
412 B
26 lines
412 B
9 years ago
|
# Smallest positive number that is evenly divisible by all of the numbers from 1 to 20
|
||
|
# Oh boy is this slow. But it works!
|
||
|
|
||
|
counter = 20
|
||
|
running = True
|
||
|
|
||
|
def check_divisor(number):
|
||
|
q = True
|
||
|
for i in range(1, 21):
|
||
|
if number % i != 0:
|
||
|
q = False
|
||
|
|
||
|
return q
|
||
|
|
||
|
while running:
|
||
|
|
||
|
if not check_divisor(counter):
|
||
|
counter += 20
|
||
|
else:
|
||
|
running = False
|
||
|
|
||
|
print(counter)
|
||
|
|
||
|
|
||
|
|