See More

{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "Projecteuler_5.ipynb", "provenance": [], "collapsed_sections": [] }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "markdown", "metadata": { "id": "FvX0MIhyh1ep" }, "source": [ "2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.\n", "\n", "What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?" ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "HEEdvECahlgM", "outputId": "2f4dc7e8-0c25-41ba-9040-397df20be762" }, "source": [ "sayi = 1\n", "bölen = 1\n", "\n", "while bölen < 21:\n", "\tif sayi % bölen == 0:\n", "\t\tbölen += 1\n", "\telse:\n", "\t\tsayi += 1\n", "\t\tbölen = 1\n", "\n", "print(sayi)" ], "execution_count": 7, "outputs": [ { "output_type": "stream", "text": [ "232792560\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "s2SsUwX5mgTd", "outputId": "01678ed8-7061-4c7e-bed7-d3839ee736e4" }, "source": [ "2*3*2*5*7*2*3*11*13*2*17*19" ], "execution_count": 6, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "232792560" ] }, "metadata": { "tags": [] }, "execution_count": 6 } ] } ] }