Files
freeCodeCamp/curriculum/challenges/ukrainian/10-coding-interview-prep/project-euler/problem-167-investigating-ulam-sequences.md

47 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f4141000cf542c50ff26
title: 'Задача 167: Дослідження послідовностей Уляма'
challengeType: 5
forumTopicId: 301801
dashedName: problem-167-investigating-ulam-sequences
---
# --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$.
Знайдіть $\sum {U(2, 2n + 1)_k}$ по $2 ≤ n 10$, де $k = {10}^{11}$.
# --hints--
`ulamSequences()` має повертати `3916160068885`.
```js
assert.strictEqual(ulamSequences(), 3916160068885);
```
# --seed--
## --seed-contents--
```js
function ulamSequences() {
return true;
}
ulamSequences();
```
# --solutions--
```js
// solution required
```