きったんの頭

#! /usr/bin/env python3
"""
pe5.py
https://mind.kittttttan.info/py/pe5
"""

def pe5(n=20):
    """
    What is the smallest number divisible by each of the numbers 1 to 20?
    """
    if n < 2:
        print(1)
        return
    p = 2
    m = [2]
    for x in range(3, n + 1):
        for y in m:
            if not x % y:
                x //= y
        if x > 1:
            m.append(x)
            p *= x
    print(p)

if __name__ == "__main__":
    pe5()