chore(i18n,learn): processed translations (#45165)

This commit is contained in:
camperbot
2022-02-19 12:56:08 +05:30
committed by GitHub
parent 8138a07d52
commit ba14990876
134 changed files with 1540 additions and 1511 deletions

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc8028
title: Stern-Brocot sequence
title: Sequenza di Stern-Brocot
challengeType: 5
forumTopicId: 302324
dashedName: stern-brocot-sequence
@ -8,75 +8,73 @@ dashedName: stern-brocot-sequence
# --description--
For this task, the Stern-Brocot sequence is to be generated by an algorithm similar to that employed in generating the [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence).
Per questa sfida, la serie di Stern-Brocot deve essere generata da un algoritmo simile a quello usato per generare la [serie di Fibonacci](https://rosettacode.org/wiki/Fibonacci sequence).
<ol>
<li>The first and second members of the sequence are both 1:</li>
<li>Il primo e il secondo elemento della serie sono entrambi 1:</li>
<ul><li>1, 1</li></ul>
<li>Start by considering the second member of the sequence</li>
<li>Sum the considered member of the sequence and its precedent, (1 + 1) = 2, and append it to the end of the
sequence:</li>
<li>Inizia considerando il secondo elemento della serie</li>
<li>Somma l'elemento considerato della sequenza e il precedente, (1 + 1) = 2, e aggiungilo alla fine della sequenza:</li>
<ul><li>1, 1, 2</li></ul>
<li>Append the considered member of the sequence to the end of the sequence:</li>
<li>Aggiungi l'elemento considerato alla fine della sequenza:</li>
<ul><li>1, 1, 2, 1</li></ul>
<li>Consider the next member of the series, (the third member i.e. 2)</li>
<li>GOTO 3 </li>
<li>Considera l'elemento successivo della serie, (il terzo elemento, cioè 2)</li>
<li>Vai a 3 </li>
<ul>
<li></li>
<li> ─── Expanding another loop we get: ───</li>
<li> ─── Espandendo un altro ciclo otteniamo: ───</li>
<li></li>
</ul>
<li>Sum the considered member of the sequence and its precedent, (2 + 1) = 3, and append it to the end of the
sequence:</li>
<li>Somma l'elemento considerato della sequenza e il suo predecessore, (2 + 1) = 3, e appendilo alla fine della sequenza:</li>
<ul><li>1, 1, 2, 1, 3</li></ul>
<li>Append the considered member of the sequence to the end of the sequence:</li>
<li>Aggiungi l'elemento considerato alla fine della sequenza:</li>
<ul><li>1, 1, 2, 1, 3, 2</li></ul>
<li>Consider the next member of the series, (the fourth member i.e. 1)</li>
<li>Considera l'elemento successivo della serie, (il quarto elemento, cioè 1)</li>
</ol>
# --instructions--
Create a function that returns the position in the Stern-Brocot sequence at which $ n $ is first encountered, where the sequence is generated with the method outlined above. Note that this sequence uses 1 based indexing.
Crea una funzione che restituisce la posizione della serie di Stern-Brocot a cui $ n $ si trova per la prima volte, dove la serie è generata con il metodo mostrato sopra. Nota che questa sequenza usa indicizzazione che parte da 1.
# --hints--
`sternBrocot` should be a function.
`sternBrocot` dovrebbe essere una funzione.
```js
assert(typeof sternBrocot == 'function');
```
`sternBrocot(2)` should return a number.
`sternBrocot(2)` dovrebbe restituire un numero.
```js
assert(typeof sternBrocot(2) == 'number');
```
`sternBrocot(2)` should return `3`.
`sternBrocot(2)` dovrebbe restiture `3`.
```js
assert.equal(sternBrocot(2), 3);
```
`sternBrocot(3)` should return `5`.
`sternBrocot(3)` dovrebbe restituire `5`.
```js
assert.equal(sternBrocot(3), 5);
```
`sternBrocot(5)` should return `11`.
`sternBrocot(5)` dovrebbe restiture `11`.
```js
assert.equal(sternBrocot(5), 11);
```
`sternBrocot(7)` should return `19`.
`sternBrocot(7)` dovrebbe restiture `19`.
```js
assert.equal(sternBrocot(7), 19);
```
`sternBrocot(10)` should return `39`.
`sternBrocot(10)` dovrebbe restiture `39`.
```js
assert.equal(sternBrocot(10), 39);