2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f5271000cf542c51003a
|
|
|
|
title: 'Problem 443: GCD sequence'
|
2020-11-27 18:02:05 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 302115
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-443-gcd-sequence
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
2019-07-18 15:32:12 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Let g(n) be a sequence defined as follows: g(4) = 13, g(n) = g(n-1) + gcd(n, g(n-1)) for n > 4.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
The first few values are:
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
n 4567891011121314151617181920... g(n) 1314161718272829303132333451545560...
|
|
|
|
|
2019-07-18 15:32:12 +00:00
|
|
|
<!-- TODO Use MathJax -->
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
You are given that g(1 000) = 2524 and g(1 000 000) = 2624152.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
Find g(1015).
|
|
|
|
|
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
|
|
|
`euler443()` should return 2744233049300770.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
|
|
|
assert.strictEqual(euler443(), 2744233049300770);
|
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 euler443() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler443();
|
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|