2018-09-30 22:01:58 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4b71000cf542c50ffc9
|
|
|
|
|
challengeType: 5
|
2018-10-20 18:02:47 +00:00
|
|
|
|
title: 'Problem 330: Euler''s Number'
|
2018-09-30 22:01:58 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
<section id='description'>
|
|
|
|
|
An infinite sequence of real numbers a(n) is defined for all integers n as follows:
|
|
|
|
|
|
|
|
|
|
|
2018-10-08 00:01:53 +00:00
|
|
|
|
For example,a(0) =
|
2018-09-30 22:01:58 +00:00
|
|
|
|
11!
|
|
|
|
|
+
|
|
|
|
|
12!
|
|
|
|
|
+
|
|
|
|
|
13!
|
2018-10-08 00:01:53 +00:00
|
|
|
|
+ ... = e − 1
|
|
|
|
|
a(1) =
|
2018-09-30 22:01:58 +00:00
|
|
|
|
e − 11!
|
|
|
|
|
+
|
|
|
|
|
12!
|
|
|
|
|
+
|
|
|
|
|
13!
|
2018-10-08 00:01:53 +00:00
|
|
|
|
+ ... = 2e − 3
|
|
|
|
|
a(2) =
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2e − 31!
|
|
|
|
|
+
|
|
|
|
|
e − 12!
|
|
|
|
|
+
|
|
|
|
|
13!
|
|
|
|
|
+ ... =
|
|
|
|
|
72
|
2018-10-08 00:01:53 +00:00
|
|
|
|
e − 6
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
with e = 2.7182818... being Euler's constant.
|
|
|
|
|
|
|
|
|
|
|
2018-10-08 00:01:53 +00:00
|
|
|
|
It can be shown that a(n) is of the form
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
A(n) e + B(n)n!
|
2018-10-08 00:01:53 +00:00
|
|
|
|
for integers A(n) and B(n).
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2018-10-08 00:01:53 +00:00
|
|
|
|
For example a(10) =
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
328161643 e − 65269448610!
|
|
|
|
|
.
|
|
|
|
|
|
|
|
|
|
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 13:37:37 +00:00
|
|
|
|
tests:
|
|
|
|
|
- text: <code>euler330()</code> should return 15955822.
|
2018-10-20 18:02:47 +00:00
|
|
|
|
testString: assert.strictEqual(euler330(), 15955822, '<code>euler330()</code> should return 15955822.');
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler330() {
|
|
|
|
|
// Good luck!
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler330();
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
|
|
|
|
</section>
|