Files
gikf c18554dd44 fix(curriculum): clean-up Project Euler 341-360 (#42998)
* fix: clean-up Project Euler 341-360

* fix: improve wording

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>
2021-07-29 19:14:22 +02:00

56 lines
1.2 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: 5900f4c41000cf542c50ffd6
title: 'Problem 343: Fractional Sequences'
challengeType: 5
forumTopicId: 302002
dashedName: problem-343-fractional-sequences
---
# --description--
For any positive integer $k$, a finite sequence $a_i$ of fractions $\frac{x_i}{y_i}$ is defined by:
- $a_1 = \displaystyle\frac{1}{k}$ and
- $a_i = \displaystyle\frac{(x_{i - 1} + 1)}{(y_{i - 1} - 1)}$ reduced to lowest terms for $i > 1$.
When $a_i$ reaches some integer $n$, the sequence stops. (That is, when $y_i = 1$.)
Define $f(k) = n$.
For example, for $k = 20$:
$$\frac{1}{20} → \frac{2}{19} → \frac{3}{18} = \frac{1}{6} → \frac{2}{5} → \frac{3}{4} → \frac{4}{3} → \frac{5}{2} → \frac{6}{1} = 6$$
So $f(20) = 6$.
Also $f(1) = 1$, $f(2) = 2$, $f(3) = 1$ and $\sum f(k^3) = 118\\,937$ for $1 ≤ k ≤ 100$.
Find $\sum f(k^3)$ for $1 ≤ k ≤ 2 × {10}^6$.
# --hints--
`fractionalSequences()` should return `269533451410884200`.
```js
assert.strictEqual(fractionalSequences(), 269533451410884200);
```
# --seed--
## --seed-contents--
```js
function fractionalSequences() {
return true;
}
fractionalSequences();
```
# --solutions--
```js
// solution required
```