2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
id: 5900f4be1000cf542c50ffd0
|
|
|
|
title: 'Problem 337: Totient Stairstep Sequences'
|
2020-11-27 19:02:05 +01:00
|
|
|
challengeType: 5
|
2019-08-05 09:17:33 -07:00
|
|
|
forumTopicId: 301995
|
2021-01-13 03:31:00 +01:00
|
|
|
dashedName: problem-337-totient-stairstep-sequences
|
2018-09-30 23:01:58 +01:00
|
|
|
---
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --description--
|
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
Let $\\{a_1, a_2, \ldots, a_n\\}$ be an integer sequence of length $n$ such that:
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
- $a_1 = 6$
|
|
|
|
- for all $1 ≤ i < n$ : $φ(a_i) < φ(a_{i + 1}) < a_i < a_{i + 1}$
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
$φ$ denotes Euler's totient function.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
Let $S(N)$ be the number of such sequences with $a_n ≤ N$.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
For example, $S(10) = 4$: {6}, {6, 8}, {6, 8, 9} and {6, 10}.
|
2020-11-27 19:02:05 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
We can verify that $S(100) = 482\\,073\\,668$ and $S(10\\,000)\bmod {10}^8 = 73\\,808\\,307$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
Find $S(20\\,000\\,000)\bmod {10}^8$.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --hints--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
`totientStairstepSequences()` should return `85068035`.
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
```js
|
2021-07-29 20:59:06 +02:00
|
|
|
assert.strictEqual(totientStairstepSequences(), 85068035);
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --seed--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
## --seed-contents--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
2021-07-29 20:59:06 +02:00
|
|
|
function totientStairstepSequences() {
|
2020-09-15 09:57:40 -07:00
|
|
|
|
2018-09-30 23:01:58 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-29 20:59:06 +02:00
|
|
|
totientStairstepSequences();
|
2018-09-30 23:01:58 +01:00
|
|
|
```
|
|
|
|
|
2020-11-27 19:02:05 +01:00
|
|
|
# --solutions--
|
2018-09-30 23:01:58 +01:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|