fix parentheses
This commit is contained in:
parent
dd24aac8bb
commit
f8d7a1d825
|
@ -11,7 +11,7 @@
|
|||
"\n",
|
||||
"The concept the problem is describing is called a [Farey sequence](https://en.wikipedia.org/wiki/Farey_sequence). The example given in the problem is $F_8$, and we are tasked with finding the numerator of the left neighbor of $\\frac{3}{7}$ in $F_{1000000}$.\n",
|
||||
"\n",
|
||||
"It turns out there is a very simple method for determining this. Whenever you have two neighbors $\\frac{a}{b}$ and $\\frac{c}{d}$ in a Farey sequence, the next term that will appear between them in a subsequent Farey sequence is simply $\\frac{a+c}{b+d}$, called the [mediant](https://en.wikipedia.org/wiki/Mediant_(mathematics)) of the two neighbors. For example, since we're given that the left neighbor of $\\frac{3}{7}$ in $F_8$ is $\\frac{2}{5}$, the next fraction to appear between the two will be\n",
|
||||
"It turns out there is a very simple method for determining this. Whenever you have two neighbors $\\frac{a}{b}$ and $\\frac{c}{d}$ in a Farey sequence, the next term that will appear between them in a subsequent Farey sequence is simply $\\frac{a+c}{b+d}$, called the [mediant](https://w.wiki/EoNc) of the two neighbors. For example, since we're given that the left neighbor of $\\frac{3}{7}$ in $F_8$ is $\\frac{2}{5}$, the next fraction to appear between the two will be\n",
|
||||
"$$\\frac{2+3}{5+7} = \\frac{5}{12}$$\n",
|
||||
"Naturally, this fraction will first appear in $F_{12}$, meaning $\\frac{5}{12}$ is the left neighbor of $\\frac{3}{7}$ in that Farey sequence. We could then, in turn, find the mediant of $\\frac{5}{12}$ and $\\frac{3}{7}$ to find the next left neighbor of $\\frac{3}{7}$ ($\\frac{8}{19}$, appearing in $F_{19}$).\n",
|
||||
"\n",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"source": [
|
||||
"# [Counting Summations](https://projecteuler.net/problem=76)\n",
|
||||
"\n",
|
||||
"We want $p(100) - 1$, where $p(n)$ is the [partition function](https://en.wikipedia.org/wiki/Partition_function_(number_theory)). We subtract 1 because $p(n)$ counts $n$ by itself as a partition of $n$, but we only want partitions composed of two or more numbers.\n",
|
||||
"We want $p(100) - 1$, where $p(n)$ is the [partition function](https://w.wiki/EoNj). We subtract 1 because $p(n)$ counts $n$ by itself as a partition of $n$, but we only want partitions composed of two or more numbers.\n",
|
||||
"\n",
|
||||
"Guess what? SageMath has this built-in."
|
||||
]
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
"source": [
|
||||
"Theoretically, we could create a generating function like we did in [problem 31](https://projecteuler.net/problem=76) or [problem 76](https://projecteuler.net/problem=76) to solve this, and could even use $\\mathbb{Z}_{1000000}$ as our base ring to handle the modulus automagically, but since the answer is pretty large, it would be impractical to construct the function with the required precision.\n",
|
||||
"\n",
|
||||
"Instead, if you'd like to implement the [partition function](https://en.wikipedia.org/wiki/Partition_function_(number_theory)) yourself, Euler's [pentagonal number theorem](https://en.wikipedia.org/wiki/Pentagonal_number_theorem) leads to a useful recurrence equation:\n",
|
||||
"Instead, if you'd like to implement the [partition function](https://w.wiki/EoNj) yourself, Euler's [pentagonal number theorem](https://en.wikipedia.org/wiki/Pentagonal_number_theorem) leads to a useful recurrence equation:\n",
|
||||
"$$p(n) = p(n - 1) + p(n - 2) - p(n - 5) - p(n - 7) + p(n - 12) + p(n - 15) - p(n - 22) - p(n - 26) + \\cdots$$\n",
|
||||
"Here, the numbers are the [generalized pentagonal numbers](https://en.wikipedia.org/wiki/Pentagonal_number). As base cases, $p(0) = 1$ and $p(n) = 0$ for negative $n$, so the infinite series eventually converges.\n",
|
||||
"\n",
|
||||
|
|
|
@ -268,7 +268,7 @@
|
|||
"id": "96be7f65",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now with all of the adjustments for special rules in place, we can solve the problem by finding the chain's stationary distribution, which is an [eigenvector](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of the stochastic matrix with eigenvalue 1. To find this eigenvector, we'll first find the basis vector of the [kernel](https://en.wikipedia.org/wiki/Kernel_(linear_algebra)) of $Q - I$ (where $I$ is the identity matrix), with the help of SageMath."
|
||||
"Now with all of the adjustments for special rules in place, we can solve the problem by finding the chain's stationary distribution, which is an [eigenvector](https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of the stochastic matrix with eigenvalue 1. To find this eigenvector, we'll first find the basis vector of the [kernel](https://w.wiki/EoP5) of $Q - I$ (where $I$ is the identity matrix), with the help of SageMath."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue