add a few more thoughts
This commit is contained in:
parent
2ca02f9aba
commit
ccbb6027c8
|
@ -51,11 +51,9 @@
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def minimal_solution(d):\n",
|
"def minimal_solution(d):\n",
|
||||||
" var('x,y')\n",
|
|
||||||
" \n",
|
|
||||||
" sols = solve_diophantine(x^2 - d*y^2 == 1)\n",
|
" sols = solve_diophantine(x^2 - d*y^2 == 1)\n",
|
||||||
" u, v = sols[0]\n",
|
" u, v = sols[0]\n",
|
||||||
" return (abs(u(t=0).simplify_full()), abs(v(t=0).simplify_full()))"
|
" return (abs(u(t=0)), abs(v(t=0)))"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -145,6 +143,35 @@
|
||||||
"max((d for d in range(1, 1001) if not is_square(d)), key=lambda x: pell_fundamental_solution(x)[0])"
|
"max((d for d in range(1, 1001) if not is_square(d)), key=lambda x: pell_fundamental_solution(x)[0])"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "3f573e65",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"And in case you want to know the minimal $x$ for $x^2 - 661y^2 = 1$:"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 6,
|
||||||
|
"id": "b4b119a0",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"text/plain": [
|
||||||
|
"(16421658242965910275055840472270471049, 638728478116949861246791167518480580)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"execution_count": 6,
|
||||||
|
"metadata": {},
|
||||||
|
"output_type": "execute_result"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
"pell_fundamental_solution(661)"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "cfb42d20",
|
"id": "cfb42d20",
|
||||||
|
|
Loading…
Reference in New Issue