Added 32 and tried to solve 31 in ipython. Failed.

This commit is contained in:
2018-02-11 16:05:19 +01:00
parent 2ef2c3e991
commit b8d1b9bd40
5 changed files with 6501 additions and 18 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,78 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Euler Problem 32\n",
"\n",
"We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital.\n",
"\n",
"The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing multiplicand, multiplier, and product is 1 through 9 pandigital.\n",
"\n",
"Find the sum of all products whose multiplicand/multiplier/product identity can be written as a 1 through 9 pandigital.\n",
"\n",
"HINT: Some products can be obtained in more than one way so be sure to only include it once in your sum."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "AssertionError",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mAssertionError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-1-8e612cf3c592>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[0ms\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;36m0\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[1;32massert\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ms\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;36m45228\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mAssertionError\u001b[0m: "
]
}
],
"source": [
"s = 0\n",
"assert(s == 45228)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"completion_date": "Wed, 30 Aug 2017, 14:25",
"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.5.4"
},
"tags": [
"pandigital",
"products"
]
},
"nbformat": 4,
"nbformat_minor": 0
}

View File

@@ -479,6 +479,19 @@
</td>
</tr>
<tr>
<td>Problem 032</td>
<td>Wed, 30 Aug 2017, 14:25</td>
<td><a href="EulerProblem032.html">Problem 032</a></td>
<td>
<kbd>pandigital</kbd>
<kbd>products</kbd>
</td>
</tr>
<tr>
<td>Problem 067</td>
<td>Fri, 5 Sep 2014, 07:36</td>