58 lines
1.6 KiB
Markdown
58 lines
1.6 KiB
Markdown
---
|
||
id: 5900f4141000cf542c50ff26
|
||
challengeType: 5
|
||
title: 'Problem 167: Investigating Ulam sequences'
|
||
forumTopicId: 301801
|
||
localeTitle: 'Задача 167: Исследование последовательностей Улама'
|
||
---
|
||
|
||
## Description
|
||
<section id='description'>
|
||
Для двух положительных целых чисел a и b последовательность Улама U (a, b) определяется U (a, b) 1 = a, U (a, b) 2 = b и для k> 2, U (a, b ) k - наименьшее целое число, большее U (a, b) (k-1), которое может быть записано ровно в одном виде как сумма двух разных предыдущих членов U (a, b). Например, последовательность U (1,2) начинается с 1, 2, 3 = 1 + 2, 4 = 1 + 3, 6 = 2 + 4, 8 = 2 + 6, 11 = 3 + 8; 5 не принадлежит ему, поскольку 5 = 1 + 4 = 2 + 3 имеет два представления в виде суммы двух предыдущих членов, равно 7 = 1 + 6 = 3 + 4. Найти ΣU (2,2n + 1) k для 2 ≤ n ≤ 10, где k = 1011.
|
||
</section>
|
||
|
||
## Instructions
|
||
<section id='instructions'>
|
||
|
||
</section>
|
||
|
||
## Tests
|
||
<section id='tests'>
|
||
|
||
```yml
|
||
tests:
|
||
- text: <code>euler167()</code> should return 3916160068885.
|
||
testString: assert.strictEqual(euler167(), 3916160068885);
|
||
|
||
```
|
||
|
||
</section>
|
||
|
||
## Challenge Seed
|
||
<section id='challengeSeed'>
|
||
|
||
<div id='js-seed'>
|
||
|
||
```js
|
||
function euler167() {
|
||
// Good luck!
|
||
return true;
|
||
}
|
||
|
||
euler167();
|
||
|
||
```
|
||
|
||
</div>
|
||
|
||
</section>
|
||
|
||
## Solution
|
||
<section id='solution'>
|
||
|
||
```js
|
||
// solution required
|
||
```
|
||
|
||
</section>
|