#!/usr/bin/env python # coding: utf-8 # We just need to find the [lcm](https://en.wikipedia.org/wiki/Least_common_multiple). # In[6]: from math import gcd def lcm(a, b): return a*b // gcd(a, b) l = 1 for n in range(1,20+1): l = lcm(l, n) l # In[ ]: