2021-06-15 07:49:18 +00:00
|
|
|
---
|
|
|
|
id: 5900f4be1000cf542c50ffd0
|
2022-03-02 15:26:06 +00:00
|
|
|
title: 'Problema 337: Sequenze tozienti a gradino'
|
2021-06-15 07:49:18 +00:00
|
|
|
challengeType: 5
|
|
|
|
forumTopicId: 301995
|
|
|
|
dashedName: problem-337-totient-stairstep-sequences
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
Sia $\\{a_1, a_2, \ldots, a_n\\}$ una sequenza di interi di lunghezza $n$ tale che:
|
2021-06-15 07:49:18 +00:00
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
- $a_1 = 6$
|
|
|
|
- per ogni $1 ≤ i < n$ : $φ(a_i) < φ(a_{i + 1}) < a_i < a_{i + 1}$
|
2021-06-15 07:49:18 +00:00
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
$φ$ denota la funzione toziente di Eulero.
|
2021-06-15 07:49:18 +00:00
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
Sia $S(N)$ il numero di tali sequenze con $a_n ≤ N$.
|
2021-06-15 07:49:18 +00:00
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
Ad esempio, $S(10) = 4$: {6}, {6, 8}, {6, 8, 9} e {6, 10}.
|
2021-06-15 07:49:18 +00:00
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
Possiamo verificare che $S(100) = 482\\,073\\,668$ and $S(10\\,000)\bmod {10}^8 = 73\\,808\\,307$.
|
2021-06-15 07:49:18 +00:00
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
Trova $S(20\\,000\\,000)\bmod {10}^8$.
|
2021-06-15 07:49:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
`totientStairstepSequences()` dovrebbe restituire `85068035`.
|
2021-06-15 07:49:18 +00:00
|
|
|
|
|
|
|
```js
|
2022-03-02 15:26:06 +00:00
|
|
|
assert.strictEqual(totientStairstepSequences(), 85068035);
|
2021-06-15 07:49:18 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
2022-03-02 15:26:06 +00:00
|
|
|
function totientStairstepSequences() {
|
2021-06-15 07:49:18 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-03-02 15:26:06 +00:00
|
|
|
totientStairstepSequences();
|
2021-06-15 07:49:18 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|