From 2ea7b7ceaab8fabbb3d9091c5a3e2143945ffd24 Mon Sep 17 00:00:00 2001 From: filifa Date: Mon, 26 May 2025 00:25:51 -0400 Subject: [PATCH] add problem 52 --- notebooks/problem0052.ipynb | 66 +++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 notebooks/problem0052.ipynb diff --git a/notebooks/problem0052.ipynb b/notebooks/problem0052.ipynb new file mode 100644 index 0000000..a304254 --- /dev/null +++ b/notebooks/problem0052.ipynb @@ -0,0 +1,66 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "7e6181f8", + "metadata": {}, + "source": [ + "# [Permuted Multiples](https://projecteuler.net/problem=52)\n", + "\n", + "There's a chance you think of 1/7 when you read this problem and immediately find the answer. But if not, it doesn't take long for the computer to tell you." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "10854a24", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "142857" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from itertools import count\n", + "\n", + "for n in count(1):\n", + " digits = set(str(n))\n", + " for x in (2, 3, 4, 5, 6):\n", + " if set(str(n*x)) != digits:\n", + " break\n", + " else:\n", + " break\n", + " \n", + "n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "SageMath 9.5", + "language": "sage", + "name": "sagemath" + }, + "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.11.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}