chore(i18n,curriculum): update translations (#43375)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5a23c84252665b21eecc8028
|
||||
title: Stern-Brocot sequence
|
||||
title: Sequência de 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).
|
||||
Para esta tarefa, a sequência Stern-Brocot deve ser gerada por um algoritmo semelhante ao empregado na geração da [sequência de Fibonacci](https://rosettacode.org/wiki/Fibonacci sequence).
|
||||
|
||||
<ol>
|
||||
<li>The first and second members of the sequence are both 1:</li>
|
||||
<li>O primeiro e o segundo membros da sequência são ambos 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>Comece considerando o segundo membro da sequência</li>
|
||||
<li>Some o membro considerado da sequência e seu precedente, (1 + 1) = 2, e acrescente-o ao final da sequência:</li>
|
||||
<ul><li>1, 1, 2</li></ul>
|
||||
<li>Append the considered member of the sequence to the end of the sequence:</li>
|
||||
<li>Acrescente o membro considerado da sequência ao final da sequência:</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>Considere o próximo membro da série (o terceiro membro, ou seja, 2)</li>
|
||||
<li>IR PARA 3 </li>
|
||||
<ul>
|
||||
<li></li>
|
||||
<li> ─── Expanding another loop we get: ───</li>
|
||||
<li> ─── Expandindo outro laço, obtemos agora: ───</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>Some o membro considerado da sequência e seu precedente, (2 + 1) = 3, e acrescente-o ao final da sequência:</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>Acrescente o membro considerado da sequência ao final da sequência:</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>Considere o próximo membro da série (o quarto membro, ou seja, 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.
|
||||
Crie uma função que retorne a posição na sequência Stern-Brocot em que $ n $ é encontrado pela primeira vez, onde a sequência é gerada com o método descrito acima. Observe que essa sequência usa uma indexação baseada em 1.
|
||||
|
||||
# --hints--
|
||||
|
||||
`sternBrocot` should be a function.
|
||||
`sternBrocot` deve ser uma função.
|
||||
|
||||
```js
|
||||
assert(typeof sternBrocot == 'function');
|
||||
```
|
||||
|
||||
`sternBrocot(2)` should return a number.
|
||||
`sternBrocot(2)` deve retornar um número.
|
||||
|
||||
```js
|
||||
assert(typeof sternBrocot(2) == 'number');
|
||||
```
|
||||
|
||||
`sternBrocot(2)` should return `3`.
|
||||
`sternBrocot(2)` deve retornar `3`.
|
||||
|
||||
```js
|
||||
assert.equal(sternBrocot(2), 3);
|
||||
```
|
||||
|
||||
`sternBrocot(3)` should return `5`.
|
||||
`sternBrocot(3)` deve retornar `5`.
|
||||
|
||||
```js
|
||||
assert.equal(sternBrocot(3), 5);
|
||||
```
|
||||
|
||||
`sternBrocot(5)` should return `11`.
|
||||
`sternBrocot(5)` deve retornar `11`.
|
||||
|
||||
```js
|
||||
assert.equal(sternBrocot(5), 11);
|
||||
```
|
||||
|
||||
`sternBrocot(7)` should return `19`.
|
||||
`sternBrocot(7)` deve retornar `19`.
|
||||
|
||||
```js
|
||||
assert.equal(sternBrocot(7), 19);
|
||||
```
|
||||
|
||||
`sternBrocot(10)` should return `39`.
|
||||
`sternBrocot(10)` deve retornar `39`.
|
||||
|
||||
```js
|
||||
assert.equal(sternBrocot(10), 39);
|
||||
|
Reference in New Issue
Block a user