fix(curriculum): clean-up Project Euler 381-400 (#43024)

* fix: clean-up Project Euler 381-400

* fix: missing image extension

* fix: missing subscripts

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 16:59:29 +02:00
committed by GitHub
parent 594adf02c1
commit d269909faa
20 changed files with 279 additions and 180 deletions

View File

@ -12,24 +12,25 @@ Jeff eats a pie in an unusual way.
The pie is circular. He starts with slicing an initial cut in the pie along a radius.
While there is at least a given fraction F of pie left, he performs the following procedure:
While there is at least a given fraction $F$ of pie left, he performs the following procedure:
\- He makes two slices from the pie centre to any point of what is remaining of the pie border, any point on the remaining pie border equally likely. This will divide the remaining pie into three pieces.
- He makes two slices from the pie centre to any point of what is remaining of the pie border, any point on the remaining pie border equally likely. This will divide the remaining pie into three pieces.
- Going counterclockwise from the initial cut, he takes the first two pie pieces and eats them.
\- Going counterclockwise from the initial cut, he takes the first two pie pieces and eats them.
When less than a fraction $F$ of pie remains, he does not repeat this procedure. Instead, he eats all of the remaining pie.
When less than a fraction F of pie remains, he does not repeat this procedure. Instead, he eats all of the remaining pie.
<img class="img-responsive center-block" alt="animation of pie slicing procedure" src="https://cdn.freecodecamp.org/curriculum/project-euler/eating-pie.gif" style="background-color: white; padding: 10px;">
For x ≥ 1, let E(x) be the expected number of times Jeff repeats the procedure above with F = 1/x. It can be verified that E(1) = 1, E(2) ≈ 1.2676536759, and E(7.5) ≈ 2.1215732071.
For $x ≥ 1$, let $E(x)$ be the expected number of times Jeff repeats the procedure above with $F = \frac{1}{x}$. It can be verified that $E(1) = 1$, $E(2) ≈ 1.2676536759$, and $E(7.5) ≈ 2.1215732071$.
Find E(40) rounded to 10 decimal places behind the decimal point.
Find $E(40)$ rounded to 10 decimal places behind the decimal point.
# --hints--
`euler394()` should return 3.2370342194.
`eatingPie()` should return `3.2370342194`.
```js
assert.strictEqual(euler394(), 3.2370342194);
assert.strictEqual(eatingPie(), 3.2370342194);
```
# --seed--
@ -37,12 +38,12 @@ assert.strictEqual(euler394(), 3.2370342194);
## --seed-contents--
```js
function euler394() {
function eatingPie() {
return true;
}
euler394();
eatingPie();
```
# --solutions--