fix(curriculum): clean-up Project Euler 441-460 (#43068)

* fix: clean-up Project Euler 441-460

* 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-30 17:20:31 +02:00
committed by GitHub
parent d269909faa
commit a2b2ef3f75
20 changed files with 267 additions and 185 deletions

View File

@ -8,24 +8,30 @@ dashedName: problem-443-gcd-sequence
# --description--
Let g(n) be a sequence defined as follows: g(4) = 13, g(n) = g(n-1) + gcd(n, g(n-1)) for n > 4.
Let $g(n)$ be a sequence defined as follows:
$$\begin{align}
& g(4) = 13, \\\\
& g(n) = g(n-1) + gcd(n, g(n - 1)) \text{ for } n > 4.
\end{align}$$
The first few values are:
n 4567891011121314151617181920... g(n) 1314161718272829303132333451545560...
$$\begin{array}{l}
n & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 & \ldots \\\\
g(n) & 13 & 14 & 16 & 17 & 18 & 27 & 28 & 29 & 30 & 31 & 32 & 33 & 34 & 51 & 54 & 55 & 60 & \ldots
\end{array}$$
<!-- TODO Use MathJax -->
You are given that $g(1\\,000) = 2\\,524$ and $g(1\\,000\\,000) = 2\\,624\\,152$.
You are given that g(1 000) = 2524 and g(1 000 000) = 2624152.
Find g(1015).
Find $g({10}^{15})$.
# --hints--
`euler443()` should return 2744233049300770.
`gcdSequence()` should return `2744233049300770`.
```js
assert.strictEqual(euler443(), 2744233049300770);
assert.strictEqual(gcdSequence(), 2744233049300770);
```
# --seed--
@ -33,12 +39,12 @@ assert.strictEqual(euler443(), 2744233049300770);
## --seed-contents--
```js
function euler443() {
function gcdSequence() {
return true;
}
euler443();
gcdSequence();
```
# --solutions--