{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Problem 9:\n", "\n", "[Euler Project #9](https://projecteuler.net/problem=9)\n", "\n", "\n", "\n", ">A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,\n", "a2 + b2 = c2\n", "\n", ">For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2.\n", "\n", ">There exists exactly one Pythagorean triplet for which a + b + c = 1000.\n", "Find the product abc.\n", "\n", "\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reserved Space For Imports\n", "---" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import pprint\n", "import time # Typically imported for sleep function, to slow down execution in terminal.\n", "import typing\n", "import decorators # Typically imported to compute execution duration of functions.\n", "import numpy\n", "import pandas" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reserved Space For Method Definition\n", "---" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Can we describe a few approaches to solving this problem?\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Let's discuss a few ways to work through this, then select one to implement.*\n", "\n", " 1. Create a 2D array in which we can place each candidate series of integers.\\\n", " A column vector can also be created in which can store the product of each series.\\\n", " If we zip these arrays together, sort on the product column, we can identify the\\\n", " the maximum product and its associate string of integers.\n", "
\n", "
\n", " 2. Create an array (of the specified length) to store a series of integers from the input\\\n", " number. Allow this to be an array that we use to compute the a product. It will shift as we\\\n", " slide along the input number. A second array of identical dimension, plus an additional place,\\\n", " could store the largest product, and the associated list of integers. \n", " " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Let's try the first approach!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 1. a) Take in problem statement information." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 1. b) Build out the candidate array. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### 1. c) Cheat by using pandas to print out the maximum product and its associated series of integers. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "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.8.3" } }, "nbformat": 4, "nbformat_minor": 4 }