2018-09-30 22:01:58 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4c41000cf542c50ffd6
|
|
|
|
|
title: 'Problem 343: Fractional Sequences'
|
2020-11-27 18:02:05 +00:00
|
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
|
forumTopicId: 302002
|
2021-01-13 02:31:00 +00:00
|
|
|
|
dashedName: problem-343-fractional-sequences
|
2018-09-30 22:01:58 +00:00
|
|
|
|
---
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --description--
|
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
For any positive integer k, a finite sequence ai of fractions xi/yi is defined by:
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
a1 = 1/k and
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
ai = (xi-1+1)/(yi-1-1) reduced to lowest terms for i>1.
|
2020-11-27 18:02:05 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
When ai reaches some integer n, the sequence stops. (That is, when yi=1.)
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
Define f(k) = n.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
For example, for k = 20:
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
1/20 → 2/19 → 3/18 = 1/6 → 2/5 → 3/4 → 4/3 → 5/2 → 6/1 = 6
|
|
|
|
|
|
|
|
|
|
So f(20) = 6.
|
|
|
|
|
|
|
|
|
|
Also f(1) = 1, f(2) = 2, f(3) = 1 and Σf(k3) = 118937 for 1 ≤ k ≤ 100.
|
|
|
|
|
|
|
|
|
|
Find Σf(k3) for 1 ≤ k ≤ 2×106.
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --hints--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
`euler343()` should return 269533451410884200.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
```js
|
|
|
|
|
assert.strictEqual(euler343(), 269533451410884200);
|
2018-09-30 22:01:58 +00:00
|
|
|
|
```
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --seed--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
## --seed-contents--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler343() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler343();
|
|
|
|
|
```
|
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|