Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-337-totient-stairstep-sequences.md
gikf 1af6e7aa5a fix(curriculum): clean-up Project Euler 321-340 (#42988)
* fix: clean-up Project Euler 321-340

* fix: typo

* fix: corrections from review

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 11:59:06 -07:00

53 lines
995 B
Markdown

---
id: 5900f4be1000cf542c50ffd0
title: 'Problem 337: Totient Stairstep Sequences'
challengeType: 5
forumTopicId: 301995
dashedName: problem-337-totient-stairstep-sequences
---
# --description--
Let $\\{a_1, a_2, \ldots, a_n\\}$ be an integer sequence of length $n$ such that:
- $a_1 = 6$
- for all $1 ≤ i &lt; n$ : $φ(a_i) &lt; φ(a_{i + 1}) &lt; a_i &lt; a_{i + 1}$
$φ$ denotes Euler's totient function.
Let $S(N)$ be the number of such sequences with $a_n ≤ N$.
For example, $S(10) = 4$: {6}, {6, 8}, {6, 8, 9} and {6, 10}.
We can verify that $S(100) = 482\\,073\\,668$ and $S(10\\,000)\bmod {10}^8 = 73\\,808\\,307$.
Find $S(20\\,000\\,000)\bmod {10}^8$.
# --hints--
`totientStairstepSequences()` should return `85068035`.
```js
assert.strictEqual(totientStairstepSequences(), 85068035);
```
# --seed--
## --seed-contents--
```js
function totientStairstepSequences() {
return true;
}
totientStairstepSequences();
```
# --solutions--
```js
// solution required
```