From f69c2d4c001df1fedfd26e703b0ab6f391b3e481 Mon Sep 17 00:00:00 2001 From: filifa Date: Thu, 22 May 2025 00:19:28 -0400 Subject: [PATCH] add problem 63 --- notebooks/problem0063.ipynb | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 notebooks/problem0063.ipynb diff --git a/notebooks/problem0063.ipynb b/notebooks/problem0063.ipynb new file mode 100644 index 0000000..0fa20b7 --- /dev/null +++ b/notebooks/problem0063.ipynb @@ -0,0 +1,49 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "829a3994", + "metadata": {}, + "source": [ + "# [Powerful Digit Counts](https://projecteuler.net/problem=63)\n", + "\n", + "This problem can be solved with a calculator.\n", + "\n", + "For $x^n$ to have $n$ digits, the following inequality must hold:\n", + "$$10^{n-1} \\leq x^n < 10^n$$\n", + "If we solve for $x$, we get\n", + "$$10^\\frac{n-1}{n} \\leq x < 10$$\n", + "In other words, if $10^\\frac{n-1}{n} \\leq x < 10$ for some $x$, then $x^n$ will have $n$ digits. Therefore, the number of $n$ digit numbers that are also $n$th powers is simply the number of integers between $10^\\frac{n-1}{n}$ and 10. This can be computed as\n", + "$$\\lfloor 10 - 10^\\frac{n-1}{n} \\rfloor$$\n", + "At $n=22$, the lower bound is greater than 9, so we only need to consider values between $n=1$ and $n=21$.\n", + "\n", + "Evaluating this expression for $n=1,2,3,\\ldots,21$ and summing, we get\n", + "$$9 + 6 + 5 + 4 + 3 + 3 + 2 + 2 + 2 + 2 + 1 \\times 11 = 49$$\n", + "\n", + "## Relevant sequences\n", + "* Numbers with $k$ digits that are also $k$th powers: [A132722](https://oeis.org/A132722)" + ] + } + ], + "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 +}