Add files via upload
This commit is contained in:
parent
3316d2dfb8
commit
be742d5a74
306
ipynb/Beal.ipynb
306
ipynb/Beal.ipynb
@ -29,11 +29,12 @@
|
|||||||
"> <br>and $x, y, z$ are all greater than $2$, \n",
|
"> <br>and $x, y, z$ are all greater than $2$, \n",
|
||||||
"> <br>then $A, B$ and $C$ must have a common prime factor.\n",
|
"> <br>then $A, B$ and $C$ must have a common prime factor.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"[Andrew Wiles](https://en.wikipedia.org/wiki/Andrew_Wiles) proved Fermat's theorem in 1995, but Beal's conjecture remains unproved, and Beal has offered [one million dollars](http://www.ams.org/profession/prizes-awards/ams-supported/beal-prize) for a proof or disproof. I don't have the mathematical skills of Wiles, so I could never find a proof, but I can write a program to search for counterexamples. I first wrote [that program in 2000](http://norvig.com/beal2000.html), and [my name got associated](https://www.google.com/webhp?#q=beal conjecture) with Beal's Conjecture, which means I get a lot of emails with purported proofs or counterexamples (many asking how they can collect their prize money). So far, all the emails have been wrong. This notebook catalogs some of the more common errors, updates my 2000 program, and introduces this tool:\n",
|
"[Andrew Wiles](https://en.wikipedia.org/wiki/Andrew_Wiles) proved Fermat's theorem in 1995, but Beal's conjecture remains unproved, and Beal has offered [one million dollars](http://www.ams.org/profession/prizes-awards/ams-supported/beal-prize) for a proof or disproof. I don't have the mathematical skills of Wiles, so I could never find a proof, but I can write a program to search for counterexamples. I first wrote [that program in 2000](http://norvig.com/beal2000.html), and [my name got associated](https://www.google.com/webhp?#q=beal conjecture) with Beal's Conjecture, which means I get a lot of emails with purported proofs or counterexamples (many asking how they can collect their prize money). So far, all the emails have been wrong. This notebook catalogs some of the more common errors, updates my 2000 program, and introduces this tool for verifying counterexamples:\n",
|
||||||
|
" \n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Online Beal Counterexample Checker\n",
|
"| [**Online Beal Counterexample Checker**](http://norvig.com/bealcheck.html) |\n",
|
||||||
|
"|:---:|\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Got a counterexample? Verify it with my [Beal Counterexample Checker](http://norvig.com/bealcheck.html).\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"# How to Not Win A Million Dollars\n",
|
"# How to Not Win A Million Dollars\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -69,47 +70,11 @@
|
|||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 1,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"collapsed": true
|
||||||
"collapsed": false,
|
|
||||||
"new_sheet": false,
|
|
||||||
"run_control": {
|
|
||||||
"read_only": false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [],
|
||||||
{
|
|
||||||
"data": {
|
|
||||||
"text/plain": [
|
|
||||||
"True"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"execution_count": 1,
|
|
||||||
"metadata": {},
|
|
||||||
"output_type": "execute_result"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
"source": [
|
||||||
"from math import gcd #### In Python versions < 3.5, use \"from fractions import gcd\"\n",
|
"from math import gcd #### In Python versions < 3.5, use \"from fractions import gcd\""
|
||||||
"\n",
|
|
||||||
"A, B, C = 60000000000000000000, 70000000000000000000, 82376613842809255677\n",
|
|
||||||
"x = y = z = 3.\n",
|
|
||||||
"\n",
|
|
||||||
"A ** x + B ** y == C ** z and gcd(gcd(A, B), C) == 1"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {
|
|
||||||
"button": false,
|
|
||||||
"new_sheet": false,
|
|
||||||
"run_control": {
|
|
||||||
"read_only": false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"source": [
|
|
||||||
"**WOW! The result is `True`!** The two sides of the equation are equal, and the greatest common divisor is 1. Is this a real counterexample to Beal? And also a disproof of Fermat's Last Theorem?\n",
|
|
||||||
"\n",
|
|
||||||
"Alas, it is not. The decimal point in \"`x = y = z = 3.`\" indicates a floating point number, with inexact, limited precision. Change the inexact \"`3.`\" to an exact \"`3`\" and the two sides of the equation are no longer equal. Below we see they are the same for the first 18 digits, but differ starting with the 19th: "
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -127,8 +92,7 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"(559000000000000000000000000000000000000000000000000000000000,\n",
|
"True"
|
||||||
" 559000000000000000063037470301555182935702892172500189973733)"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 2,
|
"execution_count": 2,
|
||||||
@ -136,6 +100,52 @@
|
|||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"source": [
|
||||||
|
"A, B, C = 60000000000000000001, 70000000000000000003, 82376613842809255677\n",
|
||||||
|
"x = y = z = 3.\n",
|
||||||
|
"\n",
|
||||||
|
"A ** x + B ** y == C ** z and gcd(A, B) == gcd(B, C) == 1"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {
|
||||||
|
"button": false,
|
||||||
|
"new_sheet": false,
|
||||||
|
"run_control": {
|
||||||
|
"read_only": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"source": [
|
||||||
|
"**WOW! The result is `True`!** The two sides of the equation are equal, and the greatest common divisor is 1. Is this a real counterexample to Beal? And also a disproof of Fermat's Last Theorem?\n",
|
||||||
|
"\n",
|
||||||
|
"Alas, it is not. The decimal point in \"`x = y = z = 3`**`.`**\" indicates a floating point number, with inexact, limited precision. Change the inexact \"`3.`\" to an exact \"`3`\" and the two sides of the equation are no longer equal. Below we see they are the same for the first 19 digits, but differ starting with the 20th: "
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 3,
|
||||||
|
"metadata": {
|
||||||
|
"button": false,
|
||||||
|
"collapsed": false,
|
||||||
|
"new_sheet": false,
|
||||||
|
"run_control": {
|
||||||
|
"read_only": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"(559000000000000000054900000000000000002070000000000000000028,\n",
|
||||||
|
" 559000000000000000063037470301555182935702892172500189973733)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 3,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"(A ** 3 + B ** 3,\n",
|
"(A ** 3 + B ** 3,\n",
|
||||||
" C ** 3)"
|
" C ** 3)"
|
||||||
@ -151,7 +161,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
"They say \"close\" only counts in horseshoes and hand grenades, and if you threw two horseshoes at a stake on **[Kapteyn-b](https://en.wikipedia.org/wiki/Kapteyn_b)** (an exoplanet 12.8 light years from Earth that is habitable and thus possibly horseshoe-playing) and the two paths differed in the 19th digit, the horseshoes would end up [less than an inch](https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=12.8%20light%20years%20*%201e-19%20in%20inches) apart. That's really, really close, but close doesn't count in number theory.\n",
|
"They say \"close\" only counts in horseshoes and hand grenades, and if you stood in your yard and threw a horseshoe at a stake on **[Kapteyn-b](https://en.wikipedia.org/wiki/Kapteyn_b)** (an exoplanet 12.8 light years from Earth that is deemed habitable and thus possibly horseshoe-playing) and the flight path differed from the perfect path in the 20th digit, then it would end up \n",
|
||||||
|
"[about a millimeter](https://www.google.com/search?q=12.8+light+years+%2F+10%5E20+in+inches&oq=12.8+light+years+%2F+10%5E19+in+inches) \n",
|
||||||
|
"from the target. That's really, really close, but close doesn't count in number theory.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Left: [Kapteyn-b](https://www.space.com/26115-oldest-habitable-alien-planet-kapteyn-b.html). Right: [Homer Simpson](https://www.youtube.com/watch?time_continue=1&v=ReOQ300AcSU).\n",
|
"Left: [Kapteyn-b](https://www.space.com/26115-oldest-habitable-alien-planet-kapteyn-b.html). Right: [Homer Simpson](https://www.youtube.com/watch?time_continue=1&v=ReOQ300AcSU).\n",
|
||||||
@ -160,57 +172,7 @@
|
|||||||
"# *The Simpsons* and Fermat\n",
|
"# *The Simpsons* and Fermat\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In two different [episodes of *The Simpsons*](http://www.npr.org/sections/krulwich/2014/05/08/310818693/did-homer-simpson-actually-solve-fermat-s-last-theorem-take-a-look), close counterexamples to Fermat's Last Theorem are shown: \n",
|
"In two different [episodes of *The Simpsons*](http://www.npr.org/sections/krulwich/2014/05/08/310818693/did-homer-simpson-actually-solve-fermat-s-last-theorem-take-a-look), close counterexamples to Fermat's Last Theorem are shown: \n",
|
||||||
"$3987^{12} + 4365^{12} = 4472^{12}$ and $1782^{12} + 1841^{12} = 1922^{12}$. These were designed by *Simpsons* writer David X. Cohen to be correct up to the precision found in most handheld calculators. Cohen found the equations with a program that must have been something like this:"
|
"$3987^{12} + 4365^{12} = 4472^{12}$ and $1782^{12} + 1841^{12} = 1922^{12}$. These were designed by *Simpsons* writer David X. Cohen to be correct up to the precision of a typical handheld calculator; here we see the two sides of the second equation agree on the first ten digits, `6397665634`, and then differ:"
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": 3,
|
|
||||||
"metadata": {
|
|
||||||
"collapsed": false
|
|
||||||
},
|
|
||||||
"outputs": [
|
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"1782**12 + 1841**12 == 1922**12 has relative error of 3e-10\n",
|
|
||||||
"3987**12 + 4365**12 == 4472**12 has relative error of 2e-11\n"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"source": [
|
|
||||||
"from itertools import combinations\n",
|
|
||||||
"\n",
|
|
||||||
"def Fermat(A, B, n):\n",
|
|
||||||
" \"Return a tuple of the form (error, A, B, C, n)\"\n",
|
|
||||||
" C = int(round((A ** n + B ** n) ** (1/n)))\n",
|
|
||||||
" lhs, rhs = A ** n + B ** n, C ** n\n",
|
|
||||||
" error = abs(lhs - rhs) / rhs\n",
|
|
||||||
" return (error, A, B, C, n)\n",
|
|
||||||
"\n",
|
|
||||||
"def simpsons(bases, powers):\n",
|
|
||||||
" \"\"\"Find the Fermat equation that minimizes the error.\"\"\"\n",
|
|
||||||
" return min(Fermat(A, B, n) \n",
|
|
||||||
" for A, B in combinations(bases, 2) \n",
|
|
||||||
" for n in powers)\n",
|
|
||||||
"\n",
|
|
||||||
"def show(fermat):\n",
|
|
||||||
" (error, A, B, C, n) = fermat\n",
|
|
||||||
" print('{}**{} + {}**{} == {}**{} has relative error of {:.0g}'\n",
|
|
||||||
" .format(A, n, B, n, C, n, error))\n",
|
|
||||||
" \n",
|
|
||||||
"show(simpsons(range(1000, 2000), [12]))\n",
|
|
||||||
"show(simpsons(range(3000, 5000), [12]))"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "markdown",
|
|
||||||
"metadata": {},
|
|
||||||
"source": [
|
|
||||||
"These are the same two equations that David X. Cohen found. The sides of the equations are nearly equal, up to 10 or 11 decimal places, respectively.\n",
|
|
||||||
"\n",
|
|
||||||
"Can we do better? The following search will take about 8 minutes:"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -220,17 +182,11 @@
|
|||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
},
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{
|
|
||||||
"name": "stdout",
|
|
||||||
"output_type": "stream",
|
|
||||||
"text": [
|
|
||||||
"2196**3 + 5984**3 == 6081**3 has relative error of 4e-12\n"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"(224866629440, 224866629441)"
|
"(63976656349698612616236230953154487896987106,\n",
|
||||||
|
" 63976656348486725806862358322168575784124416)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 4,
|
"execution_count": 4,
|
||||||
@ -239,16 +195,94 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"(_, A, B, C, n) = f = simpsons(range(1000, 6000), range(3, 13))\n",
|
"3987 ** 12 + 4365 ** 12, 4472 ** 12"
|
||||||
"show(f)\n",
|
|
||||||
"A ** n + B ** n, C ** n"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"This is an equation that differs by just 1 in the 12th and last decmal place."
|
"Cohen must have found the equations with a program something like this (here `bases` is a sequence of integers to consider for the values of `A` and `B`; the variables `An` and `Bn` hold the `A**n` and `B**n` values; `lhs` is their sum (the left-hand-side of the equation); and the function `Cn` computes the `C**n` that is closest to that sum):"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 5,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"from itertools import combinations\n",
|
||||||
|
"\n",
|
||||||
|
"def simpsons(bases, n):\n",
|
||||||
|
" \"\"\"Print the (A**n + B**n = C**n) equation that minimizes the relative error,\n",
|
||||||
|
" for a given n and A, B values from the sequence of integers `bases`.\"\"\"\n",
|
||||||
|
" def Cn(lhs): return iroot(sum(lhs), n) ** n\n",
|
||||||
|
" def err(lhs): return abs(sum(lhs) - Cn(lhs)) / sum(lhs)\n",
|
||||||
|
" def show(Xn): return '{} ** {}'.format(iroot(Xn, n), n)\n",
|
||||||
|
" powers = [b ** n for b in bases]\n",
|
||||||
|
" (An, Bn) = lhs = min(combinations(powers, 2), key=err)\n",
|
||||||
|
" print('{} + {} == {} (with error {:.0g})'\n",
|
||||||
|
" .format(show(An), show(Bn), show(Cn(lhs)), err(lhs)))\n",
|
||||||
|
"\n",
|
||||||
|
"def iroot(x, n): \"integer nth root\"; return int(round(x ** (1 / n)))"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"1782 ** 12 + 1841 ** 12 == 1922 ** 12 (with error 3e-10)\n",
|
||||||
|
"3987 ** 12 + 4365 ** 12 == 4472 ** 12 (with error 2e-11)\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"simpsons(range(1000, 2000), 12)\n",
|
||||||
|
"simpsons(range(2000, 5000), 12)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"These are the same two equations that David X. Cohen found. \n",
|
||||||
|
"\n",
|
||||||
|
"Can we find other near-misses? I'll try each single-digit exponent. I want A, B, C to be 4 digits each, so I'll limit A and B to 9500 (not 9999), to try to keep C from overflowing to 5 digits. (This takes around 10 minutes to run.)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 7,
|
||||||
|
"metadata": {
|
||||||
|
"collapsed": false
|
||||||
|
},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"name": "stdout",
|
||||||
|
"output_type": "stream",
|
||||||
|
"text": [
|
||||||
|
"5856 ** 3 + 9036 ** 3 == 9791 ** 3 (with error 1e-12)\n",
|
||||||
|
"2396 ** 4 + 4551 ** 4 == 4636 ** 4 (with error 4e-11)\n",
|
||||||
|
"3993 ** 5 + 7767 ** 5 == 7822 ** 5 (with error 2e-11)\n",
|
||||||
|
"6107 ** 6 + 8919 ** 6 == 9066 ** 6 (with error 8e-13)\n",
|
||||||
|
"5592 ** 7 + 9079 ** 7 == 9122 ** 7 (with error 2e-11)\n",
|
||||||
|
"4749 ** 8 + 8952 ** 8 == 8959 ** 8 (with error 3e-11)\n",
|
||||||
|
"5433 ** 9 + 6725 ** 9 == 6828 ** 9 (with error 4e-11)\n"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"for n in range(3, 10):\n",
|
||||||
|
" simpsons(range(1000, 9500), n)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -261,13 +295,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"source": [
|
"source": [
|
||||||
|
"The equation for *n*=6 has the smallest error yet (in the 12th decimal place).\n",
|
||||||
|
"\n",
|
||||||
"# Back to `beal`\n",
|
"# Back to `beal`\n",
|
||||||
"\n",
|
"\n",
|
||||||
"In October 2015 I looked back at my original [program from 2000](http://norvig.com/beal2000.html).\n",
|
"In October 2015 I looked back at my original [program from 2000](http://norvig.com/beal2000.html).\n",
|
||||||
"I ported it from Python 1.5 to 3.5 (`print` is now a function, `long` is `int`). It runs 250 times faster today, a tribute to both computer hardware engineers and the developers of the Python interpreter.\n",
|
"I ported it from Python 1.5 to 3.5 (`print` is now a function, `long` is `int`). It runs 250 times faster today, a tribute to both computer hardware engineers and the developers of the Python interpreter.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"I found that I had [misstated the problem](https://web.archive.org/web/19991127081319/http://bealconjecture.com/) in 2000. I thought that, *by definition*, $A$ and $B$ could not have a common factor, but actually, \n",
|
"I found that I had [misstated the problem](https://web.archive.org/web/19991127081319/http://bealconjecture.com/) in 2000. I thought that, *by definition*, $A$ and $B$ could not have a common factor, but actually, \n",
|
||||||
"the conjecture only rules out examples where all three of $A, B, C$ share a common factor. But, as [Mark Tiefenbruck](mailto:mark @tiefenbruck.org) (as well as Edward P. Berlin and Shen Lixing) pointed out, my statement is correct, not by definition, but *by derivation:* if $A$ and $B$ have a commmon prime factor $p$, then the sum of $A^x + B^y$ must also have that factor $p$, and hence $C^z$, and $C$, must have the factor $p$.\n",
|
"the conjecture only rules out examples where all three of $A, B, C$ share a common factor. But, as [Mark Tiefenbruck](mailto:mark @tiefenbruck.org) (as well as Edward P. Berlin and Shen Lixing) pointed out, my statement is correct, not by definition, but *by derivation:* if $A$ and $B$ have a common prime factor $p$, then the sum of $A^x + B^y$ must also have that factor $p$, and hence $C^z$, and $C$, must have the factor $p$.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Mark Tiefenbruck also suggested another optimization: only consider exponents that are odd primes, or 4. The idea is that a number like 512 can be expressed as either $2^9$ or $8^3$, and my program doesn't need to consider both. In general, any time we have a composite exponent, such as $b^{qp}$, where $p$ is prime, we should ignore $A=b, x=qp$, and instead consider only $A=b^q, x=p$. There's one complication to this scheme: 2 is a prime, but 2 is not a valid exponent for a Beal counterexample. So we will allow 4 as an exponent, as well as all odd primes up to `max_x`.\n",
|
"Mark Tiefenbruck also suggested another optimization: only consider exponents that are odd primes, or 4. The idea is that a number like 512 can be expressed as either $2^9$ or $8^3$, and my program doesn't need to consider both. In general, any time we have a composite exponent, such as $b^{qp}$, where $p$ is prime, we should ignore $A=b, x=qp$, and instead consider only $A=b^q, x=p$. There's one complication to this scheme: 2 is a prime, but 2 is not a valid exponent for a Beal counterexample. So we will allow 4 as an exponent, as well as all odd primes up to `max_x`.\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -276,7 +312,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 5,
|
"execution_count": 8,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": true,
|
"collapsed": true,
|
||||||
@ -342,7 +378,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 6,
|
"execution_count": 9,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -356,7 +392,7 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"CPU times: user 354 ms, sys: 4.32 ms, total: 358 ms\n",
|
"CPU times: user 353 ms, sys: 4.84 ms, total: 358 ms\n",
|
||||||
"Wall time: 376 ms\n"
|
"Wall time: 376 ms\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -380,7 +416,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 7,
|
"execution_count": 10,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -394,8 +430,8 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"CPU times: user 11.1 s, sys: 152 ms, total: 11.3 s\n",
|
"CPU times: user 8.97 s, sys: 56.6 ms, total: 9.03 s\n",
|
||||||
"Wall time: 12.3 s\n"
|
"Wall time: 9.12 s\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -425,7 +461,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 8,
|
"execution_count": 11,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -446,7 +482,7 @@
|
|||||||
" 6: [216, 1296, 7776, 279936]}"
|
" 6: [216, 1296, 7776, 279936]}"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 8,
|
"execution_count": 11,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -471,7 +507,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 9,
|
"execution_count": 12,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -507,7 +543,7 @@
|
|||||||
" 279936: 6}"
|
" 279936: 6}"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 9,
|
"execution_count": 12,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -519,7 +555,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 10,
|
"execution_count": 13,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
},
|
||||||
@ -530,7 +566,7 @@
|
|||||||
"3"
|
"3"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 10,
|
"execution_count": 13,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -559,7 +595,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 11,
|
"execution_count": 14,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -608,7 +644,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 12,
|
"execution_count": 15,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -624,7 +660,7 @@
|
|||||||
"{True}"
|
"{True}"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 12,
|
"execution_count": 15,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -658,7 +694,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 13,
|
"execution_count": 16,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": true,
|
"collapsed": true,
|
||||||
@ -689,7 +725,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 14,
|
"execution_count": 17,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -705,7 +741,7 @@
|
|||||||
"'tests pass'"
|
"'tests pass'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 14,
|
"execution_count": 17,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -810,7 +846,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 15,
|
"execution_count": 18,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": true,
|
"collapsed": true,
|
||||||
@ -875,7 +911,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 16,
|
"execution_count": 19,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"collapsed": false
|
"collapsed": false
|
||||||
},
|
},
|
||||||
@ -891,7 +927,7 @@
|
|||||||
" 6: [(216, 3), (296, 4), (776, 5), (936, 7)]}"
|
" 6: [(216, 3), (296, 4), (776, 5), (936, 7)]}"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 16,
|
"execution_count": 19,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -917,7 +953,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 17,
|
"execution_count": 20,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -952,7 +988,7 @@
|
|||||||
" 936: [(6, 7)]})"
|
" 936: [(6, 7)]})"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"execution_count": 17,
|
"execution_count": 20,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"output_type": "execute_result"
|
"output_type": "execute_result"
|
||||||
}
|
}
|
||||||
@ -976,7 +1012,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 18,
|
"execution_count": 21,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"button": false,
|
"button": false,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
@ -990,8 +1026,8 @@
|
|||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"output_type": "stream",
|
"output_type": "stream",
|
||||||
"text": [
|
"text": [
|
||||||
"CPU times: user 55.9 s, sys: 530 ms, total: 56.4 s\n",
|
"CPU times: user 56 s, sys: 436 ms, total: 56.4 s\n",
|
||||||
"Wall time: 59.6 s\n"
|
"Wall time: 59.2 s\n"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user