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

This commit is contained in:
camperbot
2022-02-16 22:48:09 +05:30
committed by GitHub
parent 51c8b065f5
commit c934590548
48 changed files with 515 additions and 492 deletions

View File

@ -1,6 +1,6 @@
---
id: 59880443fb36441083c6c20e
title: Euler method
title: Metodo di Eulero
challengeType: 5
forumTopicId: 302258
dashedName: euler-method
@ -8,63 +8,63 @@ dashedName: euler-method
# --description--
Euler's method numerically approximates solutions of first-order ordinary differential equations (ODEs) with a given initial value. It is an explicit method for solving initial value problems (IVPs), as described in [the wikipedia page](https://en.wikipedia.org/wiki/Euler method "wp: Euler method").
Il metodo di Eulero approssima numericamente le soluzioni di equazioni differenziali ordinarie di primo ordine (ordinary differential equations in inglese - ODEs) con un dato valore iniziale. Si tratta di un metodo esplicito per risolvere i problemi di valore iniziale (IVP), come descritto in [questo articolo](https://www.freecodecamp.org/news/eulers-method-explained-with-examples/ "news: Euler's Method Explained with Examples").
The ODE has to be provided in the following form:
L'ODE deve essere fornita nella seguente forma:
<ul style='list-style: none;'>
<li><big>$\frac{dy(t)}{dt} = f(t,y(t))$</big></li>
</ul>
with an initial value
con un valore iniziale
<ul style='list-style: none;'>
<li><big>$y(t_0) = y_0$</big></li>
</ul>
To get a numeric solution, we replace the derivative on the LHS with a finite difference approximation:
Per ottenere una soluzione numerica, sostituiamo il derivato sul LHS con un'approssimazione alle differenze finite:
<ul style='list-style: none;'>
<li><big>$\frac{dy(t)}{dt} \approx \frac{y(t+h)-y(t)}{h}$</big></li>
</ul>
then solve for $y(t+h)$:
poi risolvere per $y(t+h)$:
<ul style='list-style: none;'>
<li><big>$y(t+h) \approx y(t) + h \, \frac{dy(t)}{dt}$</big></li>
</ul>
which is the same as
che è come
<ul style='list-style: none;'>
<li><big>$y(t+h) \approx y(t) + h \, f(t,y(t))$</big></li>
</ul>
The iterative solution rule is then:
La regola della soluzione iterativa è:
<ul style='list-style: none;'>
<li><big>$y_{n+1} = y_n + h \, f(t_n, y_n)$</big></li>
</ul>
where $h$ is the step size, the most relevant parameter for accuracy of the solution. A smaller step size increases accuracy but also the computation cost, so it has always has to be hand-picked according to the problem at hand.
dove $h$ è la dimensione del passo, il parametro più rilevante per la precisione della soluzione. Un passo più piccolo aumenta l'accuratezza ma anche il costo di calcolo, quindi deve essere sempre scelto manualmente in base al problema da affrontare.
**Example: Newton's Cooling Law**
**Esempio: Legge di raffreddamento di Newton**
Newton's cooling law describes how an object of initial temperature $T(t_0) = T_0$ cools down in an environment of temperature $T_R$:
La legge di raffreddamento di Newton descrive come un oggetto di temperatura iniziale $T(t_0) = T_0$ si raffredda in un ambiente di temperatura $T_R$:
<ul style='list-style: none;'>
<li><big>$\frac{dT(t)}{dt} = -k \, \Delta T$</big></li>
</ul>
or
oppure
<ul style='list-style: none;'>
<li><big>$\frac{dT(t)}{dt} = -k \, (T(t) - T_R)$</big></li>
</ul>
It says that the cooling rate $\\frac{dT(t)}{dt}$ of the object is proportional to the current temperature difference $\\Delta T = (T(t) - T_R)$ to the surrounding environment.
Dice che il tasso di raffreddamento $\\frac{dT(t)}{dt}$ dell'oggetto è proporzionale alla differenza tra la temperatura corrente dell'oggetto $\\Delta T = (T(t) - T_R)$ e quella dell'ambiente circostante.
The analytical solution, which we will compare to the numerical approximation, is
La soluzione analitica, che confronteremo con l'approssimazione numerica, è
<ul style='list-style: none;'>
<li><big>$T(t) = T_R + (T_0 - T_R) \; e^{-k t}$</big></li>
@ -72,54 +72,54 @@ The analytical solution, which we will compare to the numerical approximation, i
# --instructions--
Implement a routine of Euler's method and then use it to solve the given example of Newton's cooling law for three different step sizes of:
Implementa una routine del metodo di Eulero e quindi usala per risolvere l'esempio dato della legge di raffreddamento di Newton per tre diverse dimensioni di passo di:
<ul>
<li><code>2 s</code></li>
<li><code>5 s</code> and</li>
<li><code>5 s</code> e</li>
<li><code>10 s</code></li>
</ul>
and compare with the analytical solution.
e confrontala con la soluzione analitica.
**Initial values:**
**Valori iniziali:**
<ul>
<li>initial temperature <big>$T_0$</big> shall be <code>100 °C</code></li>
<li>room temperature <big>$T_R$</big> shall be <code>20 °C</code></li>
<li>cooling constant <big>$k$</big> shall be <code>0.07</code></li>
<li>time interval to calculate shall be from <code>0 s</code> to <code>100 s</code></li>
<li>la temperatura iniziale <big>$T_0$</big> deve essere <code>100 °C</code></li>
<li>temperatura ambiente <big>$T_R$</big> deve essere <code>20 °C</code></li>
<li>costante di raffreddamento <big>$k$</big> deve essere <code>0.07</code></li>
<li>l'intervallo di tempo per il calcolo deve essere compreso tra <code>0 s</code> e <code>100 s</code></li>
</ul>
First parameter to the function is initial time, second parameter is initial temperature, third parameter is elapsed time and fourth parameter is step size.
Il primo parametro per la funzione è il tempo iniziale, il secondo parametro è la temperatura iniziale, il terzo parametro è il tempo trascorso e il quarto parametro è la dimensione del passo.
# --hints--
`eulersMethod` should be a function.
`eulersMethod` dovrebbe essere una funzione.
```js
assert(typeof eulersMethod === 'function');
```
`eulersMethod(0, 100, 100, 2)` should return a number.
`eulersMethod(0, 100, 100, 2)` dovrebbe restituire un numero.
```js
assert(typeof eulersMethod(0, 100, 100, 2) === 'number');
```
`eulersMethod(0, 100, 100, 2)` should return 20.0424631833732.
`eulersMethod(0, 100, 100, 2)` dovrebbe restituire 20.0424631833732.
```js
assert.equal(eulersMethod(0, 100, 100, 2), 20.0424631833732);
```
`eulersMethod(0, 100, 100, 5)` should return 20.01449963666907.
`eulersMethod(0, 100, 100, 5)`dovrebbe restituire 20.01449963666907.
```js
assert.equal(eulersMethod(0, 100, 100, 5), 20.01449963666907);
```
`eulersMethod(0, 100, 100, 10)` should return 20.000472392.
`eulersMethod(0, 100, 100, 10)` dovrebbe restituire 20.000472392.
```js
assert.equal(eulersMethod(0, 100, 100, 10), 20.000472392);

View File

@ -1,6 +1,6 @@
---
id: 598de241872ef8353c58a7a2
title: Evaluate binomial coefficients
title: Valuta i coefficienti binomiali
challengeType: 5
forumTopicId: 302259
dashedName: evaluate-binomial-coefficients
@ -8,45 +8,45 @@ dashedName: evaluate-binomial-coefficients
# --description--
Write a function to calculate the binomial coefficient for the given value of n and k.
Scrivi una funzione per calcolare il coefficiente binomiale per il valore dato di n e k.
This formula is recommended:
Questa formula è consigliata:
$\\binom{n}{k} = \\frac{n!}{(n-k)!k!} = \\frac{n(n-1)(n-2)\\ldots(n-k+1)}{k(k-1)(k-2)\\ldots 1}$
# --hints--
`binom` should be a function.
`binom` dovrebbe essere una funzione.
```js
assert(typeof binom === 'function');
```
`binom(5,3)` should return 10.
`binom(5,3)` dovrebbe restituire 10.
```js
assert.equal(binom(5, 3), 10);
```
`binom(7,2)` should return 21.
`binom(7,2)` dovrebbe restituire 21.
```js
assert.equal(binom(7, 2), 21);
```
`binom(10,4)` should return 210.
`binom(10,4)` dovrebbe restituire 210.
```js
assert.equal(binom(10, 4), 210);
```
`binom(6,1)` should return 6.
`binom(6,1)` dovrebbe restituire 6.
```js
assert.equal(binom(6, 1), 6);
```
`binom(12,8)` should return 495.
`binom(12,8)` dovrebbe restituire 495.
```js
assert.equal(binom(12, 8), 495);

View File

@ -1,6 +1,6 @@
---
id: 59e09e6d412c5939baa02d16
title: Execute a Markov algorithm
title: Eseguire un algoritmo di Markov
challengeType: 5
forumTopicId: 302260
dashedName: execute-a-markov-algorithm
@ -8,9 +8,9 @@ dashedName: execute-a-markov-algorithm
# --description--
Create an interpreter for a [Markov Algorithm](https://en.wikipedia.org/wiki/Markov algorithm "wp: Markov algorithm").
Crea un interprete per un [Algoritmo di Markov](https://en.wikipedia.org/wiki/Markov algorithm "wp: Markov algorithm").
Rules have the syntax:
Le regole hanno questa sintassi:
<pre>[ruleset] ::= (([comment] | [rule]) [newline]+)*
[comment] ::= # {[any character]}
@ -18,19 +18,19 @@ Rules have the syntax:
[whitespace] ::= ([tab] | [space]) [[whitespace]]
</pre>
There is one rule per line.
C'è una regola per riga.
If there is a `.` (period) present before the \[replacement], then this is a terminating rule in which case the interpreter must halt execution.
Se c'è un `.` (punto) prima del \[replacement], allora questa è una regola di termine, in tal caso l'interprete deve fermare l'esecuzione.
A ruleset consists of a sequence of rules, with optional comments.
Un set di regole consiste in una sequenza di regole, con commenti opzionali.
Rulesets
Set di regole
Use the following tests on entries:
Usa i seguenti test sulle voci:
**Ruleset 1:**
**Set di regole 1:**
<pre># This rules file is extracted from Wikipedia:
<pre># Questo file di regole è estratto da wikipedia
# <code>http://en.wikipedia.org/wiki/Markov_Algorithm</code>
A -> apple
B -> bag
@ -40,13 +40,13 @@ the shop -> my brother
a never used -> .terminating rule
</pre>
Sample text of `I bought a B of As from T S.` should generate the output `I bought a bag of apples from my brother.`
Il testo di esempio `I bought a B of As from T S.` dovrebbe generare l'output di `I bought a bag of apples from my brother.`
**Ruleset 2:**
**Set di regole 2:**
A test of the terminating rule
Un test della regola di termine
<pre># Slightly modified from the rules on Wikipedia
<pre># Modificato leggermente dalle regole prese da Wikipedia
A -> apple
B -> bag
S -> .shop
@ -55,11 +55,11 @@ the shop -> my brother
a never used -> .terminating rule
</pre>
Sample text of `I bought a B of As from T S.` should generate `I bought a bag of apples from T shop.`
Il test di esempio `I bought a B of As from T S.` dovrebbe generare `I bought a bag of apples from T shop.`
**Ruleset 3:**
**Set di regole 3:**
This tests for correct substitution order and may trap simple regexp based replacement routines if special regexp characters are not escaped.
Questo verifica il corretto ordine di sostituzione e può contenere semplici routine di sostituzione basate su espressioni regolari se non viene fatto l'escape dei caratteri speciali regexp.
<pre># BNF Syntax testing rules
A -> apple
@ -74,23 +74,23 @@ the shop -> my brother
a never used -> .terminating rule
</pre>
Sample text of `I bought a B of As W my Bgage from T S.` should generate `I bought a bag of apples with my money from T shop.`
Il testo di esempio `I bought a B of As W my Bgage from T S.` dovrebbe generare `I bought a bag of apples with my money from T shop.`
**Ruleset 4:**
**Set di regole 4:**
This tests for correct order of scanning of rules, and may trap replacement routines that scan in the wrong order. It implements a general unary multiplication engine. (Note that the input expression must be placed within underscores in this implementation.)
Questo verifica il corretto ordine di scansione delle regole, e può contenere routine di sostituzione che scansionano in ordine sbagliato. Implementa un generico motore di moltiplicazione unario. (Si noti che l'espressione di input deve essere inserita all'interno di underscore in questa implementazione.)
<pre>### Unary Multiplication Engine, for testing Markov Algorithm implementations
<pre>### Macchina di moltiplicazione unitaria, per testare l'implementazione dell'algoritmo di Markov
### By Donal Fellows.
# Unary addition engine
# Macchina di addizione unitaria
_+1 -> _1+
1+1 -> 11+
# Pass for converting from the splitting of multiplication into ordinary
# addition
# Passaggio per convertire dalla separazione della moltiplicazione
# ad ordinaria addizione
1! -> !1
,! -> !+
_! -> _
# Unary multiplication by duplicating left side, right side times
# Moltiplicazione unaria, duplicando il lato sinistro tante volte quante dice il lato destro
1*1 -> x,@y
1x -> xX
X, -> 1,1
@ -99,82 +99,82 @@ _x -> _X
,x -> ,X
y1 -> 1y
y_ -> _
# Next phase of applying
# Prossima fase di apllicazione
1@1 -> x,@y
1@_ -> @_
,@_ -> !_
++ -> +
# Termination cleanup for addition
# Pulizia dei terminali per l'addizione
_1 -> 1
1+_ -> 1
_+_ ->
</pre>
Sample text of `_1111*11111_` should generate the output `11111111111111111111`
Il testo di esempio `_1111*11111_` dovrebbe generare l'output `11111111111111111111`
**Ruleset 5:**
**Set di regole 5:**
A simple [Turing machine](http://en.wikipedia.org/wiki/Turing_machine "link: http&#x3A;//en.wikipedia.org/wiki/Turing_machine"), implementing a three-state [busy beaver](http://en.wikipedia.org/wiki/Busy_beaver "link: http&#x3A;//en.wikipedia.org/wiki/Busy_beaver").
Una semplice [macchina di Turing](http://en.wikipedia.org/wiki/Turing_machine "link: http&#x3A;//en.wikipedia.org/wiki/Turing_machine"), che implementa un [alacre castoro](https://it.wikipedia.org/wiki/Alacre_castoro "link: http&#x3A;//it.wikipedia.org/wiki/Alacre_castoro") a tre stati.
The tape consists of `0`s and `1`s, the states are `A`, `B`, `C` and `H` (for `H`alt), and the head position is indicated by writing the state letter before the character where the head is. All parts of the initial tape the machine operates on have to be given in the input.
Il nastro è costituito da `0` e `1`, gli stati sono `A`, `B`, `C` e `H` (per `H`alt), e la posizione della testa è indicata scrivendo la lettera di stato prima del carattere in cui si trova la testa. Tutte le parti del nastro iniziale su cui la macchina opera devono essere fornite in ingresso.
Besides demonstrating that the Markov algorithm is Turing-complete, it also made me catch a bug in the C++ implementation which wasn't caught by the first four rulesets.
Oltre a dimostrare che l'algoritmo di Markov è Turing-completo, mi ha anche fatto catturare un bug nell'implementazione C++ che non era stato catturato dalle prime quattro regole.
<pre># Turing machine: three-state busy beaver
<pre># Macchina di Turing: castoro alacre
#
# state A, symbol 0 => write 1, move right, new state B
# stato A, simbolo 0 => scrive 1, si sposta a destra, nuovo stato B
A0 -> 1B
# state A, symbol 1 => write 1, move left, new state C
# stato A, simbolo 1 => scrive 1, si sposta a sinistra, nuovo stato C
0A1 -> C01
1A1 -> C11
# state B, symbol 0 => write 1, move left, new state A
# state B, simbolo 0 => scrive 1, si sposta a sinistra, nuovo stato A
0B0 -> A01
1B0 -> A11
# state B, symbol 1 => write 1, move right, new state B
# stato B, simbolo 1 => scrive 1, si sposta a destra, nuovo stato B
B1 -> 1B
# state C, symbol 0 => write 1, move left, new state B
# stato C, simbolo 0 => scrive 1, si sposta a sinistra, nuovo stato B
0C0 -> B01
1C0 -> B11
# state C, symbol 1 => write 1, move left, halt
# stato C, simbolo 1 => scrive 1, si sposta a sinistra, si ferma
0C1 -> H01
1C1 -> H11
</pre>
This ruleset should turn `000000A000000` into `00011H1111000`
Questa regola dovrebbe trasformare `000000A000000` in `00011H1111000`
# --hints--
`markov` should be a function.
`markov` dovrebbe essere una funzione.
```js
assert(typeof markov === 'function');
```
`markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` should return "I bought a bag of apples from my brother.".
`markov(["A -> apple","B -> bag","S -> shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` dovrebbe restituire "I bought a bag of apples from my brother.".
```js
assert.deepEqual(markov(rules[0], tests[0]), outputs[0]);
```
`markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` should return "I bought a bag of apples from T shop.".
`markov(["A -> apple","B -> bag","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As from T S.")` dovrebbe restituire "I bought a bag of apples from T shop.".
```js
assert.deepEqual(markov(rules[1], tests[1]), outputs[1]);
```
`markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")` should return "I bought a bag of apples with my money from T shop.".
`markov(["A -> apple","WWWW -> with","Bgage -> ->.*","B -> bag","->.* -> money","W -> WW","S -> .shop","T -> the","the shop -> my brother","a never used -> .terminating rule"],"I bought a B of As W my Bgage from T S.")` dovrebbe restituire "I bought a bag of apples with my money from T shop.".
```js
assert.deepEqual(markov(rules[2], tests[2]), outputs[2]);
```
`markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")` should return "11111111111111111111".
`markov(["_+1 -> _1+","1+1 -> 11+","1! -> !1",",! -> !+","_! -> _","1*1 -> x,@y","1x -> xX","X, -> 1,1","X1 -> 1X","_x -> _X",",x -> ,X","y1 -> 1y","y_ -> _","1@1 -> x,@y","1@_ -> @_",",@_ -> !_","++ -> +","_1 -> 1","1+_ -> 1","_+_ -> "],"_1111*11111_")` dovrebbe restituire "11111111111111111111".
```js
assert.deepEqual(markov(rules[3], tests[3]), outputs[3]);
```
`markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")` should return "00011H1111000".
`markov(["A0 -> 1B","0A1 -> C01","1A1 -> C11","0B0 -> A01","1B0 -> A11","B1 -> 1B","0C0 -> B01","1C0 -> B11","0C1 -> H01","1C1 -> H11"],"")` dovrebbe restituire "00011H1111000".
```js
assert.deepEqual(markov(rules[4], tests[4]), outputs[4]);

View File

@ -1,6 +1,6 @@
---
id: 59e0a8df964e4540d5abe599
title: Execute Brain****
title: Esegui Brain****
challengeType: 5
forumTopicId: 302261
dashedName: execute-brain
@ -8,54 +8,54 @@ dashedName: execute-brain
# --description--
Write a function to implement a Brain\*\*\*\* interpreter. The function will take a string as a parameter and should return a string as the output. More details are given below:
Scrivi una funzione per implementare un interprete Brain\*\*\*\*. La funzione dovrà prendere una stringa come parametro e restituire una stringa come output. Maggiori dettagli sono riportati di seguito:
RCBF is a set of [Brainf\*\*\*](https://rosettacode.org/wiki/Brainf*** "Brainf\*\*\*") compilers and interpreters written for Rosetta Code in a variety of languages.
RCBF è un set di compilatori e interpreti [Brainf\*\*\*](https://rosettacode.org/wiki/Brainf*** "Brainf\*\*\*") scritti per Rosetta Code in una varietà di linguaggi.
Below are links to each of the versions of RCBF.
Di seguito sono riportati i link a ciascuna delle versioni di RCBF.
An implementation need only properly implement the following instructions:
Un'implementazione deve solo attuare correttamente le seguenti istruzioni:
| Command | Description |
| ------------------------- | ------------------------------------------------------------------------------------------ |
| <code>></code> | Move the pointer to the right |
| <code>&lt;</code> | Move the pointer to the left |
| <code>+</code> | Increment the memory cell under the pointer |
| <code>-</code> | Decrement the memory cell under the pointer |
| <code>.</code> | Output the character signified by the cell at the pointer |
| <code>,</code> | Input a character and store it in the cell at the pointer |
| <code>\[</code> | Jump past the matching <code>]</code> if the cell under the pointer is 0 |
| <code>]</code> | Jump back to the matching <code>\[</code> if the cell under the pointer is nonzero |
| Comando | Descrizione |
| ------------------------- | ---------------------------------------------------------------------------------------------------- |
| <code>></code> | Sposta il puntatore a destra |
| <code>&lt;</code> | Sposta il puntatore a sinistra |
| <code>+</code> | Incrementa la cella di memoria al puntatore |
| <code>-</code> | Decrementa la cella di memoria al puntatore |
| <code>.</code> | Esegue l'output del carattere indicato dalla cella al puntatore |
| <code>,</code> | Inserisci un carattere e memorizzalo nella cella al puntatore |
| <code>\[</code> | Salta oltre la corrispondente <code>]</code> se la cella al puntatore è 0 |
| <code>]</code> | Torna indietro alla corrispondente <code>\[</code> se la cella sotto il puntatore non è zero |
Any cell size is allowed, EOF (*E*nd-*O*-*F*ile) support is optional, as is whether you have bounded or unbounded memory.
Qualsiasi dimensione della cella è consentita, il supporto EOF (*E*nd-*O*f-*F*ile) è opzionale, come se tu avessi una memoria limitata o illimitata.
# --hints--
`brain(bye)` should return a string
`brain(bye)` dovrebbe restituire una stringa
```js
assert(typeof brain(bye) === 'string');
```
`brain("++++++[>++++++++++<-]>+++++.")` should return "A"
`brain("++++++[>++++++++++<-]>+++++.")` dovrebbe restituire "A"
```js
assert.equal(brain('++++++[>++++++++++<-]>+++++.'), 'A');
```
`brain(bye)` should return `Goodbye, World!\r\n`
`brain(bye)` dovrebbe restituire `Goodbye, World!\r\n`
```js
assert.equal(brain(bye), 'Goodbye, World!\r\n');
```
`brain(hello)` should return `Hello World!\n`
`brain(hello)` dovrebbe restituire `Hello World!\n`
```js
assert.equal(brain(hello), 'Hello World!\n');
```
`brain(fib)` should return `1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89`
`brain(fib)` dovrebbe restituire `1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89`
```js
assert.equal(brain(fib), '1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89');

View File

@ -1,6 +1,6 @@
---
id: 598ee8b91b410510ae82efef
title: Extensible prime generator
title: Generatore di primi estensibile
challengeType: 5
forumTopicId: 302262
dashedName: extensible-prime-generator
@ -8,28 +8,28 @@ dashedName: extensible-prime-generator
# --description--
Write a generator of prime numbers, in order, that will automatically adjust to accommodate the generation of any reasonably high prime.
Scrivi un generatore di numeri primi, in ordine, che si adeguerà automaticamente per ospitare la generazione di qualsiasi primo ragionevolmente alto.
The generator should be able to:
Il generatore dovrebbe riuscire a compiere le seguenti azioni:
<ul>
<li>Show the first <code>n</code> prime numbers</li>
<li>Show the prime numbers in a range</li>
<li>Show the number of primes in a range</li>
<li>Show the <code>n<sup>th</sup></code> prime number</li>
<li>Mostrare i primi <code>n</code> numeri primi</li>
<li>Mostrare i numeri primi in un range</li>
<li>Mostrare quanti numeri primi sono presenti in un range</li>
<li>Mostra l'<code>n<sup>mo</sup></code> numero primo</li>
</ul>
The function should have two parameters. The first will receive `n` or the range as an array. The second will receive a boolean, that specifies if the function returns the prime numbers as an array or a single number(the number of primes in the range or the <code>n<sup>th</sup></code> prime). According to the parameters the function should return an array.
La funzione dovrebbe avere due parametri. Il primo riceve `n` o l'intervallo come un array. Il secondo riceverà un booleano, che specifica se la funzione restituisce i numeri primi come un array o un singolo numero (il numero di primi nell'intervallo o l'<code>n<sup>mo</sup></code> primo). A seconda dei parametri la funzione dovrebbe restituire un array.
# --hints--
`primeGenerator` should be a function.
`primeGenerator` dovrebbe essere una funzione.
```js
assert(typeof primeGenerator === 'function');
```
`primeGenerator(20, true)` should return `[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]`.
`primeGenerator(20, true)` dovrebbe restituire `[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71]`.
```js
assert.deepEqual(primeGenerator(20, true), [
@ -56,7 +56,7 @@ assert.deepEqual(primeGenerator(20, true), [
]);
```
`primeGenerator([100, 150], true)` should return `[101, 103, 107, 109, 113, 127, 131, 137, 139, 149]`.
`primeGenerator([100, 150], true)` dovrebbe restituire `[101, 103, 107, 109, 113, 127, 131, 137, 139, 149]`.
```js
assert.deepEqual(primeGenerator([100, 150], true), [
@ -73,13 +73,13 @@ assert.deepEqual(primeGenerator([100, 150], true), [
]);
```
`primeGenerator([7700, 8000], false)` should return `30`.
`primeGenerator([7700, 8000], false)` dovrebbe restituire `30`.
```js
assert.equal(primeGenerator([7700, 8000], false), 30);
```
`primeGenerator(10000, false)` should return `104729`.
`primeGenerator(10000, false)` dovrebbe restituire `104729`.
```js
assert.equal(primeGenerator(10000, false), 104729);

View File

@ -1,6 +1,6 @@
---
id: 597b2b2a2702b44414742771
title: Factorial
title: Fattoriale
challengeType: 5
forumTopicId: 302263
dashedName: factorial
@ -8,49 +8,49 @@ dashedName: factorial
# --description--
Write a function to return the factorial of a number.
Scrivi una funzione che restituisce il fattoriale di un numero.
Factorial of a number is given by:
Il fattoriale di un numero è dato da:
<pre><big>n! = n * (n-1) * (n-2) * ..... * 1</big>
</pre>
For example:
Ad esempio:
<ul>
<li><code>3! = 3 * 2 * 1 = 6</code></li>
<li><code>4! = 4 * 3 * 2 * 1 = 24</code></li>
</ul>
**Note:** `0! = 1`
**Nota:** `0! = 1`
# --hints--
`factorial` should be a function.
`factorial` dovrebbe essere una funzione.
```js
assert(typeof factorial === 'function');
```
`factorial(2)` should return a number.
`factorial(2)` dovrebbe restituire un numero.
```js
assert(typeof factorial(2) === 'number');
```
`factorial(3)` should return 6.
`factorial(3)` dovrebbe restituire 6.
```js
assert.equal(factorial(3), 6);
```
`factorial(5)` should return 120.
`factorial(5)` dovrebbe restituire 120.
```js
assert.equal(factorial(5), 120);
```
`factorial(10)` should return 3,628,800.
`factorial(10)` dovrebbe restituire 3,628,800.
```js
assert.equal(factorial(10), 3628800);

View File

@ -1,6 +1,6 @@
---
id: 598eea87e5cf4b116c3ff81a
title: Factors of a Mersenne number
title: I fattori di un numero di Mersenne
challengeType: 5
forumTopicId: 302264
dashedName: factors-of-a-mersenne-number
@ -8,25 +8,25 @@ dashedName: factors-of-a-mersenne-number
# --description--
A Mersenne number is a number in the form of <code>2<sup>P</sup>-1</code>.
Un numero di Mersenne è un numero nella forma di <code>2<sup>P</sup>-1</code>.
If `P` is prime, the Mersenne number may be a Mersenne prime. (If `P` is not prime, the Mersenne number is also not prime.)
Se `P` è primo, il numero di Mersenne può essere un primo di Mersenne. (Se `P` non è primo, anche il numero di Mersenne non è primo.)
In the search for Mersenne prime numbers it is advantageous to eliminate exponents by finding a small factor before starting a, potentially lengthy, [Lucas-Lehmer test](https://rosettacode.org/wiki/Lucas-Lehmer test "Lucas-Lehmer test").
Nella ricerca di numeri primari di Mersenne è vantaggioso eliminare gli esponenti trovando un piccolo fattore prima di iniziare un potenzialmente lungo [test di Lucas-Lehmer](https://rosettacode.org/wiki/Lucas-Lehmer test "Lucas-Lehmer test").
There are very efficient algorithms for determining if a number divides <code>2<sup>P</sup>-1</code> (or equivalently, if <code>2<sup>P</sup> mod (the number) = 1</code>).
Ci sono algoritmi molto efficienti per determinare se un numero divide <code>2<sup>P</sup>-1</code> (o equivalentemente, se <code>2<sup>P</sup> mod (il numero) = 1</code>).
Some languages already have built-in implementations of this exponent-and-mod operation (called modPow or similar).
Alcuni linguaggi hanno già implementazioni integrate di questa operazione esponente-e-modulo (chiamata modPow o simile).
The following is how to implement this modPow yourself:
Ecco come puoi implementare questo modPow:
For example, let's compute <code>2<sup>23</sup> mod 47</code>.
Ad esempio, calcoliamo <code>2<sup>23</sup> mod 47</code>.
Convert the exponent 23 to binary, you get 10111. Starting with <code><tt>square</tt> = 1</code>, repeatedly square it.
Converti l'esponente 23 in binario, ottenendo 10111. A partire da <code><tt>square</tt> = 1</code>, fai ripetutamente il quadrato.
Remove the top bit of the exponent, and if it's 1 multiply `square` by the base of the exponentiation (2), then compute <code><tt>square</tt> modulo 47</code>.
Rimuovi il bit superiore dell'esponente, e se è 1 moltiplica `square` per la base dell'esponenziazione (2), poi calcola <code><tt>square</tt> modulo 47</code>.
Use the result of the modulo from the last step as the initial value of `square` in the next step:
Usa il risultato del modulo dall'ultimo passo come valore iniziale dello `square` nella fase successiva:
<pre>Remove Optional
square top bit multiply by 2 mod 47
@ -38,51 +38,51 @@ square top bit multiply by 2 mod 47
27*27 = 729 1 729*2 = 1458 1
</pre>
Since <code>2<sup>23</sup> mod 47 = 1</code>, 47 is a factor of <code>2<sup>P</sup>-1</code>.
Dal momento che <code>2<sup>23</sup> mod 47 = 1</code>, 47 è un fattore di <code>2<sup>P</sup>-1</code>.
(To see this, subtract 1 from both sides: <code>2<sup>23</sup>-1 = 0 mod 47</code>.)
(Per vedere questo, sottrai 1 da entrambi i lati: <code>2<sup>23</sup>-1 = 0 mod 47</code>.)
Since we've shown that 47 is a factor, <code>2<sup>23</sup>-1</code> is not prime.
Dal momento che abbiamo dimostrato che 47 è un fattore, <code>2<sup>23</sup>-1</code> non è primo.
Further properties of Mersenne numbers allow us to refine the process even more.
Ulteriori proprietà dei numeri di Mersenne ci permettono di affinare il processo ancora di più.
Any factor `q` of <code>2<sup>P</sup>-1</code> must be of the form `2kP+1`, `k` being a positive integer or zero. Furthermore, `q` must be `1` or `7 mod 8`.
Qualsiasi fattore `q` di <code>2<sup>P</sup>-1</code> deve essere modulo `2kP+1`, essendo `k` un numero intero positivo o uguale a zero. Inoltre, `q` deve essere `1` o `7 mod 8`.
Finally any potential factor `q` must be [prime](https://rosettacode.org/wiki/Primality by Trial Division "Primality by Trial Division").
Infine qualsiasi fattore potenziale `q` deve essere [primo](https://rosettacode.org/wiki/Primality by Trial Division "Primality by Trial Division").
As in other trial division algorithms, the algorithm stops when `2kP+1 > sqrt(N)`.These primarily tests only work on Mersenne numbers where `P` is prime. For example, <code>M<sub>4</sub>=15</code> yields no factors using these techniques, but factors into 3 and 5, neither of which fit `2kP+1`.
Come in altri algoritmi di divisione di prova, l'algoritmo si ferma quando `2kP+1 > sqrt(N)`. Questi test funzionano principalmente solo su numeri Mersenne dove `P` è primo. Ad esempio, <code>M<sub>4</sub>=15</code> non produce fattori che utilizzano queste tecniche, ma fattori in 3 e 5, nessuno dei quali nella forma `2kP+1`.
# --instructions--
Using the above method find a factor of <code>2<sup>p</sup>-1</code>.
Utilizzando il metodo sopra descritto trovare un fattore di <code>2<sup>p</sup>-1</code>.
# --hints--
`check_mersenne` should be a function.
`check_mersenne` dovrebbe essere una funzione.
```js
assert(typeof check_mersenne === 'function');
```
`check_mersenne(3)` should return a string.
`check_mersenne(3)` dovrebbe restituire una stringa.
```js
assert(typeof check_mersenne(3) == 'string');
```
`check_mersenne(3)` should return the string `M3 = 2^3-1 is prime`.
`check_mersenne(3)` dovrebbe restituire la stringa `M3 = 2^3-1 is prime`.
```js
assert.equal(check_mersenne(3), 'M3 = 2^3-1 is prime');
```
`check_mersenne(23)` should return the string `M23 = 2^23-1 is composite with factor 47`.
`check_mersenne(23)` dovrebbe restituire la stringa `M23 = 2^23-1 is composite with factor 47`.
```js
assert.equal(check_mersenne(23), 'M23 = 2^23-1 is composite with factor 47');
```
`check_mersenne(929)` should return the string `M929 = 2^929-1 is composite with factor 13007`.
`check_mersenne(929)` dovrebbe restituire la stringa `M929 = 2^929-1 is composite with factor 13007`.
```js
assert.equal(

View File

@ -1,6 +1,6 @@
---
id: 597f1e7fbc206f0e9ba95dc4
title: Factors of an integer
title: Fattori di un numero intero
challengeType: 5
forumTopicId: 302265
dashedName: factors-of-an-integer
@ -8,13 +8,13 @@ dashedName: factors-of-an-integer
# --description--
Write a function that returns the factors of a positive integer as an array.
Scrivi una funzione che restituisce i fattori di un numero intero positivo come array.
These factors are the positive integers by which the number being factored can be divided to yield a positive integer result.
Questi fattori sono i numeri interi positivi per i quali il numero da considerare può essere diviso per ottenere un risultato intero positivo.
# --hints--
`factors` should be a function.
`factors` dovrebbe essere una funzione.
```js
assert(typeof factors === 'function');

View File

@ -1,6 +1,6 @@
---
id: 59c3ec9f15068017c96eb8a3
title: Farey sequence
title: Sequenza di Farey
challengeType: 5
forumTopicId: 302266
dashedName: farey-sequence
@ -8,18 +8,18 @@ dashedName: farey-sequence
# --description--
The [Farey sequence](https://en.wikipedia.org/wiki/Farey sequence "wp: Farey sequence") <code>F<sub>n</sub></code> of order `n` is the sequence of completely reduced fractions between `0` and `1` which, when in lowest terms, have denominators less than or equal to `n`, arranged in order of increasing size.
La [sequenza Farey](https://en.wikipedia.org/wiki/Farey sequence "wp: Farey sequence") <code>F<sub>n</sub></code> di ordine `n` è la sequenza di frazioni completamente ridotte tra `0` e `1` che, ai minimi termini, hanno denominatori minori o uguali a `n`, disposti in ordine di dimensioni crescenti.
The *Farey sequence* is sometimes incorrectly called a *Farey series*.
La *sequenza Farey* è a volte erroneamente chiamata una *serie di Farey*.
Each Farey sequence:
Ogni sequenza di Farey:
<ul>
<li>starts with the value 0, denoted by the fraction $ \frac{0}{1} $</li>
<li>ends with the value 1, denoted by the fraction $ \frac{1}{1}$.</li>
<li>inizia con il valore 0, indicato dalla frazione $ \frac{0}{1}$</li>
<li>termina con il valore 1, indicato dalla frazione $ \frac{1}{1}$.</li>
</ul>
The Farey sequences of orders `1` to `5` are:
Le sequenze Farey di ordine da `1` a `5` sono:
<ul>
<li style='list-style: none;'>${\bf\it{F}}_1 = \frac{0}{1}, \frac{1}{1}$</li>
@ -31,35 +31,35 @@ The Farey sequences of orders `1` to `5` are:
# --instructions--
Write a function that returns the Farey sequence of order `n`. The function should have one parameter that is `n`. It should return the sequence as an array.
Scrivi una funzione che restituisce la sequenza Farey di ordine `n`. La funzione dovrebbe avere un parametro `n`. Dovrebbe restituire la sequenza come un array.
# --hints--
`farey` should be a function.
`farey` dovrebbe essere una funzione.
```js
assert(typeof farey === 'function');
```
`farey(3)` should return an array
`farey(3)` dovrebbe restituire un array
```js
assert(Array.isArray(farey(3)));
```
`farey(3)` should return `["1/3","1/2","2/3"]`
`farey(3)` dovrebbe restituire `["1/3","1/2","2/3"]`
```js
assert.deepEqual(farey(3), ['1/3', '1/2', '2/3']);
```
`farey(4)` should return `["1/4","1/3","1/2","2/4","2/3","3/4"]`
`farey(4)` dovrebbe restituire `["1/4","1/3","1/2","2/4","2/3","3/4"]`
```js
assert.deepEqual(farey(4), ['1/4', '1/3', '1/2', '2/4', '2/3', '3/4']);
```
`farey(5)` should return `["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]`
`farey(5)` dovrebbe restituire `["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]`
```js
assert.deepEqual(farey(5), [

View File

@ -1,6 +1,6 @@
---
id: 598eef80ba501f1268170e1e
title: Fibonacci n-step number sequences
title: Sequenze di numeri di Fibonacci a passi di n
challengeType: 5
forumTopicId: 302267
dashedName: fibonacci-n-step-number-sequences
@ -8,82 +8,82 @@ dashedName: fibonacci-n-step-number-sequences
# --description--
These number series are an expansion of the ordinary [Fibonacci sequence](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence") where:
Queste serie di numeri sono un'espansione della successione ordinaria di [Fibonacci](https://rosettacode.org/wiki/Fibonacci sequence "Fibonacci sequence") dove:
<ol>
<li>For $n = 2$ we have the Fibonacci sequence; with initial values $[1, 1]$ and $F_k^2 = F_{k-1}^2 + F_{k-2}^2$</li>
<li>For $n = 3$ we have the tribonacci sequence; with initial values $[1, 1, 2]$ and $F_k^3 = F_{k-1}^3 + F_{k-2}^3 + F_{k-3}^3$</li>
<li>For $n = 4$ we have the tetranacci sequence; with initial values $[1, 1, 2, 4]$ and $F_k^4 = F_{k-1}^4 + F_{k-2}^4 + F_{k-3}^4 + F_{k-4}^4$...</li>
<li>For general $n>2$ we have the Fibonacci $n$-step sequence - $F_k^n$; with initial values of the first $n$ values of the $(n-1)$'th Fibonacci $n$-step sequence $F_k^{n-1}$; and $k$'th value of this $n$'th sequence being $F_k^n = \sum_{i=1}^{(n)} {F_{k-i}^{(n)}}$</li>
<li>Per $n = 2$ abbiamo la successione di Fibonacci; con valori iniziali $[1, 1]$ e $F_k^2 = F_{k-1}^2 + F_{k-2}^2$</li>
<li>Per $n = 3 $ abbiamo la successione tribonacci; con valori iniziali $[1, 1, 2]$ e $F_k^3 = F_{k-1}^3 + F_{k-2}^3 + F_{k-3}^3$</li>
<li>Per $n = 4$ abbiamo la sequenza tetranacci; con valori iniziali $[1, 1, 2, 4]$ e $F_k^4 = F_{k-1}^4 + F_{k-2}^4 + F_{k-3}^4 + F_{k-4}^4$...</li>
<li>In generale per $n>2$ abbiamo la sequenza di Fibonacci di passo $n$ - $F_k^n$; con i valori iniziali dei primi $n$ valori della sequenza $(n-1)$'ma di Fibonacci di passo $n$ $F_k^{n-1}$; e il $k$-mo valore di questa $n$-ma sequenza è $F_k^n = \sum_{i=1}^{(n)} {F_{k-i}^{(n)}}$</li>
</ol>
For small values of $n$, [Greek numeric prefixes](https://en.wikipedia.org/wiki/Number prefix#Greek_series "wp: Number prefix#Greek_series") are sometimes used to individually name each series.
Per piccoli valori di $n$, [i prefissi numerici greci](https://en.wikipedia.org/wiki/Number prefix#Greek_series "wp: Number prefix#Greek_series") sono talvolta utilizzati per nominare individualmente ogni serie.
Fibonacci $n$-step sequences:
Sequenze di Fibonacci di passo $n$:
| $n$ | Series name | Values |
| --- | ----------- | ------------------------------------------------------ |
| 2 | fibonacci | 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 ... |
| 3 | tribonacci | 1 1 2 4 7 13 24 44 81 149 274 504 927 1705 3136 ... |
| 4 | tetranacci | 1 1 2 4 8 15 29 56 108 208 401 773 1490 2872 5536 ... |
| 5 | pentanacci | 1 1 2 4 8 16 31 61 120 236 464 912 1793 3525 6930 ... |
| 6 | hexanacci | 1 1 2 4 8 16 32 63 125 248 492 976 1936 3840 7617 ... |
| 7 | heptanacci | 1 1 2 4 8 16 32 64 127 253 504 1004 2000 3984 7936 ... |
| 8 | octonacci | 1 1 2 4 8 16 32 64 128 255 509 1016 2028 4048 8080 ... |
| 9 | nonanacci | 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ... |
| 10 | decanacci | 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ... |
| $n$ | Nome delle serie | Valori |
| --- | ---------------- | ------------------------------------------------------ |
| 2 | fibonacci | 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 ... |
| 3 | tribonacci | 1 1 2 4 7 13 24 44 81 149 274 504 927 1705 3136 ... |
| 4 | tetranacci | 1 1 2 4 8 15 29 56 108 208 401 773 1490 2872 5536 ... |
| 5 | pentanacci | 1 1 2 4 8 16 31 61 120 236 464 912 1793 3525 6930 ... |
| 6 | esanacci | 1 1 2 4 8 16 32 63 125 248 492 976 1936 3840 7617 ... |
| 7 | ettanacci | 1 1 2 4 8 16 32 64 127 253 504 1004 2000 3984 7936 ... |
| 8 | ottonacci | 1 1 2 4 8 16 32 64 128 255 509 1016 2028 4048 8080 ... |
| 9 | nonanacci | 1 1 2 4 8 16 32 64 128 256 511 1021 2040 4076 8144 ... |
| 10 | decanacci | 1 1 2 4 8 16 32 64 128 256 512 1023 2045 4088 8172 ... |
Allied sequences can be generated where the initial values are changed: The [Lucas series](https://en.wikipedia.org/wiki/Lucas number "wp: Lucas number") sums the two preceding values like the fibonacci series for $n=2$ but uses $\[2, 1]$ as its initial values.
Le successioni affini possono essere generate cambiando i valori iniziali: la serie [Lucas](https://en.wikipedia.org/wiki/Lucas number "wp: Lucas number") somma i due valori precedenti come la serie fibonacci per $n=2$ ma usa $\[2, 1]$ come valori iniziali.
# --instructions--
Write a function to generate Fibonacci $n$-step number sequences and Lucas sequences. The first parameter will be $n$. The second parameter will be the number of elements to be returned. The third parameter will specify whether to output the Fibonacci sequence or the Lucas sequence. If the parameter is `"f"` then return the Fibonacci sequence and if it is `"l"`, then return the Lucas sequence. The sequences must be returned as an array.
Scrivi una funzione per generare le successioni di Fibonacci di passo $n$ e di Lucas. Il primo parametro sarà $n$. Il secondo parametro sarà il numero di elementi da restituire. Il terzo parametro specificherà se emettere la sequenza Fibonacci o la sequenza Lucas. Se il parametro è `"f"` restituire la successione di Fibonacci e se è `"l"`, restituire la successione di Lucas. Le successioni devono essere restituite come array.
# --hints--
`fib_luc` should be a function.
`fib_luc` dovrebbe essere una funzione.
```js
assert(typeof fib_luc === 'function');
```
`fib_luc(2,10,"f")` should return `[1,1,2,3,5,8,13,21,34,55]`.
`fib_luc(2,10,"f")` dovrebbe restituire `[1,1,2,3,5,8,13,21,34,55]`.
```js
assert.deepEqual(fib_luc(2, 10, 'f'), ans[0]);
```
`fib_luc(3,15,"f")` should return `[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]`.
`fib_luc(3,15,"f")` dovrebbe restituire `[1,1,2,4,7,13,24,44,81,149,274,504,927,1705,3136]`.
```js
assert.deepEqual(fib_luc(3, 15, 'f'), ans[1]);
```
`fib_luc(4,15,"f")` should return `[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]`.
`fib_luc(4,15,"f")` dovrebbe restituire `[1,1,2,4,8,15,29,56,108,208,401,773,1490,2872,5536]`.
```js
assert.deepEqual(fib_luc(4, 15, 'f'), ans[2]);
```
`fib_luc(2,10,"l")` should return `[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]`.
`fib_luc(2,10,"l")` dovrebbe restituire `[ 2, 1, 3, 4, 7, 11, 18, 29, 47, 76]`.
```js
assert.deepEqual(fib_luc(2, 10, 'l'), ans[3]);
```
`fib_luc(3,15,"l")` should return `[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]`.
`fib_luc(3,15,"l")` dovrebbe restituire `[ 2, 1, 3, 6, 10, 19, 35, 64, 118, 217, 399, 734, 1350, 2483, 4567 ]`.
```js
assert.deepEqual(fib_luc(3, 15, 'l'), ans[4]);
```
`fib_luc(4,15,"l")` should return `[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]`.
`fib_luc(4,15,"l")` dovrebbe restituire `[ 2, 1, 3, 6, 12, 22, 43, 83, 160, 308, 594, 1145, 2207, 4254, 8200 ]`.
```js
assert.deepEqual(fib_luc(4, 15, 'l'), ans[5]);
```
`fib_luc(5,15,"l")` should return `[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]`.
`fib_luc(5,15,"l")` dovrebbe restituire `[ 2, 1, 3, 6, 12, 24, 46, 91, 179, 352, 692, 1360, 2674, 5257, 10335 ]`.
```js
assert.deepEqual(fib_luc(5, 15, 'l'), ans[6]);

View File

@ -1,6 +1,6 @@
---
id: 597f24c1dda4e70f53c79c81
title: Fibonacci sequence
title: Sequenza di Fibonacci
challengeType: 5
forumTopicId: 302268
dashedName: fibonacci-sequence
@ -8,43 +8,43 @@ dashedName: fibonacci-sequence
# --description--
Write a function to generate the <code>n<sup>th</sup></code> Fibonacci number.
Scrivi una funzione che genera il <code>n<sup>simo</sup></code> numero di Fibonacci.
The <code>n<sup>th</sup></code> Fibonacci number is given by:
Il <code>n<sup>simo</sup></code> numero di Fibonacci è dato da:
<code>F<sub>n</sub> = F<sub>n-1</sub> + F<sub>n-2</sub></code>
The first two terms of the series are 0 and 1.
Il primi due numeri della serie sono 0 e 1.
Hence, the series is: 0, 1, 1, 2, 3, 5, 8, 13...
Quindi, la serie è: 0, 1, 1, 2, 3, 5, 8, 13...
# --hints--
`fibonacci` should be a function.
`fibonacci` dovrebbe essere una funzione.
```js
assert(typeof fibonacci === 'function');
```
`fibonacci(2)` should return a number.
`fibonacci(2)` dovrebbe restituire un numero.
```js
assert(typeof fibonacci(2) == 'number');
```
`fibonacci(3)` should return 2.
`fibonacci(3)` dovrebbe restituire 2.
```js
assert.equal(fibonacci(3), 2);
```
`fibonacci(5)` should return 5.
`fibonacci(5)` dovrebbe restituire 5.
```js
assert.equal(fibonacci(5), 5);
```
`fibonacci(10)` should return 55.
`fibonacci(10)` dovrebbe restituire 55.
```js
assert.equal(fibonacci(10), 55);

View File

@ -1,6 +1,6 @@
---
id: 5992e222d397f00d21122931
title: Fibonacci word
title: Parola di Fibonacci
challengeType: 5
forumTopicId: 302269
dashedName: fibonacci-word
@ -8,33 +8,33 @@ dashedName: fibonacci-word
# --description--
The Fibonacci Word may be created in a manner analogous to the Fibonacci Sequence [as described here](https://hal.archives-ouvertes.fr/docs/00/36/79/72/PDF/The_Fibonacci_word_fractal.pdf):
La Parola di Fibonacci può essere creata in una maniera analoga alla Sequenza di Fibonacci [come descritto qui](https://hal.archives-ouvertes.fr/docs/00/36/79/72/PDF/The_Fibonacci_word_fractal.pdf):
<pre>Define F_Word<sub>1</sub> as <strong>1</strong>
Define F_Word<sub>2</sub> as <strong>0</strong>
Form F_Word<sub>3</sub> as F_Word<sub>2</sub> concatenated with F_Word<sub>1</sub> i.e.: <strong>01</strong>
Form F_Word<sub>n</sub> as F_Word<sub>n-1</sub> concatenated with F_word<sub>n-2</sub>
<pre>Definisci F_Word<sub>1</sub> come <strong>1</strong>
Definisci F_Word<sub>2</sub> come <strong>0</strong>
Definisci F_Word<sub>3</sub> come F_Word<sub>2</sub> concatenato con F_Word<sub>1</sub> i.e.: <strong>01</strong>
Forma F_Word<sub>n</sub> come F_Word<sub>n-1</sub> concatento con with F_word<sub>n-2</sub>
</pre>
# --instructions--
Write a function to return the Fibonacci Words up to `n`. `n` will be provided as a parameter to the function. The function should return an array of objects. The objects should be of the form: `{ N: 1, Length: 1, Entropy: 0, Word: '1' }`.
Scrivi una funzione che restituisci le Parole di Fibonacci fino a `n`. `n` verrà fornito come parametro per la funzione. La funzione dovrebbe restituire un array di oggetti. Gli oggetti dovrebberi essere della forma: `{ N: 1, Length: 1, Entropy: 0, Word: '1' }`.
# --hints--
`fibWord` should be a function.
`fibWord` dovrebbe essere una funzione.
```js
assert(typeof fibWord === 'function');
```
`fibWord(5)` should return an array.
`fibWord(5)` dovrebbe restituire un array.
```js
assert(Array.isArray(fibWord(5)));
```
`fibWord(5)` should return `[{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.9182958340544896, Word:"010" },{ N:5, Length:5, Entropy:0.9709505944546688, Word:"01001" }]`.
`fibWord(5)` dovrebbe restituire `[{ N:1, Length:1, Entropy:0, Word:"1" },{ N:2, Length:1, Entropy:0, Word:"0" },{ N:3, Length:2, Entropy:1, Word:"01" },{ N:4, Length:3, Entropy:0.9182958340544896, Word:"010" },{ N:5, Length:5, Entropy:0.9709505944546688, Word:"01001" }]`.
```js
assert.deepEqual(fibWord(5), ans);

View File

@ -8,51 +8,51 @@ dashedName: fizzbuzz
# --description--
Write a program that generates an array of integers from 1 to 100 (inclusive). But:
Scrivi un programma che genera un array di integrali da 1 a 100 (inclusi). Ma:
<ul>
<li>for multiples of 3, add <code>"Fizz"</code> to the array instead of the number</li>
<li>for multiples of 5, add <code>"Buzz"</code> to the array instead of the number</li>
<li>for multiples of 3 and 5, add <code>"FizzBuzz"</code> to the array instead of the number</li>
<li>per multipli di 3, aggiunge <code>"Fizz"</code> all'array invede del numero</li>
<li>per multipli di 5, aggiungi <code>"Buzz"</code> all'array invece del numero</li>
<li>per multipli di 3 e 5, aggiungi <code>"FizzBuzz"</code> all'array invece del numero</li>
</ul>
# --instructions--
Your program should return an array containing the results based on the rules above.
Il tuo programma dovrebbe restituire un array contenete i risultati seguendo le regole scritte sopra.
# --hints--
`fizzBuzz` should be a function.
`fizzBuzz` dovrebbe essere una funzione.
```js
assert(typeof fizzBuzz == 'function');
```
`fizzBuzz()` should return an Array.
`fizzBuzz()` dovrebbe restituire un array.
```js
assert(Array.isArray(fizzBuzz()) == true);
```
Numbers divisible by only 3 should return `"Fizz"`.
I numeri divisibili per solo 3 dovrebbero restituire `"Fizz"`.
```js
assert.equal(fizzBuzz()[2], 'Fizz');
```
Numbers divisible by only 5 should return `"Buzz"`.
I numeri divisibili per solo 5 dovrebbero restituire `"Buzz"`.
```js
assert.equal(fizzBuzz()[99], 'Buzz');
```
Numbers divisible by both 3 and 5 should return `"FizzBuzz"`.
Numeri divisibili per 3 e 5 dovrebbero restituire `"FizzBuzz"`.
```js
assert.equal(fizzBuzz()[89], 'FizzBuzz');
```
Numbers not divisible by either 3 or 5 should return the number itself.
I numeri non divisibili per 3 o 5 dovrebbero restituire il numero stesso.
```js
assert.equal(fizzBuzz()[12], 13);

View File

@ -8,74 +8,74 @@ dashedName: fractran
# --description--
[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") is a Turing-complete esoteric programming language invented by the mathematician [John Horton Conway](https://en.wikipedia.org/wiki/John Horton Conway "wp: John Horton Conway").
[FRACTRAN](https://en.wikipedia.org/wiki/FRACTRAN "wp: FRACTRAN") è un linguaggio di programmazione esoterico Turing-completo inventato dal matematico [John Horton Conway](https://en.wikipedia.org/wiki/John Horton Conway "wp: John Horton Conway").
A FRACTRAN program is an ordered list of positive fractions $P = (f_1, f_2, \\ldots, f_m)$, together with an initial positive integer input $n$.
Un programma FRACTRAN è un elenco ordinato di frazioni positive $P = (f_1, f_2, \\ldots, f_m)$, insieme a un input intero iniziale positivo $n$.
The program is run by updating the integer $n$ as follows:
Il programma viene eseguito aggiornando l'intero $n$ come segue:
<ul>
<li>for the first fraction, $f_i$, in the list for which $nf_i$ is an integer, replace $n$ with $nf_i$ ;</li>
<li>repeat this rule until no fraction in the list produces an integer when multiplied by $n$, then halt.</li>
<li>per la prima frazione, $f_i$, nella lista per la quale $nf_i$ è un numero intero, sostituire $n$ con $nf_i$;</li>
<li>ripetere questa regola fino a quando nessuna frazione nella lista produce un numero intero quando moltiplicato per $n$, quindi arrestarsi.</li>
</ul>
Conway gave a program for primes in FRACTRAN:
Conway ha scritto un programma per i numeri primi in FRACTRAN:
$\\dfrac{17}{91}$, $\\dfrac{78}{85}$, $\\dfrac{19}{51}$, $\\dfrac{23}{38}$, $\\dfrac{29}{33}$, $\\dfrac{77}{29}$, $\\dfrac{95}{23}$, $\\dfrac{77}{19}$, $\\dfrac{1}{17}$, $\\dfrac{11}{13}$, $\\dfrac{13}{11}$, $\\dfrac{15}{14}$, $\\dfrac{15}{2}$, $\\dfrac{55}{1}$
Starting with $n=2$, this FRACTRAN program will change $n$ to $15=2\\times (\\frac{15}{2})$, then $825=15\\times (\\frac{55}{1})$, generating the following sequence of integers:
A partire da $n=2$, questo programma FRACTRAN cambierà $n$ in $15=2\\times (\\frac{15}{2})$, poi $825=15\\times (\\frac{55}{1})$, generando la seguente sequenza di interi:
$2$, $15$, $825$, $725$, $1925$, $2275$, $425$, $390$, $330$, $290$, $770$, $\\ldots$
After 2, this sequence contains the following powers of 2:
Dopo 2, questa sequenza contiene le seguenti potenze di 2:
$2^2=4$, $2^3=8$, $2^5=32$, $2^7=128$, $2^{11}=2048$, $2^{13}=8192$, $2^{17}=131072$, $2^{19}=524288$, $\\ldots$
which are the prime powers of 2.
che sono le potenze prime di 2.
# --instructions--
Write a function that takes a fractran program as a string parameter and returns the first 10 numbers of the program as an array. If the result does not have 10 numbers then return the numbers as is.
Scrivi una funzione che prende un programma fractran come parametro di tipo stringa e restituisce i primi 10 numeri del programma come un array. Se il risultato non ha 10 numeri, restituire i numeri così come sono.
# --hints--
`fractran` should be a function.
`fractran` dovrebbe essere una funzione.
```js
assert(typeof fractran == 'function');
```
`fractran("3/2, 1/3")` should return an array.
`fractran("3/2, 1/3")` dovrebbe restituire un array.
```js
assert(Array.isArray(fractran('3/2, 1/3')));
```
`fractran("3/2, 1/3")` should return `[ 2, 3, 1 ]`.
`fractran("3/2, 1/3")` dovrebbe restituire `[ 2, 3, 1 ]`.
```js
assert.deepEqual(fractran('3/2, 1/3'), [2, 3, 1]);
```
`fractran("3/2, 5/3, 1/5")` should return `[ 2, 3, 5, 1 ]`.
`fractran("3/2, 5/3, 1/5")` dovrebbe restituire `[ 2, 3, 5, 1 ]`.
```js
assert.deepEqual(fractran('3/2, 5/3, 1/5'), [2, 3, 5, 1]);
```
`fractran("3/2, 6/3")` should return `[ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]`.
`fractran("3/2, 6/3")` dovrebbe restituire `[ 2, 3, 6, 9, 18, 27, 54, 81, 162, 243 ]`.
```js
assert.deepEqual(fractran('3/2, 6/3'), [2, 3, 6, 9, 18, 27, 54, 81, 162, 243]);
```
`fractran("2/7, 7/2")` should return `[ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]`.
`fractran("2/7, 7/2")` dovrebbe restituire `[ 2, 7, 2, 7, 2, 7, 2, 7, 2, 7 ]`.
```js
assert.deepEqual(fractran('2/7, 7/2'), [2, 7, 2, 7, 2, 7, 2, 7, 2, 7]);
```
`fractran("17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1")` should return `[ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ]`.
`fractran("17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/14, 15/2, 55/1")` dovrebbe restituire `[ 2, 15, 825, 725, 1925, 2275, 425, 390, 330, 290 ]`.
```js
assert.deepEqual(

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e76
title: Gamma function
title: Funzione Gamma
challengeType: 5
forumTopicId: 302271
dashedName: gamma-function
@ -8,51 +8,51 @@ dashedName: gamma-function
# --description--
Implement one algorithm (or more) to compute the [Gamma](https://en.wikipedia.org/wiki/Gamma function) ($\\Gamma$) function (in the real field only).
Implementa un algoritmo (o più) per calcolare la funzione [Gamma](https://en.wikipedia.org/wiki/Gamma function) ($\\Gamma$) (solo nel campo reale).
The Gamma function can be defined as:
La funzione Gamma può essere definita come segue:
<div style='padding-left: 4em;'><big><big>$\Gamma(x) = \displaystyle\int_0^\infty t^{x-1}e^{-t} dt$</big></big></div>
# --hints--
`gamma` should be a function.
`gamma` dovrebbe essere una funzione.
```js
assert(typeof gamma == 'function');
```
`gamma(.1)` should return a number.
`gamma(.1)` dovrebbe restituire un numero.
```js
assert(typeof gamma(0.1) == 'number');
```
`gamma(.1)` should return `9.513507698668736`.
`gamma(.1)` dovrebbe restituire `9.513507698668736`.
```js
assert.equal(round(gamma(0.1)), round(9.513507698668736));
```
`gamma(.2)` should return `4.590843711998803`.
`gamma(.2)` dovrebbe restituire `4.590843711998803`.
```js
assert.equal(round(gamma(0.2)), round(4.590843711998803));
```
`gamma(.3)` should return `2.9915689876875904`.
`gamma(.3)` dovrebbe restituire `2.9915689876875904`.
```js
assert.equal(round(gamma(0.3)), round(2.9915689876875904));
```
`gamma(.4)` should return `2.218159543757687`.
`gamma(.4)` dovrebbe restituire `2.218159543757687`.
```js
assert.equal(round(gamma(0.4)), round(2.218159543757687));
```
`gamma(.5)` should return `1.7724538509055159`.
`gamma(.5)` dovrebbe restituire `1.7724538509055159`.
```js
assert.equal(round(gamma(0.5)), round(1.7724538509055159));

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e77
title: Gaussian elimination
title: Eliminazione Gaussiana
challengeType: 5
forumTopicId: 302272
dashedName: gaussian-elimination
@ -8,21 +8,21 @@ dashedName: gaussian-elimination
# --description--
Write a function to solve \\(Ax = b\\) using Gaussian elimination then backwards substitution.
Scrivi una funzione per risolvere \\(Ax = b\\) usando l'eliminazione gaussiana e la sostituzione all'indietro.
\\(A\\) being an \\(n \\times n\\) matrix. Also, \\(x\\) and \\(b\\) are \\(n\\) by 1 vectors.
\\(A\\) è una matrice \\(n \\times n\\). Inoltre, \\(x\\) e \\(b\\) sono vettori \\(n\\) x 1.
To improve accuracy, please use partial pivoting and scaling.
Per migliorare la precisione, si prega di utilizzare pivoting parziale e ridimensionamento.
# --hints--
`gaussianElimination` should be a function.
`gaussianElimination` dovrebbe essere una funzione.
```js
assert(typeof gaussianElimination == 'function');
```
`gaussianElimination([[1,1],[1,-1]], [5,1])` should return an array.
`gaussianElimination([[1,1],[1,-1]], [5,1])` dovrebbe restituire un array.
```js
assert(
@ -38,7 +38,7 @@ assert(
);
```
`gaussianElimination([[1,1],[1,-1]], [5,1])` should return `[ 3, 2 ]`.
`gaussianElimination([[1,1],[1,-1]], [5,1])` dovrebbe restituire `[ 3, 2 ]`.
```js
assert.deepEqual(
@ -53,7 +53,7 @@ assert.deepEqual(
);
```
`gaussianElimination([[2,3],[2,1]] , [8,4])` should return `[ 1, 2 ]`.
`gaussianElimination([[2,3],[2,1]] , [8,4])` dovrebbe restituire `[ 1, 2 ]`.
```js
assert.deepEqual(
@ -68,7 +68,7 @@ assert.deepEqual(
);
```
`gaussianElimination([[1,3],[5,-2]], [14,19])` should return `[ 5, 3 ]`.
`gaussianElimination([[1,3],[5,-2]], [14,19])` dovrebbe restituire `[ 5, 3 ]`.
```js
assert.deepEqual(
@ -83,7 +83,7 @@ assert.deepEqual(
);
```
`gaussianElimination([[1,1],[5,-1]] , [10,14])` should return `[ 4, 6 ]`.
`gaussianElimination([[1,1],[5,-1]] , [10,14])` dovrebbe restituire `[ 4, 6 ]`.
```js
assert.deepEqual(
@ -98,7 +98,7 @@ assert.deepEqual(
);
```
`gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23])` should return `[ 1, 1, 1 ]`.
`gaussianElimination([[1,2,3],[4,5,6],[7,8,8]] , [6,15,23])` dovrebbe restituire `[ 1, 1, 1 ]`.
```js
assert.deepEqual(

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e78
title: General FizzBuzz
title: FizzBuzz generico
challengeType: 5
forumTopicId: 302273
dashedName: general-fizzbuzz
@ -8,25 +8,25 @@ dashedName: general-fizzbuzz
# --description--
Write a generalized version of [FizzBuzz](https://rosettacode.org/wiki/FizzBuzz) that works for any list of factors, along with their words.
Scrivi una versione generalizzata di [Fizzbuzz](https://rosettacode.org/wiki/FizzBuzz) che funziona per ogni lista di fattori, assieme alle loro parole.
This is basically a "fizzbuzz" implementation where the rules of the game are supplied to the user. Create a function to implement this. The function should take two parameters.
Questa è in pratica una implementazione di "fizzbuzz" dove le regole del gioco sono date all'utente. Crea una funzione per implementarlo. La funzione dovrebbe accettare due parametri.
The first will be an array with the FizzBuzz rules. For example: `[ [3, "Fizz"] , [5, "Buzz"] ]`.
Il primo è un array con le regole di FizzBuzz. Per esempio `[ [3, "Fizz"] , [5, "Buzz"] ]`.
This indicates that `Fizz` should be printed if the number is a multiple of 3 and `Buzz` if it is a multiple of 5. If it is a multiple of both then the strings should be concatenated in the order specified in the array. In this case, `FizzBuzz` if the number is a multiple of 3 and 5.
Questo indica che `Fizz` dovrebbe essere scritto se il numero è un multiplo di 3 e `Buzz` se è un multiplo di 5. Se è un multiplo di entrambi allora le stringhe dovrebbero essere concatenate nell'ordine specificato nell'array. In questo caso, `FizzBuzz` se il numero è un multiplo di 3 e 5.
The second parameter is the number for which the function should return a string as stated above.
Il secondo parametro è il numero per cui la funzione dovrebbe restituire una stringa come detto sopra.
# --hints--
`genFizzBuzz` should be a function.
`genFizzBuzz` dovrebbe essere una funzione.
```js
assert(typeof genFizzBuzz == 'function');
```
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)` should return a string.
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)` dovrebbe restituire una stringa.
```js
assert(
@ -40,7 +40,7 @@ assert(
);
```
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)` should return `"Fizz"`.
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 6)` dovrebbe restituire `"Fizz"`.
```js
assert.equal(
@ -55,7 +55,7 @@ assert.equal(
);
```
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10)` should return `"Buzz"`.
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 10)` dovrebbe restituire `"Buzz"`.
```js
assert.equal(
@ -70,7 +70,7 @@ assert.equal(
);
```
`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12)` should return `"Buzz"`.
`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 12)` dovrebbe restituire `"Buzz"`.
```js
assert.equal(
@ -85,7 +85,7 @@ assert.equal(
);
```
`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13)` should return `"13"`.
`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 13)` dovrebbe restituire `"13"`.
```js
assert.equal(
@ -100,7 +100,7 @@ assert.equal(
);
```
`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15)` should return `"BuzzFizz"`.
`genFizzBuzz([[3, "Buzz"],[5, "Fizz"]], 15)` dovrebbe restituire `"BuzzFizz"`.
```js
assert.equal(
@ -115,7 +115,7 @@ assert.equal(
);
```
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15)` should return `"FizzBuzz"`.
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"]], 15)` dovrebbe restituire `"FizzBuzz"`.
```js
assert.equal(
@ -130,7 +130,7 @@ assert.equal(
);
```
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105)` should return `"FizzBuzzBaxx"`.
`genFizzBuzz([[3, "Fizz"],[5, "Buzz"],[7, "Baxx"]], 105)` dovrebbe restituire `"FizzBuzzBaxx"`.
```js
assert.equal(

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e7a
title: Generate lower case ASCII alphabet
title: Genera l'alfabeto ASCII minuscolo
challengeType: 5
forumTopicId: 302274
dashedName: generate-lower-case-ascii-alphabet
@ -8,47 +8,47 @@ dashedName: generate-lower-case-ascii-alphabet
# --description--
Write a function to generate an array of lower case ASCII characters for a given range. For example, given the range `['a', 'd']`, the function should return `['a', 'b', 'c', 'd']`.
Scrivi una funzione per generare un array di caratteri ASCII minuscoli per un dato range. Ad esempio, dato l'intervallo `['a', 'd']`, la funzione dovrebbe restituire `['a', 'b', 'c', 'd']`.
# --hints--
`lascii` should be a function.
`lascii` dovrebbe essere una funzione.
```js
assert(typeof lascii == 'function');
```
`lascii("a","d")` should return an array.
`lascii("a","d")` dovrebbe restituire un array.
```js
assert(Array.isArray(lascii('a', 'd')));
```
`lascii('a','d')` should return `[ 'a', 'b', 'c', 'd' ]`.
`lascii('a','d')` dovrebbe restituire `[ 'a', 'b', 'c', 'd' ]`.
```js
assert.deepEqual(lascii('a', 'd'), results[0]);
```
`lascii('c','i')` should return `[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ]`.
`lascii('c','i')` dovrebbe restituire `[ 'c', 'd', 'e', 'f', 'g', 'h', 'i' ]`.
```js
assert.deepEqual(lascii('c', 'i'), results[1]);
```
`lascii('m','q')` should return `[ 'm', 'n', 'o', 'p', 'q' ]`.
`lascii('m','q')` dovrebbe restituire `[ 'm', 'n', 'o', 'p', 'q' ]`.
```js
assert.deepEqual(lascii('m', 'q'), results[2]);
```
`lascii('k','n')` should return `[ 'k', 'l', 'm', 'n' ]`.
`lascii('k','n')` dovrebbe restituire `[ 'k', 'l', 'm', 'n' ]`.
```js
assert.deepEqual(lascii('k', 'n'), results[3]);
```
`lascii('t','z')` should return `[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]`.
`lascii('t','z')` dovrebbe restituire `[ 't', 'u', 'v', 'w', 'x', 'y', 'z' ]`.
```js
assert.deepEqual(lascii('t', 'z'), results[4]);

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e7b
title: Generator/Exponential
title: Generatore/Esponenziale
challengeType: 5
forumTopicId: 302275
dashedName: generatorexponential
@ -8,59 +8,59 @@ dashedName: generatorexponential
# --description--
A generator is an executable entity (like a function or procedure) that contains code that yields a sequence of values, one at a time, so that each time you call the generator, the next value in the sequence is provided.
Un generatore è un'entità eseguibile (come una funzione o una procedura) che contiene codice che restituisce una sequenza di valori, uno alla volta, in modo che ogni volta che si chiama il generatore, viene fornito il valore successivo della sequenza.
Generators are often built on top of coroutines or objects so that the internal state of the object is handled "naturally".
I generatori sono spesso costruiti su co-routine o oggetti in modo che lo stato interno dell'oggetto sia gestito "naturalmente".
Generators are often used in situations where a sequence is potentially infinite, and where it is possible to construct the next value of the sequence with only minimal state.
I generatori sono spesso utilizzati in situazioni in cui una sequenza è potenzialmente infinita, e dove è possibile costruire il valore successivo della sequenza con solo uno stato minimo.
# --instructions--
Write a function that uses generators to generate squares and cubes. Create a new generator that filters all cubes from the generator of squares.
Scrivi una funzione che utilizza i generatori per generare quadrati e cubi. Crea un nuovo generatore che filtra tutti i cubi dal generatore di quadrati.
The function should return the \\( n^{th} \\) value of the filtered generator.
La funzione deve restituire il valore \\( n^{simo} \\) del generatore filtrato.
For example for \\(n=7\\), the function should return 81 as the sequence would be 4, 9, 16, 25, 36, 49, 81. Here 64 is filtered out, as it is a cube.
Per esempio per \\(n=7\\), la funzione dovrebbe restituire 81 perché la sequenza sarebbe 4, 9, 16, 25, 36, 49, 81. Qui 64 è filtrato, dato che è un cubo.
# --hints--
`exponentialGenerator` should be a function.
`exponentialGenerator` dovrebbe essere una funzione.
```js
assert(typeof exponentialGenerator == 'function');
```
`exponentialGenerator()` should return a number.
`exponentialGenerator()` dovrebbe restituire un numero.
```js
assert(typeof exponentialGenerator(10) == 'number');
```
`exponentialGenerator(10)` should return `144`.
`exponentialGenerator(10)` dovrebbe restituire `144`.
```js
assert.equal(exponentialGenerator(10), 144);
```
`exponentialGenerator(12)` should return `196`.
`exponentialGenerator(12)` dovrebbe restituire `196`.
```js
assert.equal(exponentialGenerator(12), 196);
```
`exponentialGenerator(14)` should return `256`.
`exponentialGenerator(14)` dovrebbe restituire `256`.
```js
assert.equal(exponentialGenerator(14), 256);
```
`exponentialGenerator(20)` should return `484`.
`exponentialGenerator(20)` dovrebbe restituire `484`.
```js
assert.equal(exponentialGenerator(20), 484);
```
`exponentialGenerator(25)` should return `784`.
`exponentialGenerator(25)` dovrebbe restituire `784`.
```js
assert.equal(exponentialGenerator(25), 784);

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e80
title: Gray code
title: Codice Gray
challengeType: 5
forumTopicId: 302276
dashedName: gray-code
@ -8,23 +8,23 @@ dashedName: gray-code
# --description--
[Gray code](https://en.wikipedia.org/wiki/Gray code) is a form of binary encoding where transitions between consecutive numbers differ by only one bit.
[Il codice Gray](https://en.wikipedia.org/wiki/Gray code) è una forma di codifica binaria in cui le transizioni tra numeri consecutivi differiscono di un solo bit.
This is a useful encoding for reducing hardware data hazards with values that change rapidly and/or connect to slower hardware as inputs.
Si tratta di una codifica utile per ridurre il rischio di perdita di dati hardware con valori che cambiano rapidamente e/o si collegano a un hardware più lento come input.
It is also useful for generating inputs for [Karnaugh maps](https://en.wikipedia.org/wiki/Karnaugh map) in order from left to right or top to bottom.
È utile anche per generare input per [mappe Karnaugh](https://en.wikipedia.org/wiki/Karnaugh map) in ordine da sinistra a destra o dall'alto al basso.
# --instructions--
Create a function to encode a number to and decode a number from Gray code. The function should will have 2 parameters.
Crea una funzione per codificare e decodificare un numero in codice Gray. La funzione dovrebbe avere 2 parametri.
The first would be a boolean. The function should encode for true and decode for false. The second parameter would be the number to be encoded/decoded.
Il primo sarà un booleano. La funzione dovrebbe codificare per true e decodificare per false. Il secondo paramentro sarebbe il numero da codificare/decodificare.
Display the normal binary representations, Gray code representations, and decoded Gray code values for all 5-bit binary numbers (0-31 inclusive, leading 0's not necessary).
Mostra la rappresentazione binaria normale, la rappresentazione in codice Gray, e i valori in codice Gray decodificati per tutti i numeri binari di dimensione 5-bit (0-31 inclusivo, gli zero davanti al numero non sono necessari).
There are many possible Gray codes. The following encodes what is called "binary reflected Gray code."
Ci sono molti possibili codici Gray. Il seguente codifica quello che è chiamato "codice Gray riflesso binario".
Encoding (MSB is bit 0, b is binary, g is Gray code):
Codificare (MSB è bit 0, b è binario, g è codice Gray):
<pre>if b[i-1] = 1
g[i] = not b[i]
@ -32,63 +32,63 @@ else
g[i] = b[i]
</pre>
Or:
Oppure:
<pre>g = b xor (b logically right shifted 1 time)
<pre>g = b xor (b logicamente spostato a destra 1 volta)
</pre>
Decoding (MSB is bit 0, b is binary, g is Gray code):
Decodificare (MSB è bit 0, b è binario, g è codice Gray):
<pre>b[0] = g[0]<br>
for other bits:
per altri bit:
b[i] = g[i] xor b[i-1]
</pre>
# --hints--
`gray` should be a function.
`gray` dovrebbe essere una funzione.
```js
assert(typeof gray == 'function');
```
`gray(true,177)` should return a number.
`gray(true,177)` dovrebbe restituire un numero.
```js
assert(typeof gray(true, 177) == 'number');
```
`gray(true,177)` should return `233`.
`gray(true,177)` dovrebbe restituire `233`.
```js
assert.equal(gray(true, 177), 233);
```
`gray(true,425)` should return `381`.
`gray(true,425)` dovrebbe restituire `381`.
```js
assert.equal(gray(true, 425), 381);
```
`gray(true,870)` should return `725`.
`gray(true,870)` dovrebbe restituire `725`.
```js
assert.equal(gray(true, 870), 725);
```
`gray(false,233)` should return `177`.
`gray(false,233)` dovrebbe restituire `177`.
```js
assert.equal(gray(false, 233), 177);
```
`gray(false,381)` should return `425`.
`gray(false,381)` dovrebbe restituire `425`.
```js
assert.equal(gray(false, 381), 425);
```
`gray(false,725)` should return `870`.
`gray(false,725)` dovrebbe restituire `870`.
```js
assert.equal(gray(false, 725), 870);

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e82
title: Greatest common divisor
title: Massimo comun divisore
challengeType: 5
forumTopicId: 302277
dashedName: greatest-common-divisor
@ -8,53 +8,53 @@ dashedName: greatest-common-divisor
# --description--
Write a function that returns the greatest common divisor of two integers.
Scrivi una funzione che restituire il massimo comun divisore di due numeri interi.
# --hints--
`gcd` should be a function.
`gcd` dovrebbe essere una funzione.
```js
assert(typeof gcd == 'function');
```
`gcd(24,36)` should return a number.
`gcd(24,36)` dovrebbe restituire un numero.
```js
assert(typeof gcd(24, 36) == 'number');
```
`gcd(24,36)` should return `12`.
`gcd(24,36)` dovrebbe restituire `12`.
```js
assert.equal(gcd(24, 36), 12);
```
`gcd(30,48)` should return `6`.
`gcd(30,48)` dovrebbe restituire `6`.
```js
assert.equal(gcd(30, 48), 6);
```
`gcd(10,15)` should return `5`.
`gcd(10,15)` dovrebbe restituire `5`.
```js
assert.equal(gcd(10, 15), 5);
```
`gcd(100,25)` should return `25`.
`gcd(100,25)` dovrebbe restituire `25`.
```js
assert.equal(gcd(100, 25), 25);
```
`gcd(13,250)` should return `1`.
`gcd(13,250)` dovrebbe restituire `1`.
```js
assert.equal(gcd(13, 250), 1);
```
`gcd(1300,250)` should return `50`.
`gcd(1300,250)` dovrebbe restituire `50`.
```js
assert.equal(gcd(1300, 250), 50);

View File

@ -1,6 +1,6 @@
---
id: 5a23c84252665b21eecc7e84
title: Greatest subsequential sum
title: La sottosequenza con la somma più alta
challengeType: 5
forumTopicId: 302278
dashedName: greatest-subsequential-sum
@ -8,31 +8,31 @@ dashedName: greatest-subsequential-sum
# --description--
Given a sequence of integers, find a continuous subsequence which maximizes the sum of its elements, that is, the elements of no other single subsequence add up to a value larger than this one.
Data una sequenza di numeri interi, trovare una sottosuccessione continua che massimizza la somma dei suoi elementi, cioè, gli elementi di nessun'altra successione sommano ad un valore superiore a questo.
An empty subsequence is considered to have the sum of \\( 0 \\); thus if all elements are negative, the result must be the empty sequence.
Si considera che una sottosuccessione vuota abbia la somma di \\( 0 \\); quindi se tutti gli elementi sono negativi, il risultato deve essere la sequenza vuota.
# --hints--
`maximumSubsequence` should be a function.
`maximumSubsequence` dovrebbe essere una funzione.
```js
assert(typeof maximumSubsequence == 'function');
```
`maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])` should return an array.
`maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])` dovrebbe restituire un array.
```js
assert(Array.isArray(maximumSubsequence([1, 2, -1, 3, 10, -10])));
```
`maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])` should return `[ 1, 2, -1, 3, 10 ]`.
`maximumSubsequence([ 1, 2, -1, 3, 10, -10 ])` dovrebbe restituire `[ 1, 2, -1, 3, 10 ]`.
```js
assert.deepEqual(maximumSubsequence([1, 2, -1, 3, 10, -10]), [1, 2, -1, 3, 10]);
```
`maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])` should return `[ 0, 8, 10 ]`.
`maximumSubsequence([ 0, 8, 10, -2, -4, -1, -5, -3 ])` dovrebbe restituire `[ 0, 8, 10 ]`.
```js
assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [
@ -42,25 +42,25 @@ assert.deepEqual(maximumSubsequence([0, 8, 10, -2, -4, -1, -5, -3]), [
]);
```
`maximumSubsequence([ 9, 9, -10, 1 ])` should return `[ 9, 9 ]`.
`maximumSubsequence([ 9, 9, -10, 1 ])` dovrebbe restituire `[ 9, 9 ]`.
```js
assert.deepEqual(maximumSubsequence([9, 9, -10, 1]), [9, 9]);
```
`maximumSubsequence([ 7, 1, -5, -3, -8, 1 ])` should return `[ 7, 1 ]`.
`maximumSubsequence([ 7, 1, -5, -3, -8, 1 ])` dovrebbe restituire `[ 7, 1 ]`.
```js
assert.deepEqual(maximumSubsequence([7, 1, -5, -3, -8, 1]), [7, 1]);
```
`maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])` should return `[ 6, -1, 4 ]`.
`maximumSubsequence([ -3, 6, -1, 4, -4, -6 ])` dovrebbe restituire `[ 6, -1, 4 ]`.
```js
assert.deepEqual(maximumSubsequence([-3, 6, -1, 4, -4, -6]), [6, -1, 4]);
```
`maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])` should return `[ 3, 5, 6, -2, -1, 4 ]`.
`maximumSubsequence([ -1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1 ])` dovrebbe restituire `[ 3, 5, 6, -2, -1, 4 ]`.
```js
assert.deepEqual(maximumSubsequence([-1, -2, 3, 5, 6, -2, -1, 4, -4, 2, -1]), [

View File

@ -1,6 +1,6 @@
---
id: 595608ff8bcd7a50bd490181
title: Hailstone sequence
title: Numeri di Hailstone
challengeType: 5
forumTopicId: 302279
dashedName: hailstone-sequence
@ -8,48 +8,48 @@ dashedName: hailstone-sequence
# --description--
The Hailstone sequence of numbers can be generated from a starting positive integer, `n` by:
I numeri di Hailstone possono essere generati da un numero intero positivo iniziale, `n` in questo modo:
- If `n` is `1` then the sequence ends
- If `n` is `even` then the next `n` of the sequence `= n/2`
- If `n` is `odd` then the next `n` of the sequence `= (3 * n) + 1`
- Se `n` è `1` allora la sequenza termina
- Se `n` è `pari` allora il successivo `n` della sequenza `= n/2`
- Se `n` è `dispari` allora il successivo `n` della sequenza `= (3 * n) + 1`
The (unproven) Collatz conjecture is that the hailstone sequence for any starting number always terminates.
La congettura di Collatz (non dimostrata) è che i numeri di Hailstone per qualsiasi numero iniziale arrivano sempre a 1.
The hailstone sequence is also known as hailstone numbers (because the values are usually subject to multiple descents and ascents like hailstones in a cloud), or as the Collatz sequence.
I numeri di Hailstone (detti così perché i valori sono di solito soggetti a più discese e salite come la grandine in una nuvola), sono anche noti come sequenza di Collatz.
# --instructions--
1. Create a routine to generate the hailstone sequence for a number
2. Your function should return an array with the number less than `limit` which has the longest hailstone sequence and that sequence's length. (But don't show the actual sequence!)
1. Crea una routine per generare la sequenza di Collatz per un numero
2. La tua funzione dovrebbe restituire un array con il numero sotto `limit` che ha la più lunga sequenza di collatz e la lunghezza della sequenza. (Ma non mostrare la sequenza effettiva!)
# --hints--
`hailstoneSequence` should be a function.
`hailstoneSequence` dovrebbe essere una funzione.
```js
assert(typeof hailstoneSequence === 'function');
```
`hailstoneSequence(30)` should return an array.
`hailstoneSequence(30)` dovrebbe restituire un array.
```js
assert(Array.isArray(hailstoneSequence(30)));
```
`hailstoneSequence(30)` should return `[27, 112]`.
`hailstoneSequence(30)` dovrebbe restituire `[27, 112]`.
```js
assert.deepEqual(hailstoneSequence(30), [27, 112]);
```
`hailstoneSequence(50000)` should return `[35655, 324]`.
`hailstoneSequence(50000)` dovrebbe restituire `[35655, 324]`.
```js
assert.deepEqual(hailstoneSequence(50000), [35655, 324]);
```
`hailstoneSequence(100000)` should return `[77031, 351]`.
`hailstoneSequence(100000)` dovrebbe restituire `[77031, 351]`.
```js
assert.deepEqual(hailstoneSequence(100000), [77031, 351]);

View File

@ -1,6 +1,6 @@
---
id: 594810f028c0303b75339ad1
title: Happy numbers
title: Numeri felici
challengeType: 5
forumTopicId: 302280
dashedName: happy-numbers
@ -8,89 +8,89 @@ dashedName: happy-numbers
# --description--
A [happy number](https://en.wikipedia.org/wiki/Happy_number) is defined by the following process:
Un [numero felice](https://it.wikipedia.org/wiki/Numero_felice) è definito dal seguente processo:
Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals `1` (where it will stay), or it loops endlessly in a cycle which does not include `1`. Those numbers for which this process ends in `1` are happy numbers, while those that do not end in `1` are unhappy numbers.
A partire da un numero intero positivo, sostituisci il numero con la somma dei quadrati delle sue cifre, e ripeti il processo fino a quando il numero è uguale a `1` (dove resterà), o si ripete senza fine in un ciclo che non include `1`. Quei numeri per i quali questo processo termina in `1` sono numeri felici, mentre quelli che non terminano in `1` sono numeri infelici.
# --instructions--
Implement a function that returns true if the number is happy, or false if not.
Implementa una funzione che restituisce true se il numero è felice, o false se no.
# --hints--
`happy` should be a function.
`happy` dovrebbe essere una funzione.
```js
assert(typeof happy === 'function');
```
`happy(1)` should return a boolean.
`happy(1)` dovrebbe restituire un booleano.
```js
assert(typeof happy(1) === 'boolean');
```
`happy(1)` should return `true`.
`happy(1)` dovrebbe restituire `true`.
```js
assert(happy(1));
```
`happy(2)` should return `false`.
`happy(2)` dovrebbe restituire `false`.
```js
assert(!happy(2));
```
`happy(7)` should return `true`.
`happy(7)` dovrebbe restituire `true`.
```js
assert(happy(7));
```
`happy(10)` should return `true`.
`happy(10)` dovrebbe restituire `true`.
```js
assert(happy(10));
```
`happy(13)` should return `true`.
`happy(13)` dovrebbe restituire `true`.
```js
assert(happy(13));
```
`happy(19)` should return `true`.
`happy(19)` dovrebbe restituire `true`.
```js
assert(happy(19));
```
`happy(23)` should return `true`.
`happy(23)` dovrebbe restituire `true`.
```js
assert(happy(23));
```
`happy(28)` should return `true`.
`happy(28)` dovrebbe restituire `true`.
```js
assert(happy(28));
```
`happy(31)` should return `true`.
`happy(31)` dovrebbe restituire `true`.
```js
assert(happy(31));
```
`happy(32)` should return `true`.
`happy(32)` dovrebbe restituire `true`.
```js
assert(happy(32));
```
`happy(33)` should return `false`.
`happy(33)` dovrebbe restituire `false`.
```js
assert(!happy(33));

View File

@ -1,6 +1,6 @@
---
id: 595668ca4cfe1af2fb9818d4
title: Harshad or Niven series
title: Serie di Harshad o Niven
challengeType: 5
forumTopicId: 302281
dashedName: harshad-or-niven-series
@ -8,39 +8,39 @@ dashedName: harshad-or-niven-series
# --description--
The Harshad or Niven numbers are positive integers ≥ 1 that are divisible by the sum of their digits.
I numeri di Harshad o Niven sono numeri interi positivi ≥ 1 che sono divisibili per la somma delle loro cifre.
For example, `42` is a Harshad number as `42` is divisible by `(4 + 2)` without remainder.
Ad esempio, `42` è un numero di Harshad dato che `42` è divisibile per `(4 + 2)` senza resto.
Assume that the series is defined as the numbers in increasing order.
Assumiamo che la serie sia definita con i numeri in ordine crescente.
# --instructions--
Implement a function to generate successive members of the Harshad sequence.
Implementare una funzione per generare elementi successivi della sequenza di Harshad.
Use it to return an array with ten members of the sequence, starting with first Harshad number greater than `n`.
Usalo per restituire un array con dieci elementi della sequenza, iniziando con il primo numero di Harshad maggiore di `n`.
# --hints--
`isHarshadOrNiven` should be a function.
`isHarshadOrNiven` dovrebbe essere una funzione.
```js
assert(typeof isHarshadOrNiven === 'function');
```
`isHarshadOrNiven(10)` should return `[12, 18, 20, 21, 24, 27, 30, 36, 40, 42]`
`isHarshadOrNiven(10)` dovrebbe restituire `[12, 18, 20, 21, 24, 27, 30, 36, 40, 42]`
```js
assert.deepEqual(isHarshadOrNiven(10), [12, 18, 20, 21, 24, 27, 30, 36, 40, 42]);
```
`isHarshadOrNiven(400)` should return `[402, 405, 407, 408, 410, 414, 420, 423, 432, 440]`
`isHarshadOrNiven(400)` dovrebbe restituire `[402, 405, 407, 408, 410, 414, 420, 423, 432, 440]`
```js
assert.deepEqual(isHarshadOrNiven(400), [402, 405, 407, 408, 410, 414, 420, 423, 432, 440]);
```
`isHarshadOrNiven(1000)` should return `[1002, 1008, 1010, 1011, 1012, 1014, 1015, 1016, 1017, 1020]`
`isHarshadOrNiven(1000)` dovrebbe restituire `[1002, 1008, 1010, 1011, 1012, 1014, 1015, 1016, 1017, 1020]`
```js
assert.deepEqual(isHarshadOrNiven(1000), [1002, 1008, 1010, 1011, 1012, 1014, 1015, 1016, 1017, 1020]);

View File

@ -1,6 +1,6 @@
---
id: 595671d4d2cdc305f0d5b36f
title: Hash from two arrays
title: Hash da due array
challengeType: 5
forumTopicId: 302283
dashedName: hash-from-two-arrays
@ -8,53 +8,53 @@ dashedName: hash-from-two-arrays
# --description--
Using two Arrays of equal length, create a Hash object where the elements from one array (the keys) are linked to the elements of the other (the values).
Utilizzando due array di uguale lunghezza, crea un oggetto Hash dove gli elementi di un array (le chiavi) sono collegati agli elementi dell'altro (i valori).
**Related task:**
**Compito correlato:**
<ul>
<li><a href='https://rosettacode.org/wiki/Associative arrays/Creation' title='Associative arrays/Creation' target='_blank'>Associative arrays/Creation</a></li>
<li><a href='https://rosettacode.org/wiki/Associative arrays/Creation' title='Array associativi/Creazione' target='_blank'>Array associativi/Creazione</a></li>
</ul>
# --hints--
`arrToObj` should be a function.
`arrToObj` dovrebbe essere una funzione.
```js
assert(typeof arrToObj === 'function');
```
`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])` should return `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }`
`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d", "e"])` dovrebbe restituire `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: "e" }`
```js
assert.deepEqual(arrToObj(...testCases[0]), res[0]);
```
`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])` should return `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }`
`arrToObj([1, 2, 3, 4, 5], ["a", "b", "c", "d"])` dovrebbe restituire `{ 1: "a", 2: "b", 3: "c", 4: "d", 5: undefined }`
```js
assert.deepEqual(arrToObj(...testCases[1]), res[1]);
```
`arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])` should return `{ 1: "a", 2: "b", 3: "c" }`
`arrToObj([1, 2, 3], ["a", "b", "c", "d", "e"])` dovrebbe restituire `{ 1: "a", 2: "b", 3: "c" }`
```js
assert.deepEqual(arrToObj(...testCases[2]), res[2]);
```
`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])` should return `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }`
`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4, 5])` dovrebbe restituire `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": 5 }`
```js
assert.deepEqual(arrToObj(...testCases[3]), res[3]);
```
`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])` should return `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }`
`arrToObj(["a", "b", "c", "d", "e"], [1, 2, 3, 4])` dovrebbe restituire `{ "a": 1, "b": 2, "c": 3 , "d": 4, "e": undefined }`
```js
assert.deepEqual(arrToObj(...testCases[4]), res[4]);
```
`arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])` should return `{ "a": 1, "b": 2, "c": 3 }`
`arrToObj(["a", "b", "c"], [1, 2, 3, 4, 5])` dovrebbe restituire `{ "a": 1, "b": 2, "c": 3 }`
```js
assert.deepEqual(arrToObj(...testCases[5]), res[5]);

View File

@ -8,20 +8,20 @@ dashedName: hash-join
# --description--
An [inner join](https://en.wikipedia.org/wiki/Join_(SQL)#Inner_join "wp: Join\_(SQL)#Inner_join") is an operation that combines two data tables into one table, based on matching column values. The simplest way of implementing this operation is the [nested loop join](https://en.wikipedia.org/wiki/Nested loop join "wp: Nested loop join") algorithm, but a more scalable alternative is the [hash join](https://en.wikipedia.org/wiki/hash join "wp: hash join") algorithm.
Un [inner join](https://www.freecodecamp.org/news/sql-join-types-inner-join-vs-outer-join-example/#how-to-use-an-inner-join-in-sql "news: SQL Join Types Inner Join VS Outer Join Example#How to Use an INNER JOIN in SQL") è un'operazione che combina due tabelle di dati in una nuova tabella, in base ai valori di colonna corrispondenti. Il modo più semplice di implementare questa operazione è l'algoritmo [nested loop join](https://en.wikipedia.org/wiki/Nested loop join "wp: Nested loop join"), ma un'alternativa più scalabile è l'algoritmo [hash join](https://en.wikipedia.org/wiki/hash join "wp: hash join").
The "hash join" algorithm consists of two steps:
L'algoritmo "hash join" consiste in due passaggi:
<ol>
<li><strong>Hash phase:</strong> Create a <a href='https://en.wikipedia.org/wiki/Multimap' title='wp: Multimap' target='_blank'>multimap</a> from one of the two tables, mapping from each join column value to all the rows that contain it.</li>
<li><strong>Fase di Hash:</strong> Crea una <a href='https://en.wikipedia.org/wiki/Multimap' title='wp: Multimap' target='_blank'>multimappa</a> da una delle due tabelle, che mappa ogni valore della colonna di unione a tutte le righe che lo contengono.</li>
<ul>
<li>The multimap must support hash-based lookup which scales better than a simple linear search, because that's the whole point of this algorithm.</li>
<li>Ideally we should create the multimap for the smaller table, thus minimizing its creation time and memory size.</li>
<li>La multimappa deve supportare la ricerca basata su hash che scala meglio di una semplice ricerca lineare, perché questo è il punto di questo algoritmo.</li>
<li>Idealmente dovremmo creare la multimappa per la tabella più piccola, riducendo così al minimo il tempo di creazione e la dimensione della memoria.</li>
</ul>
<li><strong>Join phase:</strong> Scan the other table, and find matching rows by looking in the multimap created before.</li>
<li><strong>Fase di unione:</strong> Scansiona l'altra tabella e trova le righe corrispondenti guardando nella multimappa creata prima.</li>
</ol>
In pseudo-code, the algorithm could be expressed as follows:
In pseudo-codice, l'algoritmo può essere espresso come segue:
<pre><strong>let</strong> <i>A</i> = the first input table (or ideally, the larger one)
<strong>let</strong> <i>B</i> = the second input table (or ideally, the smaller one)
@ -39,7 +39,7 @@ In pseudo-code, the algorithm could be expressed as follows:
# --instructions--
Implement the "hash join" algorithm as a function and demonstrate that it passes the test-case listed below. The function should accept two arrays of objects and return an array of combined objects.
Implementare l'algoritmo "hash join" come funzione e dimostrare che supera il caso di prova elencato di seguito. La funzione dovrebbe accettare due array di oggetti e restituire un array di oggetti combinati.
**Input**
@ -65,7 +65,7 @@ Implement the "hash join" algorithm as a function and demonstrate that it passes
</tr>
<tr>
<td style="padding: 4px; margin: 5px;">28</td>
<td style="padding: 4px; margin: 5px;">Glory</td>
<td style="padding: 4px; margin: 5px;">Gloria</td>
</tr>
<tr>
<td style="padding: 4px; margin: 5px;">18</td>
@ -113,13 +113,13 @@ Implement the "hash join" algorithm as a function and demonstrate that it passes
<i>j<sub>A</sub> =</i>
</td>
<td style="border:none">
<i><code>Name</code> (i.e. column 1)</i>
<i><code>Name</code> (cioè colonna 1)</i>
</td>
<td style="border:none">
<i>j<sub>B</sub> =</i>
</td>
<td style="border:none">
<i><code>Character</code> (i.e. column 0)</i>
<i><code>Character</code> (cioè colonna 0)</i>
</td>
</tr>
</table>
@ -139,17 +139,17 @@ Implement the "hash join" algorithm as a function and demonstrate that it passes
| 28 | Alan | Alan | Ghosts |
| 28 | Alan | Alan | Zombies |
The order of the rows in the output table is not significant.
L'ordine delle righe nella tabella di output non è significativo.
# --hints--
`hashJoin` should be a function.
`hashJoin` dovrebbe essere una funzione.
```js
assert(typeof hashJoin === 'function');
```
`hashJoin([{ age: 27, name: "Jonah" }, { age: 18, name: "Alan" }, { age: 28, name: "Glory" }, { age: 18, name: "Popeye" }, { age: 28, name: "Alan" }], [{ character: "Jonah", nemesis: "Whales" }, { character: "Jonah", nemesis: "Spiders" }, { character: "Alan", nemesis: "Ghosts" }, { character:"Alan", nemesis: "Zombies" }, { character: "Glory", nemesis: "Buffy" }, { character: "Bob", nemesis: "foo" }])` should return `[{"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Whales"}, {"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Spiders"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}, {"A_age": 28,"A_name": "Glory", "B_character": "Glory", "B_nemesis": "Buffy"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}]`
`hashJoin([{ age: 27, name: "Jonah" }, { age: 18, name: "Alan" }, { age: 28, name: "Glory" }, { age: 18, name: "Popeye" }, { age: 28, name: "Alan" }], [{ character: "Jonah", nemesis: "Whales" }, { character: "Jonah", nemesis: "Spiders" }, { character: "Alan", nemesis: "Ghosts" }, { character:"Alan", nemesis: "Zombies" }, { character: "Glory", nemesis: "Buffy" }, { character: "Bob", nemesis: "foo" }])` dovrebbe restituire `[{"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Whales"}, {"A_age": 27,"A_name": "Jonah", "B_character": "Jonah", "B_nemesis": "Spiders"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 18,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}, {"A_age": 28,"A_name": "Glory", "B_character": "Glory", "B_nemesis": "Buffy"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Ghosts"}, {"A_age": 28,"A_name": "Alan", "B_character": "Alan", "B_nemesis": "Zombies"}]`
```js
assert.deepEqual(hashJoin(hash1, hash2), res);

View File

@ -1,6 +1,6 @@
---
id: 595b98f8b5a2245e243aa831
title: Heronian triangles
title: Triangoli heroniani
challengeType: 5
forumTopicId: 302285
dashedName: heronian-triangles
@ -8,57 +8,57 @@ dashedName: heronian-triangles
# --description--
[Hero's formula](https://en.wikipedia.org/wiki/Heron's formula "wp: Heron's formula") for the area of a triangle given the length of its three sides `a`, `b`, and `c` is given by:
La [Formula di Herone](https://en.wikipedia.org/wiki/Heron's formula "wp: Heron's formula") per l'area di un triangolo data la lunghezza dei suoi tre lati `a` `b`, e `c` è data da:
$A = \\sqrt{s(s-a)(s-b)(s-c)},$
where `s` is half the perimeter of the triangle; that is,
dove `s` è la metà del perimetro del triangolo, cioè
$s=\\frac{a+b+c}{2}.$
Heronian triangles are triangles whose sides and area are all integers.
I triangoli heroniani sono triangoli i cui lati e l'area sono tutti numeri interi.
An example is the triangle with sides `3, 4, 5` whose area is `6` (and whose perimeter is `12`).
Un esempio è il triangolo con i lati `3, 4, 5` la cui area è `6` (e il cui perimetro è `12`).
Note that any triangle whose sides are all an integer multiple of `3, 4, 5`; such as `6, 8, 10,` will also be a Heronian triangle.
Si noti che qualsiasi triangolo i cui lati sono tutti un numero intero multiplo di `3, 4, 5` come `6, 8, 10,` sarà anch'esso un triangolo heroniano.
Define a Primitive Heronian triangle as a Heronian triangle where the greatest common divisor
Definisci un triangolo heroniano primitivo come un triangolo eroniano dove il più grande divisore comune
of all three sides is `1` (unity).
di tutti e tre i lati è `1` (unità).
This will exclude, for example, triangle `6, 8, 10.`
Ciò escluderà, ad esempio, il triangolo `6, 8, 10.`
# --instructions--
Implement a function based on Hero's formula that returns the first <code>n<sub>th</sub></code> ordered triangles in an array of arrays.
Implementa una funzione basata sulla formula di Herone che restituisce i primi <code>n</code> triangoli ordinati in un array di array.
# --hints--
`heronianTriangle` should be a function.
`heronianTriangle` dovrebbe essere una funzione.
```js
assert(typeof heronianTriangle === 'function');
```
`heronianTriangle(10)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]`
`heronianTriangle(10)` dovrebbe restituire `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17]]`
```js
assert.deepEqual(heronianTriangle(testCases[0]), res[0]);
```
`heronianTriangle(15)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],`
`heronianTriangle(15)` dovrebbe restituire `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15]],`
```js
assert.deepEqual(heronianTriangle(testCases[1]), res[1]);
```
`heronianTriangle(20)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],`
`heronianTriangle(20)` dovrebbe restituire `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53]],`
```js
assert.deepEqual(heronianTriangle(testCases[2]), res[2]);
```
`heronianTriangle(25)` should return `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]`
`heronianTriangle(25)` dovrebbe restituire `[[3, 4, 5], [5, 5, 6], [5, 5, 8], [4, 13, 15], [5, 12, 13], [9, 10, 17], [3, 25, 26], [7, 15, 20], [10, 13, 13], [8, 15, 17], [13, 13, 24], [6, 25, 29], [11, 13, 20], [5, 29, 30], [13, 14, 15], [10, 17, 21], [7, 24, 25], [8, 29, 35], [12, 17, 25], [4, 51, 53], [19, 20, 37],[16, 17, 17], [17, 17, 30], [16, 25, 39], [13, 20, 21]]`
```js
assert.deepEqual(heronianTriangle(testCases[3]), res[3]);

View File

@ -1,6 +1,6 @@
---
id: 59622f89e4e137560018a40e
title: Hofstadter Figure-Figure sequences
title: Sequenze figura-figura di Hofstadter
challengeType: 5
forumTopicId: 302286
dashedName: hofstadter-figure-figure-sequences
@ -8,31 +8,31 @@ dashedName: hofstadter-figure-figure-sequences
# --description--
These two sequences of positive integers are defined as:
Queste due sequnze di numeri interi positivi sono definite come:
$R(1)=1\\ ;\\ S(1)=2 \\\\R(n)=R(n-1)+S(n-1), \\quad n>1.$
The sequence $S(n)$ is further defined as the sequence of positive integers not present in $R(n)$.
La sequenza $S(n)$ è ulteriormente definita come la sequenza di numeri interi positivi non presenti in $R(n)$.
Sequence $R$ starts:
La sequenza $R$ inizia in questo modo:
<pre>1, 3, 7, 12, 18, ...</pre>
Sequence $S$ starts:
La sequenza $S$ inizia in questo modo:
<pre>2, 4, 5, 6, 8, ...</pre>
# --instructions--
Create two functions named `ffr` and `ffs` that when given `n` return `R(n)` or `S(n)` respectively. (Note that R(1) = 1 and S(1) = 2 to avoid off-by-one errors).
Crea due funzioni chiamate `ffr` e `ffs` che quando dato `n` restituiscono rispettivamente `R(n)` o `S(n)`. (Nota che R(1) = 1 e S(1) = 2 per evitare errori off-by-one).
No maximum value for `n` should be assumed.
Non deve essere ipotizzato un valore massimo di `n`.
**References**
**Riferimenti**
<ul>
<li>
Sloane's <a href='https://oeis.org/A005228' target='_blank'>A005228</a> and <a href='https://oeis.org/A030124' target='_blank'>A030124</a>.
<a href='https://oeis.org/A005228' target='_blank'>A005228</a> e <a href='https://oeis.org/A030124' target='_blank'>A030124</a> di Sloane.
</li>
<li>
Wikipedia: <a href='https://en.wikipedia.org/wiki/Hofstadter_sequence#Hofstadter_Figure-Figure_sequences' title='wp: Hofstadter_sequence#Hofstadter_Figure-Figure_sequences' target='_blank'>Hofstadter Figure-Figure sequences</a>.
@ -41,73 +41,73 @@ No maximum value for `n` should be assumed.
# --hints--
`ffr` should be a function.
`ffr` dovrebbe essere una funzione.
```js
assert(typeof ffr === 'function');
```
`ffs` should be a function.
`ffs` dovrebbe essere una funzione.
```js
assert(typeof ffs === 'function');
```
`ffr` should return integer.
`ffr` dovrebbe restituire un numero intero.
```js
assert(Number.isInteger(ffr(1)));
```
`ffs` should return integer.
`ffs` dovrebbe restituire un numero intero.
```js
assert(Number.isInteger(ffs(1)));
```
`ffr(10)` should return `69`
`ffr(10)` dovrebbe restituire `69`
```js
assert.equal(ffr(ffrParamRes[0][0]), ffrParamRes[0][1]);
```
`ffr(50)` should return `1509`
`ffr(50)` dovrebbe restituire `1509`
```js
assert.equal(ffr(ffrParamRes[1][0]), ffrParamRes[1][1]);
```
`ffr(100)` should return `5764`
`ffr(100)` dovrebbe restituire `5764`
```js
assert.equal(ffr(ffrParamRes[2][0]), ffrParamRes[2][1]);
```
`ffr(1000)` should return `526334`
`ffr(1000)` dovrebbe restituire `526334`
```js
assert.equal(ffr(ffrParamRes[3][0]), ffrParamRes[3][1]);
```
`ffs(10)` should return `14`
`ffs(10)` dovrebbe restituire `14`
```js
assert.equal(ffs(ffsParamRes[0][0]), ffsParamRes[0][1]);
```
`ffs(50)` should return `59`
`ffs(50)` dovrebbe restituire `59`
```js
assert.equal(ffs(ffsParamRes[1][0]), ffsParamRes[1][1]);
```
`ffs(100)` should return `112`
`ffs(100)` dovrebbe restituire `112`
```js
assert.equal(ffs(ffsParamRes[2][0]), ffsParamRes[2][1]);
```
`ffs(1000)` should return `1041`
`ffs(1000)` dovrebbe restituire `1041`
```js
assert.equal(ffs(ffsParamRes[3][0]), ffsParamRes[3][1]);

View File

@ -23,7 +23,7 @@ myTest();
console.log(loc);
```
`myTest()` 関数の呼び出しでは、コンソールに文字列 `foo` が表示されます。 The `console.log(loc)` line (outside of the `myTest` function) will throw an error, as `loc` is not defined outside of the function.
`myTest()` 関数の呼び出しでは、コンソールに文字列 `foo` が表示されます。 (`myTest` 関数の外側にある) `console.log(loc)` の行は、エラーをスローします。これは、関数の外側では `loc` が定義されていないためです。
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: a97fd23d9b809dac9921074f
title: 引数は省略可能である
title: 省略可能な引数
challengeType: 5
forumTopicId: 14271
dashedName: arguments-optional
@ -8,11 +8,11 @@ dashedName: arguments-optional
# --description--
2 つの引数を合計する関数を作成してください。 1 つの引数のみが与えられた場合は、1 つの引数を想定して合計を返す関数を返してください。
2 つの引数を合計する関数を作成してください。 1 つの引数のみが与えられた場合は、関数を返してください。その関数は 1 つの引数を取り、合計を返します
たとえば、`addTogether(2, 3)``5`を返し、`addTogether(2)` は関数を返す必要があります。
この返された関数を単一の引数で呼び出すと、合計を返します。
この返された関数 つの引数を与えて呼び出すと、合計を返します。
```js
var sumTwoAnd = addTogether(2);
@ -60,7 +60,7 @@ assert.isUndefined(addTogether(2, '3'));
assert.isUndefined(addTogether(2)([3]));
```
`addTogether("2", 3)` should return `undefined`.
`addTogether("2", 3)` `undefined` を返す必要があります。
```js
assert.isUndefined(addTogether('2', 3));

View File

@ -23,7 +23,7 @@ myTest();
console.log(loc);
```
A chamada da função `myTest()` vai exibir a string `foo` no console. A linha `console.log(loc)` vai lançar um erro, já que `loc` não foi definido fora da função.
A chamada da função `myTest()` vai exibir a string `foo` no console. A linha `console.log(loc)` (fora da função `myTest`) vai lançar um erro, já que `loc` não foi definido fora da função.
# --instructions--

View File

@ -60,6 +60,12 @@ assert.isUndefined(addTogether(2, '3'));
assert.isUndefined(addTogether(2)([3]));
```
`addTogether("2", 3)` deve retornar `undefined`.
```js
assert.isUndefined(addTogether('2', 3));
```
# --seed--
## --seed-contents--

View File

@ -49,6 +49,23 @@ assert.sameMembers(
);
```
O grafo de entrada `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` com o nó inicial `3` deve retornar um array com `3`, `2`, `1` e `0`.
```js
assert.sameMembers(
(function () {
var graph = [
[0, 1, 0, 0],
[1, 0, 1, 0],
[0, 1, 0, 1],
[0, 0, 1, 0]
];
return dfs(graph, 3);
})(),
[3, 2, 1, 0]
);
```
O grafo de entrada `[[0, 1, 0, 0], [1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0]]` com o nó inicial `1` deve retornar um array com quatro elementos.
```js

View File

@ -1,6 +1,6 @@
---
id: 5f1a4ef5d5d6b5ab580fc6ae
title: Build a Celestial Bodies Database
title: Criar um banco de dados de corpos celestiais
challengeType: 13
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-celestial-bodies-database
@ -9,15 +9,15 @@ dashedName: build-a-celestial-bodies-database
# --description--
This is one of the required projects to earn your certification. For this project, you will build a database of celestial bodies using PostgreSQL.
Este é um dos projetos necessários para obter sua certificação. Para este projeto, você vai construir um banco de dados de corpos celestiais usando PostgreSQL.
# --instructions--
**Important:** After you pass all the project tests, save a dump of your database into a `universe.sql` file so you can complete step 2. There will be instructions how to do that within the virtual machine.
**Importante:** depois de passar em todos os testes de projetos, salve um dump (cópia) de seu banco de dados em um arquivo `universe.sql` para poder completar a etapa 2. Haverá instruções sobre como fazer isso dentro da máquina virtual.
# --notes--
Required files: `universe.sql`
Arquivos necessários: `universe.sql`
# --hints--

View File

@ -1,6 +1,6 @@
---
id: 602da04c22201c65d2a019f4
title: Build a Number Guessing Game
title: Criar um jogo de adivinhação de números
challengeType: 13
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-number-guessing-game
@ -9,15 +9,15 @@ dashedName: build-a-number-guessing-game
# --description--
This is one of the required projects to earn your certification. For this project, you will use Bash scripting, PostgreSQL, and Git to create a number guessing game that runs in the terminal and saves user information.
Este é um dos projetos necessários para obter sua certificação. Para este projeto, você usará scripts de Bash, PostgreSQL e o Git para criar um jogo de sugestões de números que será executado no terminal e que gravará as informações de usuários.
# --instructions--
**Important:** After you pass all the project tests, save a dump of your database into a `number_guessers.sql` file, as well as your whole `number_guessing_game` folder, so you can complete step 2. There will be instructions how to do that within the virtual machine.
**Importante:** depois de passar em todos os testes do projeto, salve um dump (cópia) do seu banco de dados em um arquivo `number_guessers.sql`, bem como toda a sua pasta `number_guessing_game` para poder concluir a etapa 2. Haverá instruções sobre como fazer isso dentro da máquina virtual.
# --notes--
Required files: `number_guessers.sql`, and the whole `number_guessing_game` folder
Arquivos necessários: `number_guessers.sql` e toda a pasta `number_guessing_game`
# --hints--

View File

@ -1,6 +1,6 @@
---
id: 602d9ff222201c65d2a019f2
title: Build a Periodic Table Database
title: Criar um banco de dados da tabela periódica
challengeType: 13
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-periodic-table-database
@ -9,15 +9,15 @@ dashedName: build-a-periodic-table-database
# --description--
This is one of the required projects to earn your certification. For this project, you will create Bash a script to get information about chemical elements from a periodic table database.
Este é um dos projetos necessários para obter sua certificação. Para este projeto, você criará um script no Bash para obter informações sobre elementos químicos de um banco de dados de tabela periódica.
# --instructions--
**Important:** After you pass all the project tests, save a dump of your database into a `elements.sql` file, as well as your whole `periodic_table` folder, so you can complete step 2. There will be instructions how to do that within the virtual machine.
**Importante:** depois de passar em todos os testes do projeto, salve um dump (cópia) do seu banco de dados em um arquivo `elements.sql`, bem como toda a sua pasta `periodic_table` para poder concluir a etapa 2. Haverá instruções sobre como fazer isso dentro da máquina virtual.
# --notes--
Required files: `elements.sql`, and the whole `periodic_table` folder
Arquivos necessários: `elements.sql` e toda a pasta `periodic_table`
# --hints--

View File

@ -1,6 +1,6 @@
---
id: 5f87ac112ae598023a42df1a
title: Build a Salon Appointment Scheduler
title: Criar um agendador de compromissos do salão de beleza
challengeType: 13
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-salon-appointment-scheduler
@ -9,15 +9,15 @@ dashedName: build-a-salon-appointment-scheduler
# --description--
This is one of the required projects to earn your certification. For this project, you will create an interactive Bash program that uses PostgreSQL to track the customers and appointments for your salon.
Este é um dos projetos necessários para obter sua certificação. Para este projeto, você criará um programa de bash interativo que utiliza PostgreSQL para acompanhar os clientes e horários marcados em seu salão.
# --instructions--
**Important:** After you pass all the project tests, save a dump of your database into a `salon.sql` file, as well as your `salon.sh` file, so you can complete step 2. There will be instructions how to do that within the virtual machine.
**Importante:** depois de passar em todos os testes do projeto, salve um dump (cópia) do seu banco de dados no arquivo `salon.sql` bem como seu arquivo `salon.sh` para poder completar a etapa 2. Haverá instruções sobre como fazer isso dentro da máquina virtual.
# --notes--
Required files: `salon.sql`, `salon.sh`
Arquivos necessários: `salon.sql`, `salon.sh`
# --hints--

View File

@ -1,6 +1,6 @@
---
id: 5f9771307d4d22b9d2b75a94
title: Build a World Cup Database
title: Criar um banco de dados da Copa do Mundo
challengeType: 13
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-world-cup-database
@ -9,15 +9,15 @@ dashedName: build-a-world-cup-database
# --description--
This is one of the required projects to earn your certification. For this project, you will create a Bash script that enters information from World Cup games into PostgreSQL, then query the database for useful statistics.
Este é um dos projetos necessários para obter sua certificação. Para este projeto, você criará um script do Bash que insere informações de jogos da Copa do Mundo no PostgreSQL. Depois, você vai consultar o banco de dados para obter estatísticas úteis.
# --instructions--
**Important:** After you pass all the project tests, save a dump of your database into a `worldcup.sql` file, as well as your `insert_data.sh` and `queries.sh` files, so you can complete step 2. There will be instructions how to do that within the virtual machine.
**Importante:** depois de passar nos testes dos projetos, salve um dump (cópia) de seu banco de dados em um arquivo `worldcup.sql`, bem como seus arquivos `insert_data.sh` e `queries.sh`, para poder concluir a etapa 2. Haverá instruções sobre como fazer isso dentro da máquina virtual.
# --notes--
Required files: `worldcup.sql`, `insert_data.sh`, `queries.sh`
Arquivos necessários: `worldcup.sql`, `insert_data.sh`, `queries.sh`
# --hints--

View File

@ -1,6 +1,6 @@
---
id: 602da0de22201c65d2a019f6
title: Build a Kitty Ipsum Translator
title: Criar um tradutor de Kitty Ipsum
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-advanced-bash-by-building-a-kitty-ipsum-translator
@ -9,7 +9,7 @@ dashedName: build-a-kitty-ipsum-translator
# --description--
In this 140 lesson course, you will learn some more complex commands, and the details of how commands work.
Neste curso de 140 aulas, você aprenderá alguns comandos mais complexos e detalhes de como funcionam os comandos.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 5f5b969a05380d2179fe6e18
title: Build a Bike Rental Shop
title: Criar uma loja de aluguel de bicicletas
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-bash-and-sql-by-building-a-bike-rental-shop
@ -9,7 +9,7 @@ dashedName: build-a-bike-rental-shop
# --description--
In this 210 lesson course, you will build an interactive Bash program that stores rental information for your bike rental shop using PostgreSQL.
Neste curso intermediário, você vai construir um programa de Bash interativo que armazena informações de aluguel para sua loja de aluguel de bicicletas utilizando PostgreSQL.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 5ea8adfab628f68d805bfc5e
title: Build a Boilerplate
title: Criar um boilerplate
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-bash-by-building-a-boilerplate
@ -9,7 +9,7 @@ dashedName: build-a-boilerplate
# --description--
In this 170 lesson course, you will learn basic commands by creating a website boilerplate using only the command line.
Neste curso de 170 aulas, você aprenderá comandos básicos criando o boilerplate de um site usando apenas a linha de comando.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 5f5904ac738bc2fa9efecf5a
title: Build Five Programs
title: Criar cinco programas
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-bash-scripting-by-building-five-programs
@ -9,7 +9,7 @@ dashedName: build-five-programs
# --description--
In this 220 lesson course, you will learn more terminal commands and how to use them within Bash scripts by creating five small programs.
Neste curso de 220 aulas, você aprenderá mais comandos do terminal e como usá-los dentro de scripts do Bash, criando cinco programas pequenos.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 5fa323cdaf6a73463d590659
title: Build an SQL Reference Object
title: Criar um objeto de referência SQL
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-git-by-building-an-sql-reference-object
@ -9,7 +9,7 @@ dashedName: build-an-sql-reference-object
# --description--
In this 240 lesson course, you will learn how Git keeps track of your code by creating an object containing commonly used SQL commands.
Neste curso de 240 aulas, você aprenderá como o Git mantém o controle do seu código, criando um objeto que contém comandos SQL comumente usados.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 5f32db63eb37f7e17323f459
title: Build a Castle
title: Criar um castelo
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-nano-by-building-a-castle
@ -9,7 +9,7 @@ dashedName: build-a-castle
# --description--
In this 40 lesson course, you will learn how to edit files in the terminal with Nano while building a castle.
Neste curso de 40 aulas, você aprenderá a editar arquivos no terminal com o nano e construirá um castelo.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 5f2c289f164c29556da632fd
title: Build a Mario Database
title: Criar um banco de dados do Mario
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-relational-databases-by-building-a-mario-database
@ -9,7 +9,7 @@ dashedName: build-a-mario-database
# --description--
In this 165 lesson course, you will learn the basics of relational databases by creating a PostgreSQL database filled with video game characters.
Neste curso de 165 aulas, você aprenderá o essencial sobre bancos de dados relacionais, criando um banco de dados PostgreSQL com vários personagens de videogame.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 602da0c222201c65d2a019f5
title: "Build a Student Database: Part 1"
title: "Criar um banco de dados de alunos: parte 1"
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-sql-by-building-a-student-database-part-1
@ -9,7 +9,7 @@ dashedName: build-a-student-database-part-1
# --description--
In this 140 lesson course, you will create a Bash script that uses SQL to enter information about your computer science students into PostgreSQL.
Neste curso de 140 aulas, você criará um script do Bash que utiliza SQL para inserir informações sobre seus alunos de ciência da computação no PostgreSQL.
# --instructions--

View File

@ -1,6 +1,6 @@
---
id: 618590adb0730ca724e37672
title: "Build a Student Database: Part 2"
title: "Criar um banco de dados de alunos: parte 2"
challengeType: 12
helpCategory: Backend Development
url: https://github.com/freeCodeCamp/learn-sql-by-building-a-student-database-part-2
@ -9,7 +9,7 @@ dashedName: build-a-student-database-part-2
# --description--
In this 140 lesson course, you will complete your student database while diving deeper into SQL commands.
Neste curso de 140 aulas, você completará seu banco de dados de alunos, mergulhando mais fundo nos comandos SQL.
# --instructions--