fix(curriculum): clean-up Project Euler 301-320 (#42926)

* fix: clean-up Project Euler 301-320

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-21 17:59:56 +02:00
committed by GitHub
parent c3eb8189af
commit 32dbe23f5e
20 changed files with 253 additions and 197 deletions

View File

@ -8,44 +8,37 @@ dashedName: problem-318-2011-nines
# --description--
Consider the real number √2+√3.
Consider the real number $\sqrt{2} + \sqrt{3}$.
When we calculate the even powers of √2+√3
When we calculate the even powers of $\sqrt{2} + \sqrt{3}$ we get:
we get:
$$\begin{align}
& {(\sqrt{2} + \sqrt{3})}^2 = 9.898979485566356\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^4 = 97.98979485566356\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^6 = 969.998969071069263\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^8 = 9601.99989585502907\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^{10} = 95049.999989479221\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^{12} = 940897.9999989371855\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^{14} = 9313929.99999989263\ldots \\\\
& {(\sqrt{2} + \sqrt{3})}^{16} = 92198401.99999998915\ldots \\\\
\end{align}$$
(√2+√3)2 = 9.898979485566356...
It looks like that the number of consecutive nines at the beginning of the fractional part of these powers is non-decreasing. In fact it can be proven that the fractional part of ${(\sqrt{2} + \sqrt{3})}^{2n}$ approaches 1 for large $n$.
(√2+√3)4 = 97.98979485566356...
Consider all real numbers of the form $\sqrt{p} + \sqrt{q}$ with $p$ and $q$ positive integers and $p &lt; q$, such that the fractional part of ${(\sqrt{p} + \sqrt{q})}^{2n}$ approaches 1 for large $n$.
(√2+√3)6 = 969.998969071069263...
Let $C(p,q,n)$ be the number of consecutive nines at the beginning of the fractional part of ${(\sqrt{p} + \sqrt{q})}^{2n}$.
(√2+√3)8 = 9601.99989585502907...
Let $N(p,q)$ be the minimal value of $n$ such that $C(p,q,n) ≥ 2011$.
(√2+√3)10 = 95049.999989479221...
(√2+√3)12 = 940897.9999989371855...
(√2+√3)14 = 9313929.99999989263...
(√2+√3)16 = 92198401.99999998915...
It looks like that the number of consecutive nines at the beginning of the fractional part of these powers is non-decreasing. In fact it can be proven that the fractional part of (√2+√3)2n approaches 1 for large n.
Consider all real numbers of the form √p+√q with p and q positive integers and p&lt;q, such that the fractional part of (√p+√q)2n approaches 1 for large n.
Let C(p,q,n) be the number of consecutive nines at the beginning of the fractional part of (√p+√q)2n.
Let N(p,q) be the minimal value of n such that C(p,q,n) ≥ 2011.
Find ∑N(p,q) for p+q ≤ 2011.
Find $\sum N(p,q)$ for $p + q ≤ 2011$.
# --hints--
`euler318()` should return 709313889.
`twoThousandElevenNines()` should return `709313889`.
```js
assert.strictEqual(euler318(), 709313889);
assert.strictEqual(twoThousandElevenNines(), 709313889);
```
# --seed--
@ -53,12 +46,12 @@ assert.strictEqual(euler318(), 709313889);
## --seed-contents--
```js
function euler318() {
function twoThousandElevenNines() {
return true;
}
euler318();
twoThousandElevenNines();
```
# --solutions--