2021-06-15 00:49:18 -07:00
|
|
|
---
|
|
|
|
id: 5900f53c1000cf542c51004e
|
2022-03-04 19:46:29 +05:30
|
|
|
title: 'Problema 463: una strana relazione ricorrente'
|
2021-06-15 00:49:18 -07:00
|
|
|
challengeType: 5
|
|
|
|
forumTopicId: 302138
|
|
|
|
dashedName: problem-463-a-weird-recurrence-relation
|
|
|
|
---
|
|
|
|
|
|
|
|
# --description--
|
|
|
|
|
2022-03-04 19:46:29 +05:30
|
|
|
La funzione $f$ è definita per tutti i numeri interi positivi come segue:
|
2021-06-15 00:49:18 -07:00
|
|
|
|
2022-03-31 22:31:59 +05:30
|
|
|
$$\begin{align} & f(1) = 1 \\\\
|
|
|
|
& f(3) = 3 \\\\ & f(2n) = f(n) \\\\
|
|
|
|
& f(4n + 1) = 2f(2n + 1) - f(n) \\\\ & f(4n + 3) = 3f(2n + 1) - 2f(n) \end{align}$$
|
2021-06-15 00:49:18 -07:00
|
|
|
|
2022-03-04 19:46:29 +05:30
|
|
|
La funzione $S(n)$ è definita come $\sum_{i=1}^{n} f(i)$.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
2022-03-04 19:46:29 +05:30
|
|
|
$S(8) = 22$ e $S(100) = 3604$.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
2022-03-04 19:46:29 +05:30
|
|
|
Trova $S(3^{37})$. Dai le ultime 9 cifre della tua risposta.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
# --hints--
|
|
|
|
|
2022-03-04 19:46:29 +05:30
|
|
|
`weirdRecurrenceRelation()` dovrebbe restituire `808981553`.
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
```js
|
2022-03-04 19:46:29 +05:30
|
|
|
assert.strictEqual(weirdRecurrenceRelation(), 808981553);
|
2021-06-15 00:49:18 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
```js
|
2022-03-04 19:46:29 +05:30
|
|
|
function weirdRecurrenceRelation() {
|
2021-06-15 00:49:18 -07:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-03-04 19:46:29 +05:30
|
|
|
weirdRecurrenceRelation();
|
2021-06-15 00:49:18 -07:00
|
|
|
```
|
|
|
|
|
|
|
|
# --solutions--
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|