fix(curriculum): clean-up Project Euler 321-340 (#42988)
* fix: clean-up Project Euler 321-340 * fix: typo * fix: corrections from review Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -8,30 +8,37 @@ dashedName: problem-330-eulers-number
|
||||
|
||||
# --description--
|
||||
|
||||
An infinite sequence of real numbers a(n) is defined for all integers n as follows:
|
||||
An infinite sequence of real numbers $a(n)$ is defined for all integers $n$ as follows:
|
||||
|
||||
<!-- TODO Use MathJax and re-write from projecteuler.net -->
|
||||
$$ a(n) =
|
||||
\begin{cases}
|
||||
1 & n < 0 \\\\
|
||||
\displaystyle \sum_{i = 1}^{\infty} \frac{a(n - 1)}{i!} & n \ge 0
|
||||
\end{cases}
|
||||
$$
|
||||
|
||||
For example,a(0) = 11! + 12! + 13! + ... = e − 1 a(1) = e − 11! + 12! + 13! + ... = 2e − 3 a(2) = 2e − 31! + e − 12! + 13! + ... = 72 e − 6
|
||||
For example,
|
||||
|
||||
with e = 2.7182818... being Euler's constant.
|
||||
$$\begin{align}
|
||||
& a(0) = \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots = e − 1 \\\\
|
||||
& a(1) = \frac{e − 1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots = 2e − 3 \\\\
|
||||
& a(2) = \frac{2e − 3}{1!} + \frac{e − 1}{2!} + \frac{1}{3!} + \ldots = \frac{7}{2} e − 6
|
||||
\end{align}$$
|
||||
|
||||
It can be shown that a(n) is of the form
|
||||
with $e = 2.7182818\ldots$ being Euler's constant.
|
||||
|
||||
A(n) e + B(n)n! for integers A(n) and B(n).
|
||||
It can be shown that $a(n)$ is of the form $\displaystyle\frac{A(n)e + B(n)}{n!}$ for integers $A(n)$ and $B(n)$.
|
||||
|
||||
For example a(10) =
|
||||
For example $\displaystyle a(10) = \frac{328161643e − 652694486}{10!}$.
|
||||
|
||||
328161643 e − 65269448610!.
|
||||
|
||||
Find A(109) + B(109) and give your answer mod 77 777 777.
|
||||
Find $A({10}^9)$ + $B({10}^9)$ and give your answer $\bmod 77\\,777\\,777$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler330()` should return 15955822.
|
||||
`eulersNumber()` should return `15955822`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler330(), 15955822);
|
||||
assert.strictEqual(eulersNumber(), 15955822);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +46,12 @@ assert.strictEqual(euler330(), 15955822);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler330() {
|
||||
function eulersNumber() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler330();
|
||||
eulersNumber();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user