2018-09-30 23:01:58 +01:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4b71000cf542c50ffc9
|
|
|
|
|
challengeType: 5
|
2018-10-20 21:02:47 +03:00
|
|
|
|
title: 'Problem 330: Euler''s Number'
|
2019-08-05 09:17:33 -07:00
|
|
|
|
forumTopicId: 301988
|
2018-09-30 23:01:58 +01:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
<section id='description'>
|
|
|
|
|
|
2019-07-18 17:32:12 +02:00
|
|
|
|
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 -->
|
|
|
|
|
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
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
|
with e = 2.7182818... being Euler's constant.
|
|
|
|
|
|
|
|
|
|
|
2018-10-08 01:01:53 +01:00
|
|
|
|
It can be shown that a(n) is of the form
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2019-07-18 17:32:12 +02:00
|
|
|
|
A(n) e + B(n)n!
|
|
|
|
|
for integers A(n) and B(n).
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2018-10-08 01:01:53 +01:00
|
|
|
|
For example a(10) =
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
2019-07-18 17:32:12 +02:00
|
|
|
|
328161643 e − 65269448610!.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
|
Find A(109) + B(109) and give your answer mod 77 777 777.
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
<section id='instructions'>
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 14:37:37 +01:00
|
|
|
|
tests:
|
|
|
|
|
- text: <code>euler330()</code> should return 15955822.
|
2019-07-27 05:34:19 -07:00
|
|
|
|
testString: assert.strictEqual(euler330(), 15955822);
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler330() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler330();
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
2019-07-18 08:24:12 -07:00
|
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
|
</section>
|