Problem 5

Problem 5

# Problem_5.py
"""
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?
什么是能够整除(没有余数)从1到20之间的所有数字的最小正数字?
"""
for num in range(21, 99999999999):
    flag = True
    for i in range(1, 21):
        if not num % i == 0:
            flag = False
            break
    if flag:
        print(num)  # 232792560
        break

猜你喜欢

转载自www.cnblogs.com/noonjuan/p/10957260.html