{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "We just need to find the [lcm](https://en.wikipedia.org/wiki/Least_common_multiple)." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "232792560" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from math import gcd\n", "\n", "def lcm(a, b):\n", " return a*b // gcd(a, b)\n", "\n", "l = 1\n", "for n in range(1,20+1):\n", " l = lcm(l, n)\n", "l" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.4" }, "title": "Smallest multiple" }, "nbformat": 4, "nbformat_minor": 2 }