freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-443-gcd-sequence.md

71 lines
961 B
Markdown
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

---
id: 5900f5271000cf542c51003a
challengeType: 5
title: 'Problem 443: GCD sequence'
forumTopicId: 302115
---
## Description
<section id='description'>
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.
The first few values are:
n 4567891011121314151617181920...
g(n) 1314161718272829303132333451545560...
<!-- TODO Use MathJax -->
You are given that g(1 000) = 2524 and g(1 000 000) = 2624152.
Find g(1015).
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler443()</code> should return 2744233049300770.
testString: assert.strictEqual(euler443(), 2744233049300770);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler443() {
return true;
}
euler443();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>