56 lines
1.7 KiB
Markdown
56 lines
1.7 KiB
Markdown
---
|
||
id: 5900f4421000cf542c50ff55
|
||
challengeType: 5
|
||
title: 'Problem 214: Totient Chains'
|
||
videoUrl: ''
|
||
localeTitle: Проблема 214 Totient Цепи
|
||
---
|
||
|
||
## Description
|
||
<section id="description"> Пусть φ - функция тождества Эйлера, т. Е. Для натурального числа n, φ (n) - число k, 1 ≤ k ≤ n, для которого gcd (k, n) = 1. <p> Итерируя φ, каждое положительное целое порождает убывающую цепочку чисел, оканчивающуюся на 1. Например, если мы начнем с 5, то будет создана последовательность 5,4,2,1. Вот список всех цепочек длиной 4: </p><p> 5,4,2,1 7,6,2,1 8,4,2,1 9,6,2,1 10,4,2,1 12,4,2,1 14,6,2,1 18 , 6,2,1 </p><p> Только две из этих цепей начинаются с простого числа, их сумма равна 12. </p><p> Какова сумма всех простых чисел менее 40000000, которые генерируют цепочку длиной 25? </p></section>
|
||
|
||
## Instructions
|
||
<section id="instructions">
|
||
</section>
|
||
|
||
## Tests
|
||
<section id='tests'>
|
||
|
||
```yml
|
||
tests:
|
||
- text: <code>euler214()</code> должен вернуть 1677366278943.
|
||
testString: 'assert.strictEqual(euler214(), 1677366278943, "<code>euler214()</code> should return 1677366278943.");'
|
||
|
||
```
|
||
|
||
</section>
|
||
|
||
## Challenge Seed
|
||
<section id='challengeSeed'>
|
||
|
||
<div id='js-seed'>
|
||
|
||
```js
|
||
function euler214() {
|
||
// Good luck!
|
||
return true;
|
||
}
|
||
|
||
euler214();
|
||
|
||
```
|
||
|
||
</div>
|
||
|
||
|
||
|
||
</section>
|
||
|
||
## Solution
|
||
<section id='solution'>
|
||
|
||
```js
|
||
// solution required
|
||
```
|
||
</section>
|