mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-04-18 19:00:54 -04:00
chore(i18n,learn): processed translations (#50333)
This commit is contained in:
@@ -8,29 +8,29 @@ dashedName: problem-127-abc-hits
|
||||
|
||||
# --description--
|
||||
|
||||
Il radicale di $n$, $rad(n)$, è il prodotto dei fattori primi distinti di $n$. For example, $504 = 2^3 × 3^2 × 7$, so $rad(504) = 2 × 3 × 7 = 42$.
|
||||
Il radicale di $n$, $rad(n)$, è il prodotto dei fattori primi distinti di $n$. Per esempio, $504 = 2^3 × 3^2 × 7$, quindi $rad(504) = 2 × 3 × 7 = 42$.
|
||||
|
||||
We shall define the triplet of positive integers (a, b, c) to be an abc-hit if:
|
||||
Definiamo la terna di numeri interi positivi (a, b, c) come un abc-hit se:
|
||||
|
||||
1. $GCD(a, b) = GCD(a, c) = GCD(b, c) = 1$
|
||||
1. $MCD(a, b) = MCD(a, c) = MCD(b, c) = 1$
|
||||
2. $a < b$
|
||||
3. $a + b = c$
|
||||
4. $rad(abc) < c$
|
||||
|
||||
For example, (5, 27, 32) is an abc-hit, because:
|
||||
Per esempio, (5, 27, 32) è un abc-hit poiché:
|
||||
|
||||
1. $GCD(5, 27) = GCD(5, 32) = GCD(27, 32) = 1$
|
||||
1. $MCD(5, 27) = MCD(5, 32) = MCD(27, 32) = 1$
|
||||
2. $5 < 27$
|
||||
3. $5 + 27 = 32$
|
||||
4. $rad(4320) = 30 < 32$
|
||||
|
||||
It turns out that abc-hits are quite rare and there are only thirty-one abc-hits for $c < 1000$, with $\sum{c} = 12523$.
|
||||
Gli abc-hit sono piuttosto rari e ce ne sono solo trentuno per $c < 1000$, con $\sum{c} = 12523$.
|
||||
|
||||
Find $\sum{c}$ for $c < 120000$.
|
||||
Trova $\sum{c}$ per $c < 120000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`abcHits()` should return `18407904`.
|
||||
`abcHits()` dovrebbe restituire `18407904`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(abcHits(), 18407904);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ec1000cf542c50feff
|
||||
title: 'Problem 128: Hexagonal tile differences'
|
||||
title: 'Problema 128: differenze di mattonelle esagonali'
|
||||
challengeType: 1
|
||||
forumTopicId: 301755
|
||||
dashedName: problem-128-hexagonal-tile-differences
|
||||
@@ -8,33 +8,33 @@ dashedName: problem-128-hexagonal-tile-differences
|
||||
|
||||
# --description--
|
||||
|
||||
A hexagonal tile with number 1 is surrounded by a ring of six hexagonal tiles, starting at "12 o'clock" and numbering the tiles 2 to 7 in an anti-clockwise direction.
|
||||
Una mattonella esagonale con il numero 1 è circondata da un anello di sei mattonelle esagonali numerate da 2 a 7 in direzione antioraria, partendo dalla posizione delle ore dodici.
|
||||
|
||||
New rings are added in the same fashion, with the next rings being numbered 8 to 19, 20 to 37, 38 to 61, and so on. The diagram below shows the first three rings.
|
||||
Nuovi anelli sono aggiungi nello stesso modo, con i nuovi anelli numerati da 8 a 19, da 20 a 37, da 38 a 61, e così via. Il diagramma seguente mostra i primi tre anelli.
|
||||
|
||||
<img class="img-responsive center-block" alt="three first rings of arranged hexagonal tiles with numbers 1 to 37, and with highlighted tiles 8 and 17" src="https://cdn.freecodecamp.org/curriculum/project-euler/hexagonal-tile-differences.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="i primi tre anelli delle mattonelle esagonali ordinate con numeri da 1 a 37 e con evidenziate le mattonelle 8 e 17" src="https://cdn.freecodecamp.org/curriculum/project-euler/hexagonal-tile-differences.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
By finding the difference between tile $n$ and each of its six neighbours we shall define $PD(n)$ to be the number of those differences which are prime.
|
||||
Trovando la differenza tra la mattonella $n$ e ognuna delle sei mattonelle vicine, definiamo $PD(n)$ come il numero delle differenze che sono numeri primi.
|
||||
|
||||
For example, working clockwise around tile 8 the differences are 12, 29, 11, 6, 1, and 13. So $PD(8) = 3$.
|
||||
Per esempio, lavorando in senso orario attorno alla mattonella 8 le differenze sono 12, 29, 11, 6, 1 e 13. Quindi $PD(8) = 3$.
|
||||
|
||||
In the same way, the differences around tile 17 are 1, 17, 16, 1, 11, and 10, hence $PD(17) = 2$.
|
||||
Allo stesso modo le differenze attorno alla mattonella 17 sono 1, 17, 16, 1, 11 e 10, quindi $PD(17) = 2$.
|
||||
|
||||
It can be shown that the maximum value of $PD(n)$ is $3$.
|
||||
SI può dimostrare che il valore massimo di $PD(n)$ è $3$.
|
||||
|
||||
If all of the tiles for which $PD(n) = 3$ are listed in ascending order to form a sequence, the 10th tile would be 271.
|
||||
Se tutte le mattonelle per cui $PD(n) = 3$ sono elencate in ordine crescente a formare una sequenza, la decima mattonella è 271.
|
||||
|
||||
Find the 2000th tile in this sequence.
|
||||
Trova la 2000-esima mattonella nella sequenza.
|
||||
|
||||
# --hints--
|
||||
|
||||
`hexagonalTile(10)` should return `271`.
|
||||
`hexagonalTile(10)` dovrebbe restituire `271`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(hexagonalTile(10), 271);
|
||||
```
|
||||
|
||||
`hexagonalTile(2000)` should return `14516824220`.
|
||||
`hexagonalTile(2000)` dovrebbe restituire `14516824220`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(hexagonalTile(2000), 14516824220);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ef1000cf542c50ff01
|
||||
title: 'Problem 129: Repunit divisibility'
|
||||
title: 'Problema 129: divisibilità dei repunit'
|
||||
challengeType: 1
|
||||
forumTopicId: 301756
|
||||
dashedName: problem-129-repunit-divisibility
|
||||
@@ -8,17 +8,17 @@ dashedName: problem-129-repunit-divisibility
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$; for example, $R(6) = 111111$.
|
||||
Un numero costituito interamente da uno è chiamato un repunit (ripetizione di uno). Definiamo $R(k)$ come repunit di lunghezza $k$, per esempio $R(6) = 111111$.
|
||||
|
||||
Given that $n$ is a positive integer and $GCD(n, 10) = 1$, it can be shown that there always exists a value, $k$, for which $R(k)$ is divisible by $n$, and let $A(n)$ be the least such value of $k$; for example, $A(7) = 6$ and $A(41) = 5$.
|
||||
Dato che $n$ è un numero positivo intero e $MCD(n, 10) = 1$, si può dimostrare che esiste sempre un valore di $k$ per cui $R(k)$ è divisibile per $n$, $A(n)$ è il minimo valore di $k$ per cui ciò è vero; per esempio, $A(7) = 6$ e $A(41) = 5$.
|
||||
|
||||
The least value of $n$ for which $A(n)$ first exceeds ten is 17.
|
||||
Il valore minimo di $n$ per cui $A(n)$ eccede per la prima volta 10 è 17.
|
||||
|
||||
Find the least value of $n$ for which $A(n)$ first exceeds one-million.
|
||||
Trova il valore minimo di $n$ per cui $A(n)$ eccede per la prima volta un milione.
|
||||
|
||||
# --hints--
|
||||
|
||||
`repunitDivisibility()` should return `1000023`.
|
||||
`repunitDivisibility()` dovrebbe restituire `1000023`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(repunitDivisibility(), 1000023);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ee1000cf542c50ff00
|
||||
title: 'Problem 130: Composites with prime repunit property'
|
||||
title: 'Problema 130: numeri compositi con la proprietà dei primi repunit'
|
||||
challengeType: 1
|
||||
forumTopicId: 301758
|
||||
dashedName: problem-130-composites-with-prime-repunit-property
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-130-composites-with-prime-repunit-property
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$; for example, $R(6) = 111111$.
|
||||
Un numero costituito interamente da uno è chiamato un repunit (ripetizione di uno). Definiamo $R(k)$ come repunit di lunghezza $k$, per esempio $R(6) = 111111$.
|
||||
|
||||
Given that $n$ is a positive integer and $GCD(n, 10) = 1$, it can be shown that there always exists a value, $k$, for which $R(k)$ is divisible by $n$, and let $A(n)$ be the least such value of $k$; for example, $A(7) = 6$ and $A(41) = 5$.
|
||||
Dato che $n$ è un numero positivo intero e $MCD(n, 10) = 1$, si può dimostrare che esiste sempre un valore di $k$ per cui $R(k)$ è divisibile per $n$, $A(n)$ è il minimo valore di $k$ per cui ciò è vero; per esempio, $A(7) = 6$ e $A(41) = 5$.
|
||||
|
||||
You are given that for all primes, $p > 5$, that $p − 1$ is divisible by $A(p)$. For example, when $p = 41, A(41) = 5$, and 40 is divisible by 5.
|
||||
Ti viene dato per tutti i numeri primi, $p > 5$, che $p − 1$ è divisibile per $A(p)$. Per esempio, quando $p = 41, A(41) = 5$, e 40 è divisibile per 5.
|
||||
|
||||
However, there are rare composite values for which this is also true; the first five examples being 91, 259, 451, 481, and 703.
|
||||
Eppure, ci sono anche rari valori compositi per i quali è vero; i primi cinque esempi sono 91, 259, 451, 481 e 703.
|
||||
|
||||
Find the sum of the first twenty-five composite values of $n$ for which $GCD(n, 10) = 1$ and $n − 1$ is divisible by $A(n)$.
|
||||
Trova la somma dei primi venticinque valori compositi di $n$ per cui $MCD(n, 10) = 1$ e $n - 1$ è divisibile per $A(n)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`compositeRepunit()` should return `149253`.
|
||||
`compositeRepunit()` dovrebbe restituire `149253`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(compositeRepunit(), 149253);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ef1000cf542c50ff02
|
||||
title: 'Problem 131: Prime cube partnership'
|
||||
title: 'Problema 131: l''alleanza dei cubi e dei numeri primi'
|
||||
challengeType: 1
|
||||
forumTopicId: 301759
|
||||
dashedName: problem-131-prime-cube-partnership
|
||||
@@ -8,17 +8,17 @@ dashedName: problem-131-prime-cube-partnership
|
||||
|
||||
# --description--
|
||||
|
||||
There are some prime values, $p$, for which there exists a positive integer, $n$, such that the expression $n^3 + n^{2}p$ is a perfect cube.
|
||||
Ci sono alcuni valori primi, $p$, per cui esiste un numero intero positivo, $n$, per cui l'espressione $n^3 + n^{2}p$ è un cubo perfetto.
|
||||
|
||||
For example, when $p = 19,\\ 8^3 + 8^2 × 19 = {12}^3$.
|
||||
Per esempio, quando $p = 19,\\8^3 + 8^2 × 19 = {12}^3$.
|
||||
|
||||
What is perhaps most surprising is that the value of $n$ is unique for each prime with this property, and there are only four such primes below one hundred.
|
||||
Forse ciò che è più sorprendente è che il valore di $n$ è unico per ogni primo con questa proprietà, e ci sono solo quattro primi con questa proprietà sotto cento.
|
||||
|
||||
How many primes below one million have this remarkable property?
|
||||
Quanti numeri primi sotto un milione hanno questa notevole proprietà?
|
||||
|
||||
# --hints--
|
||||
|
||||
`primeCubePartnership()` should return `173`.
|
||||
`primeCubePartnership()` dovrebbe restituire `173`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primeCubePartnership(), 173);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f11000cf542c50ff03
|
||||
title: 'Problem 132: Large repunit factors'
|
||||
title: 'Problema 132: grandi fattori repunit'
|
||||
challengeType: 1
|
||||
forumTopicId: 301760
|
||||
dashedName: problem-132-large-repunit-factors
|
||||
@@ -8,15 +8,15 @@ dashedName: problem-132-large-repunit-factors
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$.
|
||||
Un numero costituito interamente da uno è chiamato un repunit (ripetizione di uno). Definiremo $R(k)$ in modo che sia una repunit di lunghezza $k$.
|
||||
|
||||
For example, $R(10) = 1111111111 = 11 × 41 × 271 × 9091$, and the sum of these prime factors is 9414.
|
||||
Ad esempio, $R(10) = 1111111111 = 11 × 41 × 271 × 9091$ e la somma di questi fattori primi è 9414.
|
||||
|
||||
Find the sum of the first forty prime factors of $R({10}^9)$.
|
||||
Trova la somma dei primi quaranta fattori primi di $R({10}^9)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`largeRepunitFactors()` should return `843296`.
|
||||
`largeRepunitFactors()` dovrebbe restituire `843296`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(largeRepunitFactors(), 843296);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f21000cf542c50ff04
|
||||
title: 'Problem 133: Repunit nonfactors'
|
||||
title: 'Problema 133: non-fattori di numeri repunit'
|
||||
challengeType: 1
|
||||
forumTopicId: 301761
|
||||
dashedName: problem-133-repunit-nonfactors
|
||||
@@ -8,17 +8,17 @@ dashedName: problem-133-repunit-nonfactors
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define $R(k)$ to be a repunit of length $k$; for example, $R(6) = 111111$.
|
||||
Un numero costituito interamente da uno è chiamato un repunit (ripetizione di uno). Definiamo $R(k)$ come repunit di lunghezza $k$, per esempio $R(6) = 111111$.
|
||||
|
||||
Let us consider repunits of the form $R({10}^n)$.
|
||||
Consideriamo repunit della forma $R({10}^n)$.
|
||||
|
||||
Although $R(10)$, $R(100)$, or $R(1000)$ are not divisible by 17, $R(10000)$ is divisible by 17. Yet there is no value of n for which $R({10}^n)$ will divide by 19. Remarkably, 11, 17, 41, and 73 are the only four primes below one-hundred that can be a factor of $R({10}^n)$.
|
||||
Anche se $R(10)$, $R(100)$ o $R(1000)$ non sono divisibili per 17, $R(10000)$ è divisibile per 17. Però non c'è alcun valore di n per cui $R({10}^n)$ è divisibile per 19. Notevolmente, 11, 17, 41 e 73 sono i soli quattro numeri primi sotto cento che possono essere fattori di $R({10}^n)$.
|
||||
|
||||
Find the sum of all the primes below one-hundred thousand that will never be a factor of $R({10}^n)$.
|
||||
Trova la somma di tutti i primi sotto centomila che non saranno mai un fattore di $R({10}^n)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`repunitNonfactors()` should return `453647705`.
|
||||
`repunitNonfactors()` dovrebbe restituire `453647705`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(repunitNonfactors(), 453647705);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f21000cf542c50ff05
|
||||
title: 'Problem 134: Prime pair connection'
|
||||
title: 'Problema 134: connessioni di coppie di numeri primi'
|
||||
challengeType: 1
|
||||
forumTopicId: 301762
|
||||
dashedName: problem-134-prime-pair-connection
|
||||
@@ -8,15 +8,15 @@ dashedName: problem-134-prime-pair-connection
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the consecutive primes $p_1 = 19$ and $p_2 = 23$. It can be verified that 1219 is the smallest number such that the last digits are formed by $p_1$ whilst also being divisible by $p_2$.
|
||||
Considera i primi consecutivi $p_1 = 19$ e $p_2 = 23$. Si può verificare che 1219 è il numero più piccolo per cui le ultime cifre sono formate da $p_1$ essendo anche divisibile da $p_2$.
|
||||
|
||||
In fact, with the exception of $p_1 = 3$ and $p_2 = 5$, for every pair of consecutive primes, $p_2 > p_1$, there exist values of $n$ for which the last digits are formed by $p_1$ and $n$ is divisible by $p_2$. Let $S$ be the smallest of these values of $n$.
|
||||
Infatti, con l'eccezione di $p_1 = 3$ e $p_2 = 5$, per ogni coppia di numeri primi consecutivi, $p_2 > p_1$, esiste un valore di $n$ per cui le ultime cifre sono formate da $p_1$ e $n$ è divisibile per $p_2$. Sia $S$ il più piccolo di questi valori di $n$.
|
||||
|
||||
Find $\sum{S}$ for every pair of consecutive primes with $5 ≤ p_1 ≤ 1000000$.
|
||||
Trova $\sum{S}$ per ogni coppia di numeri primi consecutivi con $5 ≤ p_1 ≤ 1000000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`primePairConnection()` should return `18613426663617120`.
|
||||
`primePairConnection()` dovrebbe restituire `18613426663617120`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePairConnection(), 18613426663617120);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f31000cf542c50ff06
|
||||
title: 'Problem 135: Same differences'
|
||||
title: 'Problema 135: stesse differenze'
|
||||
challengeType: 1
|
||||
forumTopicId: 301763
|
||||
dashedName: problem-135-same-differences
|
||||
@@ -8,17 +8,17 @@ dashedName: problem-135-same-differences
|
||||
|
||||
# --description--
|
||||
|
||||
Given the positive integers, $x$, $y$, and $z$, are consecutive terms of an arithmetic progression, the least value of the positive integer, $n$, for which the equation, $x^2 − y^2 − z^2 = n$, has exactly two solutions is $n = 27$:
|
||||
Dati i numeri interi positivi, $x$, $y$ e $z$, che sono termini consecutivi di una progressione aritmetica, il valore minimo dell'intero positivo $n$ per il quale l'equazione $x^2 − y^2 − z^2 = n$ ha esattamente due soluzioni è $n = 27$:
|
||||
|
||||
$$34^2 − 27^2 − 20^2 = 12^2 − 9^2 − 6^2 = 27$$
|
||||
|
||||
It turns out that $n = 1155$ is the least value which has exactly ten solutions.
|
||||
Si scopre che $n = 1155$ è il valore minimo che ha esattamente dieci soluzioni.
|
||||
|
||||
How many values of $n$ less than one million have exactly ten distinct solutions?
|
||||
Quanti valori di $n$ minori di un milione hanno esattamente dieci soluzioni distinte?
|
||||
|
||||
# --hints--
|
||||
|
||||
`sameDifferences()` should return `4989`.
|
||||
`sameDifferences()` dovrebbe restituire `4989`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sameDifferences(), 4989);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f51000cf542c50ff07
|
||||
title: 'Problem 136: Singleton difference'
|
||||
title: 'Problema 136: differenza singola'
|
||||
challengeType: 1
|
||||
forumTopicId: 301764
|
||||
dashedName: problem-136-singleton-difference
|
||||
@@ -8,17 +8,17 @@ dashedName: problem-136-singleton-difference
|
||||
|
||||
# --description--
|
||||
|
||||
The positive integers, $x$, $y$, and $z$, are consecutive terms of an arithmetic progression. Given that $n$ is a positive integer, the equation, $x^2 − y^2 − z^2 = n$, has exactly one solution when $n = 20$:
|
||||
Gli interi positivi, $x$, $y$ e $z$, sono termini consecutivi di una progressione aritmetica. Dato che $n$ è un numero intero positivo, l'equazione, $x^2 − y^2 − z^2 = n$, ha esattamente una soluzione quando $n = 20$:
|
||||
|
||||
$$13^2 − 10^2 − 7^2 = 20$$
|
||||
|
||||
In fact, there are twenty-five values of $n$ below one hundred for which the equation has a unique solution.
|
||||
Infatti, ci sono venticinque valori di $n$ sotto il cento per i quali l'equazione ha una soluzione unica.
|
||||
|
||||
How many values of $n$ less than fifty million have exactly one solution?
|
||||
Quanti valori di $n$ minori di cinquanta milioni hanno esattamente una soluzione?
|
||||
|
||||
# --hints--
|
||||
|
||||
`singletonDifference()` should return `2544559`.
|
||||
`singletonDifference()` dovrebbe restituire `2544559`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(singletonDifference(), 2544559);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f51000cf542c50ff08
|
||||
title: 'Problem 137: Fibonacci golden nuggets'
|
||||
title: 'Problema 137: la pepita d''oro di Fibonacci'
|
||||
challengeType: 1
|
||||
forumTopicId: 301765
|
||||
dashedName: problem-137-fibonacci-golden-nuggets
|
||||
@@ -8,16 +8,16 @@ dashedName: problem-137-fibonacci-golden-nuggets
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the infinite polynomial series $A_{F}(x) = xF_1 + x^2F_2 + x^3F_3 + \ldots$, where $F_k$ is the $k$th term in the Fibonacci sequence: $1, 1, 2, 3, 5, 8, \ldots$; that is, $F_k = F_{k − 1} + F_{k − 2}, F_1 = 1$ and $F_2 = 1$.
|
||||
Considera la serie polinomiale infinita $A_{F}(x) = xF_1 + x^2F_2 + x^3F_3 + \ldots$, dove $F_k$ è il termine $k$-esimo nella sequenza di Fibonacci: $1, 1, 2, 3, 5, 8, \ldots$; cioè $F_k = F_{k − 1} + F_{k − 2}, F_1 = 1$ e $F_2 = 1$.
|
||||
|
||||
For this problem we shall be interested in values of $x$ for which $A_{F}(x)$ is a positive integer.
|
||||
Per questo problema consideriamo i valori di $x$ per cui $A_{F}(x)$ è un numero intero positivo.
|
||||
|
||||
Surprisingly
|
||||
Sorprendentemente
|
||||
|
||||
$$\begin{align} A_F(\frac{1}{2}) & = (\frac{1}{2}) × 1 + {(\frac{1}{2})}^2 × 1 + {(\frac{1}{2})}^3 × 2 + {(\frac{1}{2})}^4 × 3 + {(\frac{1}{2})}^5 × 5 + \cdots \\\\
|
||||
& = \frac{1}{2} + \frac{1}{4} + \frac{2}{8} + \frac{3}{16} + \frac{5}{32} + \cdots \\\\ & = 2 \end{align}$$
|
||||
|
||||
The corresponding values of $x$ for the first five natural numbers are shown below.
|
||||
I valori corrispondenti di $x$ per i primi cinque numeri naturali sono mostrati di seguito.
|
||||
|
||||
| $x$ | $A_F(x)$ |
|
||||
| --------------------------- | -------- |
|
||||
@@ -27,13 +27,13 @@ The corresponding values of $x$ for the first five natural numbers are shown bel
|
||||
| $\frac{\sqrt{89} − 5}{8}$ | $4$ |
|
||||
| $\frac{\sqrt{34} − 3}{5}$ | $5$ |
|
||||
|
||||
We shall call $A_F(x)$ a golden nugget if $x$ is rational, because they become increasingly rarer; for example, the 10th golden nugget is 74049690.
|
||||
Chiamiamo $A_F(x)$ pepita d'oro se $x$ è razionale, perché diventano sempre più rari; per esempio, la decima pepita d'oro è 74049690.
|
||||
|
||||
Find the 15th golden nugget.
|
||||
Trova la quindicesima pepita d'oro.
|
||||
|
||||
# --hints--
|
||||
|
||||
`goldenNugget()` should return `1120149658760`.
|
||||
`goldenNugget()` dovrebbe restituire `1120149658760`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(goldenNugget(), 1120149658760);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f61000cf542c50ff09
|
||||
title: 'Problem 138: Special isosceles triangles'
|
||||
title: 'Problema 138: triangoli isosceli speciali'
|
||||
challengeType: 1
|
||||
forumTopicId: 301766
|
||||
dashedName: problem-138-special-isosceles-triangles
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-138-special-isosceles-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the isosceles triangle with base length, $b = 16$, and legs, $L = 17$.
|
||||
Considera il triangolo isoscele con lunghezza di base $b = 16$, e lati $L = 17$.
|
||||
|
||||
<img class="img-responsive center-block" alt="isosceles triangle with edges named as L - two edges with the same length and base of the triangle as b; and height of the triangle - h from the base of the triangle to the angle between L edges" src="https://cdn.freecodecamp.org/curriculum/project-euler/special-isosceles-triangles.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="Un triangolo isoscele con lati denominati L - due lati con la stessa lunghezza e base del triangolo b; e altezza del triangolo - h dalla base del triangolo al vertice tra i lati L" src="https://cdn.freecodecamp.org/curriculum/project-euler/special-isosceles-triangles.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
By using the Pythagorean theorem, it can be seen that the height of the triangle, $h = \sqrt{{17}^2 − 8^2} = 15$, which is one less than the base length.
|
||||
Utilizzando il teorema di Pitagora, si può vedere che l'altezza del triangolo è $h = \sqrt{{17}^2 − 8^2} = 15$, che è di una lunghezza inferiore alla base.
|
||||
|
||||
With $b = 272$ and $L = 305$, we get $h = 273$, which is one more than the base length, and this is the second smallest isosceles triangle with the property that $h = b ± 1$.
|
||||
Con $b = 272$ e $L = 305$, otteniamo $h = 273$, che è uno in più della lunghezza di base, e questo è il secondo triangolo isoscele più piccolo con la proprietà che $h = b ± 1$.
|
||||
|
||||
Find $\sum{L}$ for the twelve smallest isosceles triangles for which $h = b ± 1$ and $b$, $L$ are positive integers.
|
||||
Trova $\sum{L}$ per i dodici triangoli isosceli più piccoli per i quali $h = b ± 1$ e $b$, $L$ sono interi positivi.
|
||||
|
||||
# --hints--
|
||||
|
||||
`isoscelesTriangles()` should return `1118049290473932`.
|
||||
`isoscelesTriangles()` dovrebbe restituire `1118049290473932`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(isoscelesTriangles(), 1118049290473932);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f71000cf542c50ff0a
|
||||
title: 'Problem 139: Pythagorean tiles'
|
||||
title: 'Problema 139: mattonelle pitagoriche'
|
||||
challengeType: 1
|
||||
forumTopicId: 301767
|
||||
dashedName: problem-139-pythagorean-tiles
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-139-pythagorean-tiles
|
||||
|
||||
# --description--
|
||||
|
||||
Let (a, b, c) represent the three sides of a right angle triangle with integral length sides. It is possible to place four such triangles together to form a square with length c.
|
||||
Siano (a, b, c) i tre lati di un triangolo rettangolo con lunghezze dei lati intere. È possibile unire quattro di questi triangoli insieme a formare un quadrato con lunghezza c.
|
||||
|
||||
For example, (3, 4, 5) triangles can be placed together to form a 5 by 5 square with a 1 by 1 hole in the middle and it can be seen that the 5 by 5 square can be tiled with twenty-five 1 by 1 squares.
|
||||
Per esempio, triangoli (3, 4, 5) possono essere messi assieme per formare un quadrato 5 x 5 con un buco 1 per 1 nel centro e si può vedere che il quadrato 5 x 5 può essere riempito con venticinque quadrati 1 x 1.
|
||||
|
||||
<img class="img-responsive center-block" alt="two 5 x 5 squares: one with four 3x4x5 triangles placed to create 1x1 hole in the middle; second with twenty-five 1x1 squares" src="https://cdn.freecodecamp.org/curriculum/project-euler/pythagorean-tiles.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="due quadrati 5 x 5: uno con quattro triangoli 3x4x5 posizionati per creare un buco 1x1 al centro; un secondo con venticinque quadrati 1x1" src="https://cdn.freecodecamp.org/curriculum/project-euler/pythagorean-tiles.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
However, if (5, 12, 13) triangles were used, the hole would measure 7 by 7. These 7 by 7 squares could not be used to tile the 13 by 13 square.
|
||||
Invece, usando triangoli (5, 12, 16) il buco al centro misura 7 x 7. Questi quadrati 7 x 7 non potrebbero essere usati per riempire il quadrato 13 x 13.
|
||||
|
||||
Given that the perimeter of the right triangle is less than one-hundred million, how many Pythagorean triangles would allow such a tiling to occur?
|
||||
Sia il perimetro del triangolo rettangolo inferiore a cento milioni, quanti triangoli pitagorici permettono il rivestimento esatto con una mattonella della dimensione del buco centrale?
|
||||
|
||||
# --hints--
|
||||
|
||||
`pythagoreanTiles()` should return `10057761`.
|
||||
`pythagoreanTiles()` dovrebbe restituire `10057761`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pythagoreanTiles(), 10057761);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fa1000cf542c50ff0c
|
||||
title: 'Problem 140: Modified Fibonacci golden nuggets'
|
||||
title: 'Problema 140: pepite d''oro di Fibonacci modificato'
|
||||
challengeType: 1
|
||||
forumTopicId: 301769
|
||||
dashedName: problem-140-modified-fibonacci-golden-nuggets
|
||||
@@ -8,11 +8,11 @@ dashedName: problem-140-modified-fibonacci-golden-nuggets
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the infinite polynomial series $A_G(x) = xG_1 + x^2G_2 + x^3G_3 + \cdots$, where $G_k$ is the $k$th term of the second order recurrence relation $G_k = G_{k − 1} + G_{k − 2}, G_1 = 1$ and $G_2 = 4$; that is, $1, 4, 5, 9, 14, 23, \ldots$.
|
||||
Considera la serie polinomiale infinita $A_G(x) = xG_1 + x^2G_2 + x^3G_3 + \cdots$, dove $G_k$ è il $k$-esimo termine della relazione di ricorrenza del secondo ordine $G_k = G_{k − 1} + G_{k − 2}, G_1 = 1$ e $G_2 = 4$; cioè, $1, 4, 5, 9, 14, 23, \ldots$.
|
||||
|
||||
For this problem we shall be concerned with values of $x$ for which $A_G(x)$ is a positive integer.
|
||||
Per questo problema ci occuperemo dei valori di $x$ per i quali $A_G(x)$ è un numero intero positivo.
|
||||
|
||||
The corresponding values of $x$ for the first five natural numbers are shown below.
|
||||
I valori corrispondenti di $x$ per i primi cinque numeri naturali sono mostrati di seguito.
|
||||
|
||||
| $x$ | $A_G(x)$ |
|
||||
| ----------------------------- | -------- |
|
||||
@@ -22,11 +22,11 @@ The corresponding values of $x$ for the first five natural numbers are shown bel
|
||||
| $\frac{\sqrt{137} − 5}{14}$ | $4$ |
|
||||
| $\frac{1}{2}$ | $5$ |
|
||||
|
||||
We shall call $A_G(x)$ a golden nugget if $x$ is rational because they become increasingly rarer; for example, the 20th golden nugget is 211345365. Find the sum of the first thirty golden nuggets.
|
||||
Chiamiamo $A_G(x)$ una pepita d'oro se $x$ è razionale, perché diventano sempre più rari; per esempio, la ventesima pepita d'oro è 211345365. Trova la somma delle prime trenta pepite d'oro.
|
||||
|
||||
# --hints--
|
||||
|
||||
`modifiedGoldenNuggets()` should return `5673835352990`
|
||||
`modifiedGoldenNuggets()` dovrebbe restituire `5673835352990`
|
||||
|
||||
```js
|
||||
assert.strictEqual(modifiedGoldenNuggets(), 5673835352990);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f91000cf542c50ff0b
|
||||
title: 'Problem 141: Investigating progressive numbers, n, which are also square'
|
||||
title: 'Problema 141: esaminando i numeri progressivi, n, che sono anche quadrati'
|
||||
challengeType: 1
|
||||
forumTopicId: 301770
|
||||
dashedName: problem-141-investigating-progressive-numbers-n-which-are-also-square
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-141-investigating-progressive-numbers-n-which-are-also-squar
|
||||
|
||||
# --description--
|
||||
|
||||
A positive integer, $n$, is divided by $d$ and the quotient and remainder are $q$ and $r$ respectively. In addition $d$, $q$, and $r$ are consecutive positive integer terms in a geometric sequence, but not necessarily in that order.
|
||||
Un intero positivo $n$, è diviso da $d$ e il quoziente e il resto sono rispettivamente $q$ ed $r$. Inoltre $d$, $q$ e $r$ sono numeri interi positivi consecutivi in una sequenza geometrica, ma non necessariamente in quest'ordine.
|
||||
|
||||
For example, 58 divided by 6 has a quotient of 9 and a remainder of 4. It can also be seen that 4, 6, 9 are consecutive terms in a geometric sequence (common ratio $\frac{3}{2}$).
|
||||
Ad esempio, 58 diviso 6 ha un quoziente di 9 e un resto di 4. Si può anche vedere che 4, 6, 9 sono termini consecutivi in una sequenza geometrica (rapporto comune $\frac{3}{2}$).
|
||||
|
||||
We will call such numbers, $n$, progressive.
|
||||
Chiameremo tali numeri $n$, progressivi.
|
||||
|
||||
Some progressive numbers, such as 9 and 10404 = ${102}^2$, also happen to be perfect squares. The sum of all progressive perfect squares below one hundred thousand is 124657.
|
||||
Alcuni numeri progressivi, come 9 e 10404 = ${102}^2$, sono anche quadrati perfetti. La somma di tutti i quadrati perfetti progressivi sotto centomila è 124657.
|
||||
|
||||
Find the sum of all progressive perfect squares below one trillion (${10}^{12}$).
|
||||
Trova la somma di tutti i quadrati perfetti progressivi sotto un bilione (${10}^{12}$).
|
||||
|
||||
# --hints--
|
||||
|
||||
`progressivePerfectSquares()` should return `878454337159`.
|
||||
`progressivePerfectSquares()` dovrebbe restituire `878454337159`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(progressivePerfectSquares(), 878454337159);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fa1000cf542c50ff0d
|
||||
title: 'Problem 142: Perfect Square Collection'
|
||||
title: 'Problema 142: collezione di quadrati perfetti'
|
||||
challengeType: 1
|
||||
forumTopicId: 301771
|
||||
dashedName: problem-142-perfect-square-collection
|
||||
@@ -8,11 +8,11 @@ dashedName: problem-142-perfect-square-collection
|
||||
|
||||
# --description--
|
||||
|
||||
Find the smallest $x + y + z$ with integers $x > y > z > 0$ such that $x + y$, $x − y$, $x + z$, $x − z$, $y + z$, $y − z$ are all perfect squares.
|
||||
Trova il più piccolo $x + y + z$ con interi $x > y > z > 0$ in modo che $x + y$, $x − y$, $x + z$, $x − z$, $y + z$, $y − z$ siano tutti quadrati perfetti.
|
||||
|
||||
# --hints--
|
||||
|
||||
`perfectSquareCollection()` should return `1006193`.
|
||||
`perfectSquareCollection()` dovrebbe restituire `1006193`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(perfectSquareCollection(), 1006193);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fc1000cf542c50ff0e
|
||||
title: 'Problem 143: Investigating the Torricelli point of a triangle'
|
||||
title: 'Problema 143: analizzando il punto Torricelli di un triangolo'
|
||||
challengeType: 1
|
||||
forumTopicId: 301772
|
||||
dashedName: problem-143-investigating-the-torricelli-point-of-a-triangle
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-143-investigating-the-torricelli-point-of-a-triangle
|
||||
|
||||
# --description--
|
||||
|
||||
Let ABC be a triangle with all interior angles being less than 120 degrees. Let X be any point inside the triangle and let $XA = p$, $XC = q$, and $XB = r$.
|
||||
Sia ABC un triangolo con tutti gli angoli interni inferiori a 120 gradi. Sia X qualsiasi punto dentro il triangolo e siano $XA = p$, $XC = q$, w $XB = r$.
|
||||
|
||||
Fermat challenged Torricelli to find the position of X such that p + q + r was minimised.
|
||||
Fermat sfidò Torricelli a trovare la posizione di X per cui p + q + r è minimizzata.
|
||||
|
||||
Torricelli was able to prove that if equilateral triangles AOB, BNC and AMC are constructed on each side of triangle ABC, the circumscribed circles of AOB, BNC, and AMC will intersect at a single point, T, inside the triangle. Moreover he proved that T, called the Torricelli/Fermat point, minimises $p + q + r$. Even more remarkable, it can be shown that when the sum is minimised, $AN = BM = CO = p + q + r$ and that AN, BM and CO also intersect at T.
|
||||
Torricelli fu in grado di provare che se i triangoli equilateri AOB, BNC e AMC sono costruiti su ogni lato del triangolo ABC, i cerchi circoscritti AOB, BNC e AMC si intersecano in un singolo punto, T, dentro il triangolo. In più ha provato che T, chiamato il punto Torricelli/Fermat, minimizza $p + q + r$. Ancora più notevole, si può provare che quando la somma è minimizzata, $AN = BM = CM = p + q + r$ e quindi anche AN, BM e CO si intersecano in T.
|
||||
|
||||
<img class="img-responsive center-block" alt="equilateral triangles AOB, BNC and AMC constructed on each side of triangle ABC; with the circumscribed circles of AOB, BNC, and AMC will intersecting at a single point, T, inside the triangle" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-the-torricelli-point-of-a-triangle.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="triangoli equilateri AOB, BNC e AMC costruiti su ogni lato del triangolo ABC; con i cerchi circoscritti a AOB, BNC e AMC intersecantisi in un singolo punto T, dentro il triangolo" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-the-torricelli-point-of-a-triangle.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
If the sum is minimised and a, b, c, p, q and r are all positive integers we shall call triangle ABC a Torricelli triangle. For example, $a = 399$, $b = 455$, $c = 511$ is an example of a Torricelli triangle, with $p + q + r = 784$. Find the sum of all distinct values of $p + q + r ≤ 120000$ for Torricelli triangles.
|
||||
Se la somma è minimizzata e a, b, c, p, q e r sono tutti numeri interi positivi, chiamiamo il triangolo ABC triangolo di Torricelli. Per esempio, $a = 399$, $b = 455$, $c = 511$ è un esempio di un Triangolo di Torricelli, con $p + q + r = 784$. Trova la somma di tutti i distinti valori di $p + q + r ≤ 120000$ per i triangoli di Torricelli.
|
||||
|
||||
# --hints--
|
||||
|
||||
`sumTorricelliTriangles()` should return `30758397`.
|
||||
`sumTorricelliTriangles()` dovrebbe restituire `30758397`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sumTorricelliTriangles(), 30758397);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fc1000cf542c50ff0f
|
||||
title: 'Problem 144: Investigating multiple reflections of a laser beam'
|
||||
title: 'Problema 144: analizzando molteplici riflessi di un fascio laser'
|
||||
challengeType: 1
|
||||
forumTopicId: 301773
|
||||
dashedName: problem-144-investigating-multiple-reflections-of-a-laser-beam
|
||||
@@ -8,34 +8,34 @@ dashedName: problem-144-investigating-multiple-reflections-of-a-laser-beam
|
||||
|
||||
# --description--
|
||||
|
||||
In laser physics, a "white cell" is a mirror system that acts as a delay line for the laser beam. The beam enters the cell, bounces around on the mirrors, and eventually works its way back out.
|
||||
Nella fisica dei laser, una "cella bianca" è un sistema a specchio che funge da linea di ritardo per il raggio laser. Il raggio entra nella cella, rimbalza sugli specchi e, alla fine, trova la sua via di uscita.
|
||||
|
||||
The specific white cell we will be considering is an ellipse with the equation $4{x}^2 + y^2 = 100$
|
||||
La specifica cella bianca che prenderemo in considerazione è un'ellisse con l'equazione $4{x}^2 + y^2 = 100$
|
||||
|
||||
The section corresponding to $−0.01 ≤ x ≤ +0.01$ at the top is missing, allowing the light to enter and exit through the hole.
|
||||
Manca la sezione corrispondente a $−0.01 ≤ x ≤ +0.01$ in alto, che permette alla luce di entrare e uscire attraverso il foro.
|
||||
|
||||
<div style="text-align: center">
|
||||
<img class="img-responsive center-block" alt="light beam starting at point (0.0, 10.1), and impacting the mirror at point (1.4, -9.6)" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-multiple-reflections-of-a-laser-beam-1.png" style="display: inline-block; background-color: white; padding: 10px;">
|
||||
<img class="img-responsive center-block" alt="animation with first 10 reflections of the beam" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-multiple-reflections-of-a-laser-beam-2.gif" style="display: inline-block; background-color: white; padding: 10px;">
|
||||
<img class="img-responsive center-block" alt="fascio luminoso che parte dal punto (0.0, 10.1) e che attraversa lo specchio al punto (1.4, -9.6)" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-multiple-reflections-of-a-laser-beam-1.png" style="display: inline-block; background-color: white; padding: 10px;">
|
||||
<img class="img-responsive center-block" alt="animazione con le prime 10 riflessioni del fascio" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-multiple-reflections-of-a-laser-beam-2.gif" style="display: inline-block; background-color: white; padding: 10px;">
|
||||
</div><br>
|
||||
|
||||
The light beam in this problem starts at the point (0.0, 10.1) just outside the white cell, and the beam first impacts the mirror at (1.4, -9.6).
|
||||
Il fascio luminoso in questo problema inizia dal punto (0.0, 10.1) appena fuori dalla cella bianca e incontra per la prima volta lo specchio a (1.4, -9.6).
|
||||
|
||||
Each time the laser beam hits the surface of the ellipse, it follows the usual law of reflection "angle of incidence equals angle of reflection." That is, both the incident and reflected beams make the same angle with the normal line at the point of incidence.
|
||||
Ogni volta che il raggio laser colpisce la superficie dell'ellisse, segue la consueta legge di riflessione "l'angolo di incidenza è uguale all'angolo di riflessione". Cioè, sia i fasci incidenti che quelli riflessi formano lo stesso angolo con la linea normale nel punto di incidenza.
|
||||
|
||||
In the figure on the left, the red line shows the first two points of contact between the laser beam and the wall of the white cell; the blue line shows the line tangent to the ellipse at the point of incidence of the first bounce.
|
||||
Nella figura a sinistra, la linea rossa indica i primi due punti di contatto tra il fascio laser e la parete della cella bianca; la linea blu mostra la linea tangente all'ellisse nel punto di incidenza della prima riflessione.
|
||||
|
||||
The slope m of the tangent line at any point (x, y) of the given ellipse is: $m = −4 × \frac{x}{y}$
|
||||
La pendenza m della linea tangente in qualsiasi punto (x, y) della data ellisse è: $m = −4 × \frac{x}{y}$
|
||||
|
||||
The normal line is perpendicular to this tangent line at the point of incidence.
|
||||
La linea normale è perpendicolare a questa linea tangente nel punto di incidenza.
|
||||
|
||||
The animation on the right shows the first 10 reflections of the beam.
|
||||
L'animazione a destra mostra le prime 10 riflessioni del fascio.
|
||||
|
||||
How many times does the beam hit the internal surface of the white cell before exiting?
|
||||
Quante volte il raggio colpisce la superficie interna della cella bianca prima di uscire?
|
||||
|
||||
# --hints--
|
||||
|
||||
`laserBeamReflections()` should return `354`.
|
||||
`laserBeamReflections()` dovrebbe restituire `354`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(laserBeamReflections(), 354);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fd1000cf542c50ff10
|
||||
title: 'Problem 145: How many reversible numbers are there below one-billion?'
|
||||
title: 'Problema 145: quanti numeri reversibili ci sono sotto un miliardo?'
|
||||
challengeType: 1
|
||||
forumTopicId: 301774
|
||||
dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||
@@ -8,15 +8,15 @@ dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||
|
||||
# --description--
|
||||
|
||||
Some positive integers $n$ have the property that the sum [ $n + reverse(n)$ ] consists entirely of odd (decimal) digits. For instance, $36 + 63 = 99$ and $409 + 904 = 1313$. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either $n$ or $reverse(n)$.
|
||||
Alcuni numeri interi positivi $n$ hanno la proprietà che la somma [ $n + reverse(n)$ ] consiste interamente di cifre dispari (decimali). Per esempio, $36 + 63 = 99$ e $409 + 904 = 1313$. Chiameremo tali numeri reversibili; quindi 36, 63, 409 e 904 sono reversibili. Gli zero iniziali non sono ammessi in $n$ o $reverse(n)$.
|
||||
|
||||
There are 120 reversible numbers below one-thousand.
|
||||
Ci sono 120 numeri reversibili sotto il mille.
|
||||
|
||||
How many reversible numbers are there below one-billion (${10}^9$)?
|
||||
Quanti numeri reversibili ci sono sotto un miliardo (${10}^9$)?
|
||||
|
||||
# --hints--
|
||||
|
||||
`reversibleNumbers()` should return `608720`.
|
||||
`reversibleNumbers()` dovrebbe restituire `608720`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(reversibleNumbers(), 608720);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fe1000cf542c50ff11
|
||||
title: 'Problem 146: Investigating a Prime Pattern'
|
||||
title: 'Problema 146: analizzare un modello di numeri primi'
|
||||
challengeType: 1
|
||||
forumTopicId: 301775
|
||||
dashedName: problem-146-investigating-a-prime-pattern
|
||||
@@ -8,13 +8,13 @@ dashedName: problem-146-investigating-a-prime-pattern
|
||||
|
||||
# --description--
|
||||
|
||||
The smallest positive integer $n$ for which the numbers $n^2 + 1$, $n^2 + 3$, $n^2 + 7$, $n^2 + 9$, $n^2 + 13$, and $n^2 + 27$ are consecutive primes is 10. The sum of all such integers $n$ below one-million is 1242490.
|
||||
Il più piccolo intero positivo $n$ per il quale i numeri $n^2 + 1$, $n^2 + 3$, $n^2 + 7$, $n^2 + 9$, $n^2 + 13$, e $n^2 + 27$ sono primi consecutivi è 10. La somma di tutti questi numeri interi $n$ sotto un milione è 1242490.
|
||||
|
||||
What is the sum of all such integers $n$ below 150 million?
|
||||
Qual è la somma di tutti questi numeri interi $n$ sotto 150 milioni?
|
||||
|
||||
# --hints--
|
||||
|
||||
`primePattern()` should return `676333270`.
|
||||
`primePattern()` dovrebbe restituire `676333270`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(primePattern(), 676333270);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ff1000cf542c50ff12
|
||||
title: 'Problem 147: Rectangles in cross-hatched grids'
|
||||
title: 'Problema 147: rettangoli in griglie a tratteggi incrociati'
|
||||
challengeType: 1
|
||||
forumTopicId: 301776
|
||||
dashedName: problem-147-rectangles-in-cross-hatched-grids
|
||||
@@ -8,21 +8,21 @@ dashedName: problem-147-rectangles-in-cross-hatched-grids
|
||||
|
||||
# --description--
|
||||
|
||||
In a 3x2 cross-hatched grid, a total of 37 different rectangles could be situated within that grid as indicated in the sketch.
|
||||
In una griglia 3x2 a tratteggi incrociati, un totale di 37 rettangoli diversi potrebbe essere situato all'interno di tale griglia come indicato nel disegno.
|
||||
|
||||
<img class="img-responsive center-block" alt="ways of situating different rectangles within cross-hatched 3x2 grid" src="https://cdn.freecodecamp.org/curriculum/project-euler/rectangles-in-cross-hatched-grids.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="modi di posizionare diversi rettangoli all'interno di una griglia 3x2 a tratteggio incrociato" src="https://cdn.freecodecamp.org/curriculum/project-euler/rectangles-in-cross-hatched-grids.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important, i.e. 1x1, 2x1, 3x1, 1x2 and 2x2. If each of them is cross-hatched, the following number of different rectangles could be situated within those smaller grids:
|
||||
Ci sono 5 griglie più piccole di 3x2, le dimensioni verticali e orizzontali sono importanti, cioè 1x1, 2x1, 3x1, 1x2 e 2x2. Se ciascuno di essi è a tratteggio incrociato, il seguente numero di rettangoli diversi potrebbe essere situato all'interno di tali griglie più piccole:
|
||||
|
||||
$$\begin{array}{|c|c|} \hline 1 \times 1 & 1 \\\\ \hline 2 \times 1 & 4 \\\\ \hline 3 \times 1 & 8 \\\\ \hline 1 \times 2 & 4 \\\\ \hline 2 \times 2 & 18 \\\\ \hline \end{array}$$
|
||||
|
||||
Adding those to the 37 of the 3x2 grid, a total of 72 different rectangles could be situated within 3x2 and smaller grids.
|
||||
Aggiungendo questi ai 37 della griglia 3x2, un totale di 72 diversi rettangoli potrebbe essere situato all'interno della 3x2 e delle griglie più piccole.
|
||||
|
||||
How many different rectangles could be situated within 47x43 and smaller grids?
|
||||
Quanti rettangoli diversi potrebbero essere situati entro una griglia 47x43 e le griglie più piccole?
|
||||
|
||||
# --hints--
|
||||
|
||||
`crossHatchedRectangles()` should return `846910284`.
|
||||
`crossHatchedRectangles()` dovrebbe restituire `846910284`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(crossHatchedRectangles(), 846910284);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4021000cf542c50ff14
|
||||
title: 'Problem 148: Exploring Pascal''s triangle'
|
||||
title: 'Problema 148: esplorare il triangolo di Pascal'
|
||||
challengeType: 1
|
||||
forumTopicId: 301777
|
||||
dashedName: problem-148-exploring-pascals-triangle
|
||||
@@ -8,7 +8,7 @@ dashedName: problem-148-exploring-pascals-triangle
|
||||
|
||||
# --description--
|
||||
|
||||
We can easily verify that none of the entries in the first seven rows of Pascal's triangle are divisible by 7:
|
||||
Possiamo facilmente verificare che nessuna delle voci nelle prime sette righe del triangolo di Pascal è divisibile per 7:
|
||||
|
||||
```markup
|
||||
1
|
||||
@@ -20,15 +20,15 @@ We can easily verify that none of the entries in the first seven rows of Pascal'
|
||||
1 6 15 20 15 6 1
|
||||
```
|
||||
|
||||
However, if we check the first one hundred rows, we will find that only 2361 of the 5050 entries are not divisible by 7.
|
||||
Tuttavia, se controlliamo le prime cento righe, scopriremo che solo 2361 delle 5050 voci non sono divisibili per 7.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Find the number of entries which are not divisible by 7 in the first one billion (${10}^9$) rows of Pascal's triangle.
|
||||
Trova il numero di voci che non sono divisibili per 7 nel primo miliardo di righe (${10}^9$) del triangolo di Pascal.
|
||||
|
||||
# --hints--
|
||||
|
||||
`entriesOfPascalsTriangle()` should return `2129970655314432`.
|
||||
`entriesOfPascalsTriangle()` dovrebbe restituire `2129970655314432`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(entriesOfPascalsTriangle(), 2129970655314432);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4021000cf542c50ff13
|
||||
title: 'Problem 149: Searching for a maximum-sum subsequence'
|
||||
title: 'Problema 149: ricerca di una sotto-sequenza a somma massima'
|
||||
challengeType: 1
|
||||
forumTopicId: 301778
|
||||
dashedName: problem-149-searching-for-a-maximum-sum-subsequence
|
||||
@@ -8,27 +8,27 @@ dashedName: problem-149-searching-for-a-maximum-sum-subsequence
|
||||
|
||||
# --description--
|
||||
|
||||
Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is $16 (= 8 + 7 + 1)$.
|
||||
Guardando la tabella seguente, è facile verificare che la somma massima possibile di numeri adiacenti in qualsiasi direzione (orizzontale, verticale, diagonale o anti-diagonale) è di $16 (= 8 + 7 + 1)$.
|
||||
|
||||
$$\begin{array}{|r|r|r|r|} \hline −2 & 5 & 3 & 2 \\\\ \hline 9 & −6 & 5 & 1 \\\\ \hline 3 & 2 & 7 & 3 \\\\ \hline −1 & 8 & −4 & 8 \\\\ \hline \end{array}$$
|
||||
|
||||
Now, let us repeat the search, but on a much larger scale:
|
||||
Ora ripetiamo la ricerca, ma su una scala molto più grande:
|
||||
|
||||
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
|
||||
In primo luogo, generare quattro milioni di numeri pseudo-casuali utilizzando una forma specifica di quello che è noto come "Lagged Fibonacci Generator":
|
||||
|
||||
For $1 ≤ k ≤ 55$, $s_k = (100003 − 200003k + 300007{k}^3) \\ (modulo\\ 1000000) − 500000$.
|
||||
Per $1 ≤ k ≤ 55$, $s_k = (100003 − 200003k + 300007{k}^3) \\ (modulo\\ 1000000) − 500000$.
|
||||
|
||||
For $56 ≤ k ≤ 4000000$, $s_k = (s_{k − 24} + s_{k − 55} + 1000000) \\ (modulo\\ 1000000) − 500000$.
|
||||
Per $56 ≤ k ≤ 4000000$, $s_k = (s_{k − 24} + s_{k − 55} + 1000000) \\ (modulo\\ 1000000) − 500000$.
|
||||
|
||||
Thus, $s_{10} = −393027$ and $s_{100} = 86613$.
|
||||
Così, $s_{10} = −393027$ e $s_{100} = 86613$.
|
||||
|
||||
The terms of $s$ are then arranged in a 2000×2000 table, using the first 2000 numbers to fill the first row (sequentially), the next 2000 numbers to fill the second row, and so on.
|
||||
I termini di $s$ sono poi disposti in una tabella 2000×2000, usando i primi 2000 numeri per riempire la prima riga (sequenzialmente), i successivi 2000 numeri per riempire la seconda riga, e così via.
|
||||
|
||||
Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal).
|
||||
Infine, trova la più grande somma di (qualsiasi numero di) voci adiacenti in qualsiasi direzione (orizzontale, verticale, diagonale o anti-diagonale).
|
||||
|
||||
# --hints--
|
||||
|
||||
`maximumSubSequence()` should return `52852124`.
|
||||
`maximumSubSequence()` dovrebbe restituire `52852124`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(maximumSubSequence(), 52852124);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: 5900f4031000cf542c50ff15
|
||||
title: >-
|
||||
Problem 150: Searching a triangular array for a sub-triangle having minimum-sum
|
||||
Problema 150: ricerca di una matrice triangolare per un sotto-triangolo con somma minima
|
||||
challengeType: 1
|
||||
forumTopicId: 301781
|
||||
dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum
|
||||
@@ -9,13 +9,13 @@ dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-m
|
||||
|
||||
# --description--
|
||||
|
||||
In a triangular array of positive and negative integers, we wish to find a sub-triangle such that the sum of the numbers it contains is the smallest possible.
|
||||
In una serie triangolare di numeri interi positivi e negativi, desideriamo trovare un sotto-triangolo in modo che la somma dei numeri che contiene sia la più piccola possibile.
|
||||
|
||||
In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of −42.
|
||||
Nell'esempio sottostante si può facilmente verificare che il triangolo marcato soddisfa questa condizione con una somma di −42.
|
||||
|
||||
<img class="img-responsive center-block" alt="triangular array, with marked sub-triangle, having sum of -42" src="https://cdn.freecodecamp.org/curriculum/project-euler/searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="array triangolare, con sotto-triangolo marcato, avente una somma di -42" src="https://cdn.freecodecamp.org/curriculum/project-euler/searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers $s_k$ in the range $±2^{19}$, using a type of random number generator (known as a Linear Congruential Generator) as follows:
|
||||
Vogliamo creare una tale matrice triangolare con mille righe, in modo da generare 500500 numeri pseudo-casuali $s_k$ nel range $±2^{19}$, utilizzando un tipo di generatore di numeri casuali (noto come generatore di elementi costitutivi lineari) come segue:
|
||||
|
||||
$$\begin{align} t := & \\ 0\\\\
|
||||
\text{for}\\ & k = 1\\ \text{up to}\\ k = 500500:\\\\ & t := (615949 × t + 797807)\\ \text{modulo}\\ 2^{20}\\\\
|
||||
@@ -23,21 +23,21 @@ $$\begin{align} t := & \\ 0\\\\
|
||||
|
||||
Thus: $s_1 = 273519$, $s_2 = −153582$, $s_3 = 450905$ etc.
|
||||
|
||||
Our triangular array is then formed using the pseudo-random numbers thus:
|
||||
La nostra matrice triangolare è poi formata utilizzando i numeri pseudo-casuali in questo modo:
|
||||
|
||||
$$ s_1 \\\\
|
||||
s_2\\;s_3 \\\\ s_4\\; s_5\\; s_6 \\\\
|
||||
s_7\\; s_8\\; s_9\\; s_{10} \\\\ \ldots $$
|
||||
|
||||
Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on).
|
||||
I sotto-triangoli possono iniziare da qualsiasi elemento dell'array ed estendersi quanto vogliamo (prendendo i due elementi direttamente sotto di esso dalla riga successiva, i tre elementi direttamente al di sotto dalla riga successiva, e così via).
|
||||
|
||||
The "sum of a sub-triangle" is defined as the sum of all the elements it contains.
|
||||
La "somma di un sotto-triangolo" è definita come la somma di tutti gli elementi che contiene.
|
||||
|
||||
Find the smallest possible sub-triangle sum.
|
||||
Trova la somma subtriangolare più piccola possibile.
|
||||
|
||||
# --hints--
|
||||
|
||||
`smallestSubTriangleSum()` should return `-271248680`.
|
||||
`smallestSubTriangleSum()` dovrebbe restituire `-271248680`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(smallestSubTriangleSum(), -271248680);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4031000cf542c50ff16
|
||||
title: 'Problem 151: Paper sheets of standard sizes: an expected-value problem'
|
||||
title: 'Problema 151: fogli di carta di dimensioni standard: un problema di valore atteso'
|
||||
challengeType: 1
|
||||
forumTopicId: 301782
|
||||
dashedName: problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem
|
||||
@@ -8,25 +8,25 @@ dashedName: problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem
|
||||
|
||||
# --description--
|
||||
|
||||
A printing shop runs 16 batches (jobs) every week and each batch requires a sheet of special colour-proofing paper of size A5.
|
||||
Una tipografia esegue 16 lotti (lavori) ogni settimana e ogni lotto richiede un foglio di carta speciale per la prova del colore di dimensione A5.
|
||||
|
||||
Every Monday morning, the foreman opens a new envelope, containing a large sheet of the special paper with size A1.
|
||||
Ogni lunedì mattina, il caposquadra apre una nuova busta, contenente un grande foglio di carta speciale di formato A1.
|
||||
|
||||
He proceeds to cut it in half, thus getting two sheets of size A2. Then he cuts one of them in half to get two sheets of size A3 and so on until he obtains the A5-size sheet needed for the first batch of the week.
|
||||
Prosegue tagliandolo a metà, ottenendo così due fogli di formato A2. Poi taglia uno di loro a metà per ottenere due fogli di formato A3 e così via fino a quando ottiene il foglio di formato A5 necessario per il primo lotto della settimana.
|
||||
|
||||
All the unused sheets are placed back in the envelope.
|
||||
Tutti i fogli inutilizzati sono riposizionati nella busta.
|
||||
|
||||
<img class="img-responsive center-block" alt="A1-size sheet split into: A2, A3, A4 and two A5 sheets" src="https://cdn.freecodecamp.org/curriculum/project-euler/paper-sheets-of-standard-sizes-an-expected-value-problem.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="Foglio formato A1 diviso in: A2, A3, A4 e due fogli A5" src="https://cdn.freecodecamp.org/curriculum/project-euler/paper-sheets-of-standard-sizes-an-expected-value-problem.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
At the beginning of each subsequent batch, he takes one sheet of paper from the envelope at random. If it is of size A5, he uses it. If it is larger, he repeats the 'cut-in-half' procedure until he has what he needs, and any remaining sheets are always placed back in the envelope.
|
||||
All'inizio di ogni lotto successivo, prende un foglio di carta dalla busta a caso. Se è di dimensioni A5, lo usa. Se è più grande, ripete la procedura "taglia a metà" fino a quando non ha quello di cui ha bisogno, e tutti i fogli rimanenti sono sempre riposti nella busta.
|
||||
|
||||
Excluding the first and last batch of the week, find the expected number of times (during each week) that the foreman finds a single sheet of paper in the envelope.
|
||||
Escluso il primo e l’ultimo lotto della settimana, trova il numero previsto di volte (nel corso di ogni settimana) in cui il caposquadra trova un unico foglio di carta nella busta.
|
||||
|
||||
Give your answer rounded to six decimal places using the format `x.xxxxxx`.
|
||||
Dai la risposta arrotondata a sei decimali utilizzando il formato `x.xxxxxx`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`expectedValueProblem()` should return `0.464399`.
|
||||
`expectedValueProblem()` dovrebbe restituire `0.464399`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(expectedValueProblem(), 0.464399);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4041000cf542c50ff17
|
||||
title: 'Problem 152: Writing one half as a sum of inverse squares'
|
||||
title: 'Problema 152: scrivere di un mezzo come somma di quadrati inversi'
|
||||
challengeType: 1
|
||||
forumTopicId: 301783
|
||||
dashedName: problem-152-writing-one-half-as-a-sum-of-inverse-squares
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-152-writing-one-half-as-a-sum-of-inverse-squares
|
||||
|
||||
# --description--
|
||||
|
||||
There are several ways to write the number $\frac{1}{2}$ as a sum of inverse squares using distinct integers.
|
||||
Ci sono diversi modi per scrivere il numero $\frac{1}{2}$ come somma di quadrati inversi utilizzando numeri interi distinti.
|
||||
|
||||
For instance, the numbers {2,3,4,5,7,12,15,20,28,35} can be used:
|
||||
Per esempio, possono essere utilizzati i numeri {2,3,4,5,7,12,15,20,28,35}:
|
||||
|
||||
$$\frac{1}{2} = \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \frac{1}{5^2} + \frac{1}{7^2} + \frac{1}{{12}^2} + \frac{1}{{15}^2} + \frac{1}{{20}^2} + \frac{1}{{28}^2} + \frac{1}{{35}^2}$$
|
||||
|
||||
In fact, only using integers between 2 and 45 inclusive, there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45} and {2,3,4,6,7,9,12,15,28,30,35,36,45}.
|
||||
Infatti, utilizzando solo interi compresi tra 2 e 45 inclusi, ci sono esattamente tre modi per farlo, e i restanti due sono: {2,3,4,6,7,9,10,20,28,35,36,45} e {2,3,4,6,7,9,12,15,28,30,35,36,45}.
|
||||
|
||||
How many ways are there to write the number $\frac{1}{2}$ as a sum of inverse squares using distinct integers between 2 and 80 inclusive?
|
||||
Quanti modi ci sono per scrivere il numero $\frac{1}{2}$ come somma di quadrati inversi utilizzando numeri interi distinti tra 2 e 80 inclusi?
|
||||
|
||||
# --hints--
|
||||
|
||||
`sumInverseSquares()` should return `301`.
|
||||
`sumInverseSquares()` dovrebbe restituire `301`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sumInverseSquares(), 301);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4051000cf542c50ff18
|
||||
title: 'Problem 153: Investigating Gaussian Integers'
|
||||
title: 'Problema 153: analizzare gli interi Gaussiani'
|
||||
challengeType: 1
|
||||
forumTopicId: 301784
|
||||
dashedName: problem-153-investigating-gaussian-integers
|
||||
@@ -8,57 +8,57 @@ dashedName: problem-153-investigating-gaussian-integers
|
||||
|
||||
# --description--
|
||||
|
||||
As we all know the equation $x^2 = -1$ has no solutions for real $x$.
|
||||
Come tutti sappiamo l'equazione $x^2 = -1$ non ha soluzioni per $x$ reale.
|
||||
|
||||
If we however introduce the imaginary number $i$ this equation has two solutions: $x = i$ and $x = -i$.
|
||||
Se però introduciamo il numero immaginario $i$ questa equazione ha due soluzioni: $x = i$ e $x = -i$.
|
||||
|
||||
If we go a step further the equation ${(x - 3)}^2 = -4$ has two complex solutions: $x = 3 + 2i$ and $x = 3 - 2i$, which are called each others' complex conjugate.
|
||||
Se andiamo oltre, l'equazione ${(x - 3)}^2 = -4$ ha due soluzioni complesse: $x = 3 + 2i$ e $x = 3 - 2i$, che sono chiamati l'uno il complesso coniugato dell'altro.
|
||||
|
||||
Numbers of the form $a + bi$ are called complex numbers.
|
||||
I numeri del tipo $a + bi$ sono chiamati numeri complessi.
|
||||
|
||||
In general $a + bi$ and $a − bi$ are each other's complex conjugate. A Gaussian Integer is a complex number $a + bi$ such that both $a$ and $b$ are integers.
|
||||
In generale $a + bi$ e $a − bi$ sono l'uno il complesso coniugato dell'altro. Un intero Gaussiano è un numero complesso $a + bi$ tale che sia $a$ che $b$ sono interi.
|
||||
|
||||
The regular integers are also Gaussian integers (with $b = 0$).
|
||||
Gli interi regolari sono anche interi gaussiani (con $b = 0$).
|
||||
|
||||
To distinguish them from Gaussian integers with $b ≠ 0$ we call such integers "rational integers."
|
||||
Per distinguerli dagli interi gaussiani con $b ≠ 0$ chiamiamo tali interi "razionali"
|
||||
|
||||
A Gaussian integer is called a divisor of a rational integer $n$ if the result is also a Gaussian integer.
|
||||
Un intero gaussiano è detto divisore di un intero razionale $n$ se il risultato è anche un intero gaussiano.
|
||||
|
||||
If for example we divide 5 by $1 + 2i$ we can simplify in the following manner:
|
||||
Se, ad esempio, dividiamo 5 per $1 + 2i$ possiamo semplificare nel modo seguente:
|
||||
|
||||
Multiply numerator and denominator by the complex conjugate of $1 + 2i$: $1 − 2i$.
|
||||
Moltiplicare numeratore e denominatore per il complesso coniugato di $1 + 2i$: $1 − 2i$.
|
||||
|
||||
The result is:
|
||||
Il risultato è:
|
||||
|
||||
$$\frac{5}{1 + 2i} = \frac{5}{1 + 2i} \frac{1 - 2i}{1 - 2i} = \frac{5(1 - 2i)}{1 - {(2i)}^2} = \frac{5(1 - 2i)}{1 - (-4)} = \frac{5(1 - 2i)}{5} = 1 - 2i$$
|
||||
|
||||
So $1 + 2i$ is a divisor of 5.
|
||||
Così $1 + 2i$ è un divisore di 5.
|
||||
|
||||
Note that $1 + i$ is not a divisor of 5 because:
|
||||
Si noti che $1 + i$ non è un divisore di 5 perché:
|
||||
|
||||
$$\frac{5}{1 + i} = \frac{5}{2} - \frac{5}{2}i$$
|
||||
|
||||
Note also that if the Gaussian Integer ($a + bi$) is a divisor of a rational integer $n$, then its complex conjugate ($a − bi$) is also a divisor of $n$. In fact, 5 has six divisors such that the real part is positive: {1, 1 + 2i, 1 − 2i, 2 + i, 2 − i, 5}.
|
||||
Nota anche che se l'intero gaussiano ($a + bi$) è un divisore di un intero razionale $n$, allora il suo complesso coniugato ($a − bi$) è anch'esso un divisore di $n$. Infatti, 5 ha sei divisori la cui parte reale è positiva: {1, 1 + 2i, 1 - 2i, 2 + i, 2 - i, 5}.
|
||||
|
||||
The following is a table of all of the divisors for the first five positive rational integers:
|
||||
La seguente è una tabella di tutti i divisori per i primi cinque interi razionali positivi:
|
||||
|
||||
| n | Gaussian integer divisors with positive real part | Sum s(n) of these divisors |
|
||||
| - | ------------------------------------------------- | -------------------------- |
|
||||
| 1 | 1 | 1 |
|
||||
| 2 | 1, 1 + i, 1 - i, 2 | 5 |
|
||||
| 3 | 1, 3 | 4 |
|
||||
| 4 | 1, 1 + i, 1 - i, 2, 2 + 2i, 2 - 2i, 4 | 13 |
|
||||
| 5 | 1, 1 + 2i, 1 - 2i, 2 + i, 2 - i, 5 | 12 |
|
||||
| n | Divisori interi gaussiani con parte reale positiva | Somma s(n) di questi divisori |
|
||||
| - | -------------------------------------------------- | ----------------------------- |
|
||||
| 1 | 1 | 1 |
|
||||
| 2 | 1, 1 + i, 1 - i, 2 | 5 |
|
||||
| 3 | 1, 3 | 4 |
|
||||
| 4 | 1, 1 + i, 1 - i, 2, 2 + 2i, 2 - 2i, 4 | 13 |
|
||||
| 5 | 1, 1 + 2i, 1 - 2i, 2 + i, 2 - i, 5 | 12 |
|
||||
|
||||
For divisors with positive real parts, then, we have: $\displaystyle\sum_{n=1}^5 s(n) = 35$.
|
||||
Per i divisori con parti reali positive, poi, abbiamo: $\displaystyle\sum_{n=1}^5 s(n) = 35$.
|
||||
|
||||
For $1 ≤ n ≤ {10}^5$, $\displaystyle\sum_{n = 1}^{{10}^5} s(n) = 17924657155$.
|
||||
Per $1 ≤ n ≤ {10}^5$, $\displaystyle\sum_{n = 1}^{{10}^5} s(n) = 17924657155$.
|
||||
|
||||
What is $\displaystyle\sum_{n=1}^{{10}^8} s(n)$?
|
||||
Quanto vale $\displaystyle\sum_{n=1}^{{10}^8} s(n)$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`sumGaussianIntegers()` should return `17971254122360636`.
|
||||
`sumGaussianIntegers()` dovrebbe restituire `17971254122360636`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(sumGaussianIntegers(), 17971254122360636);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4071000cf542c50ff19
|
||||
title: 'Problem 154: Exploring Pascal''s pyramid'
|
||||
title: 'Problema 154: esplorare la piramide di Pascal'
|
||||
challengeType: 1
|
||||
forumTopicId: 301785
|
||||
dashedName: problem-154-exploring-pascals-pyramid
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-154-exploring-pascals-pyramid
|
||||
|
||||
# --description--
|
||||
|
||||
A triangular pyramid is constructed using spherical balls so that each ball rests on exactly three balls of the next lower level.
|
||||
Una piramide triangolare è costruita utilizzando palline sferiche in modo che ogni sfera poggi esattamente su tre palline del livello inferiore.
|
||||
|
||||
<img class="img-responsive center-block" alt="triangular pyramid constructed using spherical balls with four levels" src="https://cdn.freecodecamp.org/curriculum/project-euler/exploring-pascals-pyramid.png" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="piramide triangolare costruita con palline sferiche a quattro livelli" src="https://cdn.freecodecamp.org/curriculum/project-euler/exploring-pascals-pyramid.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Then, we calculate the number of paths leading from the apex to each position: A path starts at the apex and progresses downwards to any of the three spheres directly below the current position. Consequently, the number of paths to reach a certain position is the sum of the numbers immediately above it (depending on the position, there are up to three numbers above it).
|
||||
Poi calcoliamo il numero di percorsi che conducono dall'apice a ogni posizione: un percorso inizia all'apice e procede verso il basso in una qualsiasi delle tre sfere direttamente al di sotto della posizione attuale. Di conseguenza, il numero di percorsi per raggiungere una certa posizione è la somma dei numeri immediatamente sopra di essa (a seconda della posizione, ci sono fino a tre numeri sopra di essa).
|
||||
|
||||
The result is Pascal's pyramid and the numbers at each level n are the coefficients of the trinomial expansion ${(x + y + z)}^n$.
|
||||
Il risultato è la piramide di Pascal, e i numeri a ogni livello n sono i coefficienti dell'espansione trinomiale ${(x + y + z)}^n$.
|
||||
|
||||
How many coefficients in the expansion of ${(x + y + z)}^{200000}$ are multiples of ${10}^{12}$?
|
||||
Quanti coefficienti nell'espansione di ${(x + y + z)}^{200000}$ sono multipli di ${10}^{12}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`pascalsPyramid()` should return `479742450`.
|
||||
`pascalsPyramid()` dovrebbe restituire `479742450`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(pascalsPyramid(), 479742450);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4081000cf542c50ff1a
|
||||
title: 'Problem 155: Counting Capacitor Circuits'
|
||||
title: 'Problema 155: contare i circuiti dei condensatori'
|
||||
challengeType: 1
|
||||
forumTopicId: 301786
|
||||
dashedName: problem-155-counting-capacitor-circuits
|
||||
@@ -8,23 +8,23 @@ dashedName: problem-155-counting-capacitor-circuits
|
||||
|
||||
# --description--
|
||||
|
||||
An electric circuit uses exclusively identical capacitors of the same value C.
|
||||
Un circuito elettrico usa solo condensatori identici dello stesso valore C.
|
||||
|
||||
The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit.
|
||||
I condensatori possono essere collegati in serie o in parallelo per formare subunità, le quali poi possono essere collegate in serie o in parallelo ad altri condensatori o altre subunità per formare subunità più grandi, e così via fino al circuito finale.
|
||||
|
||||
Using this simple procedure and up to n identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to $n = 3$ capacitors of $60 μF$ each, we can obtain the following 7 distinct total capacitance values:
|
||||
Usando questa semplice procedura e fino a n condensatori identici, possiamo creare circuiti che hanno un range di diverse capacitanze totali. Per esempio, usando fino a $n = 3$ condensatori di $60 μF$ ognuno, possiamo ottenere sette valori totali di capacitanza distinti:
|
||||
|
||||
<img class="img-responsive center-block" alt="example circuits having up to three capacitors, each of 60 μF" src="https://cdn.freecodecamp.org/curriculum/project-euler/counting-capacitor-circuits.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="circuito di esempio avente fino a tre condensatori, ognuno di 60 μF" src="https://cdn.freecodecamp.org/curriculum/project-euler/counting-capacitor-circuits.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
If we denote by $D(n)$ the number of distinct total capacitance values we can obtain when using up to $n$ equal-valued capacitors and the simple procedure described above, we have: $D(1) = 1, D(2) = 3, D(3)=7, \ldots$
|
||||
Sia $D(n)$ il numero di valori di capacitanza distinti totali che si possono ottenere con $n$ condensatori di uguale capacitanza e la semplice procedura descritta sopra, abbiamo: $D(1) = 1, D(2) = 3, D(3) = 7, \ldots$
|
||||
|
||||
Find $D(18)$.
|
||||
Trova $D(18)$.
|
||||
|
||||
Reminder: When connecting capacitors $C_1$, $C_2$ etc in parallel, the total capacitance is $C_T = C_1 + C_2 + \cdots$, whereas when connecting them in series, the overall capacitance is given by: $\frac{1}{C_T} = \frac{1}{C_1} + \frac{1}{C_2} + \cdots$.
|
||||
Promemoria: quando si connettono i condensatori $C_1$, $C_2$ ecc in parallelo, la capacitanza totale è $C_T = C_1 + C_2 + \cdots$, mentre quando si connettono in serie, la capacitanza totale è data da: $\frac{1}{C_T} = \frac{1}{C_1} + \frac{1}{C_2} + \cdots$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`capacitanceValues()` should return `3857447`.
|
||||
`capacitanceValues()` dovrebbe restituire `3857447`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(capacitanceValues(), 3857447);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4091000cf542c50ff1b
|
||||
title: 'Problem 156: Counting Digits'
|
||||
title: 'Problema 156: contare le cifre'
|
||||
challengeType: 1
|
||||
forumTopicId: 301787
|
||||
dashedName: problem-156-counting-digits
|
||||
@@ -8,11 +8,11 @@ dashedName: problem-156-counting-digits
|
||||
|
||||
# --description--
|
||||
|
||||
Starting from zero the natural numbers are written down in base 10 like this:
|
||||
A partire da zero i numeri naturali sono scritti in base 10 in questo modo:
|
||||
|
||||
0 1 2 3 4 5 6 7 8 9 10 11 12....
|
||||
|
||||
Consider the digit $d = 1$. After we write down each number n, we will update the number of ones that have occurred and call this number $f(n, 1)$. The first values for $f(n, 1)$, then, are as follows:
|
||||
Considera la cifra $d = 1$. Dopo aver annotato ogni numero n, aggiorneremo il numero di uno che si sono verificati e chiameremo questo numero $f(n, 1)$. I primi valori per $f(n, 1)$, quindi, sono i seguenti:
|
||||
|
||||
| $n$ | $f(n, 1)$ |
|
||||
| --- | --------- |
|
||||
@@ -30,19 +30,19 @@ Consider the digit $d = 1$. After we write down each number n, we will update th
|
||||
| 11 | 4 |
|
||||
| 12 | 5 |
|
||||
|
||||
Note that $f(n, 1)$ never equals 3.
|
||||
Nota che $f(n, 1)$ non è mai uguale a 3.
|
||||
|
||||
So the first two solutions of the equation $f(n, 1) = n$ are $n = 0$ and $n = 1$. The next solution is $n = 199981$. In the same manner the function $f(n, d)$ gives the total number of digits d that have been written down after the number $n$ has been written.
|
||||
Quindi le prime due soluzioni dell'equazione $f(n, 1) = n$ sono $n = 0$ e $n = 1$. La soluzione successiva è $n = 199981$. Allo stesso modo la funzione $f(n, d)$ dà il numero totale di cifre d che sono state scritte dopo che il numero $n$ è stato scritto.
|
||||
|
||||
In fact, for every digit $d ≠ 0$, 0 is the first solution of the equation $f(n, d) = n$. Let $s(d)$ be the sum of all the solutions for which $f(n, d) = n$.
|
||||
Infatti, per ogni cifra $d =0$, 0 è la prima soluzione dell'equazione $f(n, d) = n$. Sia $s(d)$ sia la somma di tutte le soluzioni per le quali $f(n, d) = n$.
|
||||
|
||||
You are given that $s(1) = 22786974071$. Find $\sum{s(d)}$ for $1 ≤ d ≤ 9$.
|
||||
Dato $s(1) = 22786974071$. Trova $\sum{s(d)}$ per $1 ≤ d ≤ 9$.
|
||||
|
||||
Note: if, for some $n$, $f(n, d) = n$ for more than one value of $d$ this value of $n$ is counted again for every value of $d$ for which $f(n, d) = n$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`countingDigits()` should return `21295121502550`.
|
||||
`countingDigits()` dovrebbe restituire `21295121502550`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(countingDigits(), 21295121502550);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4091000cf542c50ff1c
|
||||
title: 'Problem 157: Solving the diophantine equation'
|
||||
title: 'Problema 157: risolvere l''equazione diofantina'
|
||||
challengeType: 1
|
||||
forumTopicId: 301788
|
||||
dashedName: problem-157-solving-the-diophantine-equation
|
||||
@@ -8,20 +8,20 @@ dashedName: problem-157-solving-the-diophantine-equation
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the diophantine equation $\frac{1}{a} + \frac{1}{b} = \frac{p}{{10}^n}$ with $a$, $b$, $p$, $n$ positive integers and $a ≤ b$.
|
||||
Considera l'equazione diofantina $\frac{1}{a} + \frac{1}{b} = \frac{p}{{10}^n}$ con $a$, $b$, $p$, $n$ interi positivi e $a ≤ b$.
|
||||
|
||||
For $n = 1$ this equation has 20 solutions that are listed below:
|
||||
Per $n = 1$ questa equazione ha 20 soluzioni che sono elencate di seguito:
|
||||
|
||||
$$\begin{array}{lllll} \frac{1}{1} + \frac{1}{1} = \frac{20}{10} & \frac{1}{1} + \frac{1}{2} = \frac{15}{10} & \frac{1}{1} + \frac{1}{5} = \frac{12}{10} & \frac{1}{1} + \frac{1}{10} = \frac{11}{10} & \frac{1}{2} + \frac{1}{2} = \frac{10}{10} \\\\
|
||||
\frac{1}{2} + \frac{1}{5} = \frac{7}{10} & \frac{1}{2} + \frac{1}{10} = \frac{6}{10} & \frac{1}{3} + \frac{1}{6} = \frac{5}{10} & \frac{1}{3} + \frac{1}{15} = \frac{4}{10} & \frac{1}{4} + \frac{1}{4} = \frac{5}{10} \\\\
|
||||
\frac{1}{4} + \frac{1}{4} = \frac{5}{10} & \frac{1}{5} + \frac{1}{5} = \frac{4}{10} & \frac{1}{5} + \frac{1}{10} = \frac{3}{10} & \frac{1}{6} + \frac{1}{30} = \frac{2}{10} & \frac{1}{10} + \frac{1}{10} = \frac{2}{10} \\\\
|
||||
\frac{1}{11} + \frac{1}{110} = \frac{1}{10} & \frac{1}{12} + \frac{1}{60} = \frac{1}{10} & \frac{1}{14} + \frac{1}{35} = \frac{1}{10} & \frac{1}{15} + \frac{1}{30} = \frac{1}{10} & \frac{1}{20} + \frac{1}{20} = \frac{1}{10} \end{array}$$
|
||||
|
||||
How many solutions has this equation for $1 ≤ n ≤ 9$?
|
||||
Quante soluzioni ha questa equazione per $1 ≤ n ≤ 9$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`diophantineEquation()` should return `53490`.
|
||||
`diophantineEquation()` dovrebbe restituire `53490`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(diophantineEquation(), 53490);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: 5900f40a1000cf542c50ff1d
|
||||
title: >-
|
||||
Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left
|
||||
Problema 158: esplorare le stringhe per le quali un solo carattere viene lessicograficamente dopo il suo vicino a sinistra
|
||||
challengeType: 1
|
||||
forumTopicId: 301789
|
||||
dashedName: >-
|
||||
@@ -10,25 +10,25 @@ dashedName: >-
|
||||
|
||||
# --description--
|
||||
|
||||
Taking three different letters from the 26 letters of the alphabet, character strings of length three can be formed.
|
||||
Prendendo tre lettere diverse dalle 26 lettere dell'alfabeto, si possono formare stringhe di caratteri di lunghezza tre.
|
||||
|
||||
Examples are 'abc', 'hat' and 'zyx'.
|
||||
Degli esempi sono 'abc', 'hat' e 'zyx'.
|
||||
|
||||
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.
|
||||
Quando studiamo questi tre esempi vediamo che per 'abc' due caratteri vengono lessicograficamente dopo il loro vicino a sinistra.
|
||||
|
||||
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.
|
||||
Per 'hat' c'è esattamente un carattere che viene lessicograficamente dopo il suo vicino a sinistra. Per 'zyx' ci sono zero caratteri che vengono lessicograficamente dopo il loro vicino a sinistra.
|
||||
|
||||
In all there are 10400 strings of length 3 for which exactly one character comes lexicographically after its neighbour to the left.
|
||||
In tutto ci sono 10400 stringhe di lunghezza 3 per le quali esattamente un carattere viene lessicograficamente dopo il suo vicino a sinistra.
|
||||
|
||||
We now consider strings of $n ≤ 26$ different characters from the alphabet.
|
||||
Ora consideriamo stringhe di $n ≤ 26$ caratteri diversi dell'alfabeto.
|
||||
|
||||
For every $n$, $p(n)$ is the number of strings of length $n$ for which exactly one character comes lexicographically after its neighbour to the left.
|
||||
Per ogni $n$, $p(n)$ è il numero di stringhe di lunghezza $n$ per cui esattamente un carattere viene lessicograficamente dopo il suo vicino a sinistra.
|
||||
|
||||
What is the maximum value of $p(n)$?
|
||||
Qual è il valore massimo di $p(n)$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`lexicographicNeighbours()` should return `409511334375`.
|
||||
`lexicographicNeighbours()` dovrebbe restituire `409511334375`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(lexicographicNeighbours(), 409511334375);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f40c1000cf542c50ff1e
|
||||
title: 'Problem 159: Digital root sums of factorisations'
|
||||
title: 'Problema 159: somma di radici numeriche di fattorizzazione'
|
||||
challengeType: 1
|
||||
forumTopicId: 301790
|
||||
dashedName: problem-159-digital-root-sums-of-factorisations
|
||||
@@ -8,36 +8,36 @@ dashedName: problem-159-digital-root-sums-of-factorisations
|
||||
|
||||
# --description--
|
||||
|
||||
A composite number can be factored many different ways.
|
||||
Un numero composito può essere fattorizzato in molti modi diversi.
|
||||
|
||||
For instance, not including multiplication by one, 24 can be factored in 7 distinct ways:
|
||||
Per esempio, senza includere la moltiplicazione per 1, 24 può essere fattorizzato in 7 modi distinti:
|
||||
|
||||
$$\begin{align} & 24 = 2 \times 2 \times 2 \times 3\\\\
|
||||
& 24 = 2 \times 3 \times 4 \\\\ & 24 = 2 \times 2 \times 6 \\\\
|
||||
& 24 = 4 \times 6 \\\\ & 24 = 3 \times 8 \\\\
|
||||
& 24 = 2 \times 12 \\\\ & 24 = 24 \end{align}$$
|
||||
|
||||
Recall that the digital root of a number, in base 10, is found by adding together the digits of that number, and repeating that process until a number arrives at less than 10. Thus the digital root of 467 is 8.
|
||||
Ricordati che le radice numerica di un numero, in base 10, si trova sommando le cifre del numero e ripetendo il processo fino a che il risultato non è inferiore a 10. Quindi la radice numerica di 467 è 8.
|
||||
|
||||
We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number. The chart below demonstrates all of the DRS values for 24.
|
||||
Sia la Digital Root Sum (DRS) la somma delle radici numeriche dei fattori individuali dei nostri numeri. La tabella sotto mostra tutti i valori DRS di 24.
|
||||
|
||||
| Factorisation | Digital Root Sum |
|
||||
| ------------- | ---------------- |
|
||||
| 2x2x2x3 | 9 |
|
||||
| 2x3x4 | 9 |
|
||||
| 2x2x6 | 10 |
|
||||
| 4x6 | 10 |
|
||||
| 3x8 | 11 |
|
||||
| 2x12 | 5 |
|
||||
| 24 | 6 |
|
||||
| Fattorizzazione | DRS |
|
||||
| --------------- | --- |
|
||||
| 2x2x2x3 | 9 |
|
||||
| 2x3x4 | 9 |
|
||||
| 2x2x6 | 10 |
|
||||
| 4x6 | 10 |
|
||||
| 3x8 | 11 |
|
||||
| 2x12 | 5 |
|
||||
| 24 | 6 |
|
||||
|
||||
The maximum Digital Root Sum of 24 is 11. The function $mdrs(n)$ gives the maximum Digital Root Sum of $n$. So $mdrs(24) = 11$.
|
||||
La DRS più grande di 24 è 11. La funzione $mdrs(n)$ restituisce il massimo DRS di $n$. Quindi $mdrs(24) = 11$.
|
||||
|
||||
Find $\sum{mdrs(n)}$ for $1 < n < 1,000,000$.
|
||||
Trova $\sum{mdrs(n)}$ per $1 < n < 1 000 000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler159()` should return `14489159`.
|
||||
`euler159()` dovrebbe restituire `14489159`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler159(), 14489159);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f40d1000cf542c50ff1f
|
||||
title: 'Problem 160: Factorial trailing digits'
|
||||
title: 'Problema 160: cifre finali dei fattoriali'
|
||||
challengeType: 1
|
||||
forumTopicId: 301794
|
||||
dashedName: problem-160-factorial-trailing-digits
|
||||
@@ -8,18 +8,18 @@ dashedName: problem-160-factorial-trailing-digits
|
||||
|
||||
# --description--
|
||||
|
||||
For any $N$, let $f(N)$ be the last five digits before the trailing zeroes in $N!$.
|
||||
Per ogni $N$, $f(N)$ rappresenta le ultime cinque cifre prima degli zeri finali in $N!$.
|
||||
|
||||
For example,
|
||||
Ad esempio,
|
||||
|
||||
$$\begin{align} & 9! = 362880 \\; \text{so} \\; f(9) = 36288 \\\\
|
||||
& 10! = 3628800 \\; \text{so} \\; f(10) = 36288 \\\\ & 20! = 2432902008176640000 \\; \text{so} \\; f(20) = 17664 \end{align}$$
|
||||
|
||||
Find $f(1,000,000,000,000)$
|
||||
Trova $f(1,000,000,000,000)$
|
||||
|
||||
# --hints--
|
||||
|
||||
`factorialTrailingDigits()` should return `16576`.
|
||||
`factorialTrailingDigits()` dovrebbe restituire `16576`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(factorialTrailingDigits(), 16576);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f40d1000cf542c50ff20
|
||||
title: 'Problem 161: Triominoes'
|
||||
title: 'Problema 161: triomini'
|
||||
challengeType: 1
|
||||
forumTopicId: 301795
|
||||
dashedName: problem-161-triominoes
|
||||
@@ -8,25 +8,25 @@ dashedName: problem-161-triominoes
|
||||
|
||||
# --description--
|
||||
|
||||
A triomino is a shape consisting of three squares joined via the edges.
|
||||
Un triomino è una figura che consiste di tre quadrati uniti per i lati.
|
||||
|
||||
There are two basic forms:
|
||||
Ci sono due forme base:
|
||||
|
||||
<img class="img-responsive center-block" alt="two basic triominoes forms" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-1.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="le due forme base dei triomini" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-1.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
If all possible orientations are taken into account there are six:
|
||||
Se consideriamo tutte le possibili orientazioni allora ce ne sono sei:
|
||||
|
||||
<img class="img-responsive center-block" alt="triominoes forms including orientation" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-2.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="le forme dei triomini includendo l'orientazione" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-2.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Any n by m grid for which nxm is divisible by 3 can be tiled with triominoes. If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes:
|
||||
Ogni griglia n per m in cui nxm è divisibile per 3 può essere riempita di triomini. Se consideriamo il riempimento che può essere ottenuto come riflessione o rotazione di un altro riempimento come diverso allora ci sono 41 modi diversi per riempire una griglia 2 per 9 con dei triomini:
|
||||
|
||||
<img class="img-responsive center-block" alt="animation showing 41 ways of filling 2x9 grid with triominoes" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-3.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="una animazione mostrante i 41 modi per riempire una griglia 9x2 con i triomini" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-3.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
In how many ways can a 9 by 12 grid be tiled in this way by triominoes?
|
||||
In quanti modi diversi può essere riempita in questo modo una griglia 9 per 12 con i triomini?
|
||||
|
||||
# --hints--
|
||||
|
||||
`triominoes()` should return `20574308184277972`.
|
||||
`triominoes()` dovrebbe restituire `20574308184277972`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(triominoes(), 20574308184277972);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f40e1000cf542c50ff21
|
||||
title: 'Problem 162: Hexadecimal numbers'
|
||||
title: 'Problema 162: numeri esadecimali'
|
||||
challengeType: 1
|
||||
forumTopicId: 301796
|
||||
dashedName: problem-162-hexadecimal-numbers
|
||||
@@ -8,31 +8,31 @@ dashedName: problem-162-hexadecimal-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
In the hexadecimal number system numbers are represented using 16 different digits:
|
||||
Nel sistema esadecimale I numeri sono rappresentati utilizzando 16 cifre diverse:
|
||||
|
||||
$$0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F$$
|
||||
|
||||
The hexadecimal number AF when written in the decimal number system equals $10 \times 16 + 15 = 175$.
|
||||
Il numero esadecimale AF quando scritto nel sistema di numeri decimali è pari a $10 \times 16 + 15 = 175$.
|
||||
|
||||
In the 3-digit hexadecimal numbers 10A, 1A0, A10, and A01 the digits 0,1 and A are all present.
|
||||
Nei numeri esadecimali a 3 cifre 10A, 1A0, A10 e A01 sono presenti tutte le cifre 0,1 e A.
|
||||
|
||||
Like numbers written in base ten we write hexadecimal numbers without leading zeroes.
|
||||
Come i numeri scritti nella base dieci scriviamo i numeri esadecimali senza zeri iniziali.
|
||||
|
||||
How many hexadecimal numbers containing at most sixteen hexadecimal digits exist with all of the digits 0,1, and A present at least once?
|
||||
Quanti numeri esadecimali contenenti al massimo sedici cifre esadecimali esistono con tutte le cifre 0,1, e A presenti almeno una volta?
|
||||
|
||||
Give your answer with hexadecimal number as a string.
|
||||
Dai la tua risposta con un numero esadecimale come una stringa.
|
||||
|
||||
**Note:** (A,B,C,D,E and F in upper case, without any leading or trailing code that marks the number as hexadecimal and without leading zeroes , e.g. 1A3F and not: 1a3f and not 0x1a3f and not $1A3F and not #1A3F and not 0000001A3F)
|
||||
**Nota:** (A,B,C,D,E e F in maiuscolo, senza alcun codice iniziale o finale che contrassegnano il numero come esadecimale e senza zeri iniziali, cioè 1A3F e non: 1a3f e non 0x1a3f e $1A3F e non #1A3F e non 0000001A3F)
|
||||
|
||||
# --hints--
|
||||
|
||||
`hexadecimalNumbers()` should return a string.
|
||||
`hexadecimalNumbers()` dovrebbe restituire una stringa.
|
||||
|
||||
```js
|
||||
assert(typeof hexadecimalNumbers() === 'string');
|
||||
```
|
||||
|
||||
`hexadecimalNumbers()` should return the string `3D58725572C62302`.
|
||||
`hexadecimalNumbers()` dovrebbe restituire la stringa `3D58725572C62302`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(hexadecimalNumbers(), '3D58725572C62302');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f40f1000cf542c50ff22
|
||||
title: 'Problem 163: Cross-hatched triangles'
|
||||
title: 'Problema 163: triangoli incrociati'
|
||||
challengeType: 1
|
||||
forumTopicId: 301797
|
||||
dashedName: problem-163-cross-hatched-triangles
|
||||
@@ -8,24 +8,24 @@ dashedName: problem-163-cross-hatched-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size 1 triangle in the sketch below.
|
||||
Considera un triangolo equilatero in cui delle linee sono disegnate da ogni vertice alla metà del lato opposto, come nel triangolo di dimensione 1 nel disegno qui sotto.
|
||||
|
||||
<img class="img-responsive center-block" alt="triangles with size 1 and size 2" src="https://cdn.freecodecamp.org/curriculum/project-euler/cross-hatched-triangles.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="triangoli di dimensione 1 e di dimensione 2" src="https://cdn.freecodecamp.org/curriculum/project-euler/cross-hatched-triangles.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size 1 triangles as building blocks, larger triangles can be formed, such as the size 2 triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size 2 triangle.
|
||||
Si possono vedere sedici triangoli di diversa forma o orientazione o posizione dentro quel triangolo. Usando i triangoli di dimensione 1 come unità base, si possono formare triangoli più grandi come il triangolo di dimensione due nel disegno sopra. Nel triangolo di dimensione due si possono osservare centoquattro triangoli di diversa dimensione o forma o orientazione o posizione.
|
||||
|
||||
It can be observed that the size 2 triangle contains 4 size 1 triangle building blocks. A size 3 triangle would contain 9 size 1 triangle building blocks and a size $n$ triangle would thus contain $n^2$ size 1 triangle building blocks.
|
||||
Si può vedere che il triangolo di dimensione 2 contiene 4 triangoli di dimensione 1 come unità base. Un triangolo di dimensione tre conterrebbe 9 unità triangolo di dimensione 1, quindi un triangolo di dimensione $n$ conterrebbe $n^2$ triangoli di dimensione 1.
|
||||
|
||||
If we denote $T(n)$ as the number of triangles present in a triangle of size $n$, then
|
||||
Sia $T(n)$ il numero di triangoli presenti in un triangolo di dimensione $n$, allora
|
||||
|
||||
$$\begin{align} & T(1) = 16 \\\\
|
||||
& T(2) = 104 \end{align}$$
|
||||
|
||||
Find $T(36)$.
|
||||
Trova $T(36)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`crossHatchedTriangles()` should return `343047`.
|
||||
`crossHatchedTriangles()` dovrebbe restituire `343047`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(crossHatchedTriangles(), 343047);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
---
|
||||
id: 5900f4111000cf542c50ff23
|
||||
title: >-
|
||||
Problem 164: Numbers for which no three consecutive digits have a sum greater than a given value
|
||||
Problema 164: numeri per cui nessuna cifra consecutiva ha una somma maggiore di un dato valore
|
||||
challengeType: 1
|
||||
forumTopicId: 301798
|
||||
dashedName: >-
|
||||
@@ -10,11 +10,11 @@ dashedName: >-
|
||||
|
||||
# --description--
|
||||
|
||||
How many 20 digit numbers $n$ (without any leading zero) exist such that no three consecutive digits of $n$ have a sum greater than 9?
|
||||
Quanti numeri di 20 cifre $n$ (senza nessuno zero iniziale) esistono in modo tale che nessun gruppo di tre cifre consecutive di $n$ abbia una somma maggiore di 9?
|
||||
|
||||
# --hints--
|
||||
|
||||
`consecutiveDigitsSum()` should return `378158756814587`.
|
||||
`consecutiveDigitsSum()` dovrebbe restituire `378158756814587`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(consecutiveDigitsSum(), 378158756814587);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4111000cf542c50ff24
|
||||
title: 'Problem 165: Intersections'
|
||||
title: 'Problema 165: intersezioni'
|
||||
challengeType: 1
|
||||
forumTopicId: 301799
|
||||
dashedName: problem-165-intersections
|
||||
@@ -8,37 +8,37 @@ dashedName: problem-165-intersections
|
||||
|
||||
# --description--
|
||||
|
||||
A segment is uniquely defined by its two endpoints. By considering two line segments in plane geometry there are three possibilities: the segments have zero points, one point, or infinitely many points in common.
|
||||
Un segmento è definito unicamente dai punti terminali. Considerando due segmenti in un piano geometrico ci sono tre possibilità: i due segmenti hanno zero punti, un punto, o infiniti punti in comune.
|
||||
|
||||
Moreover when two segments have exactly one point in common it might be the case that that common point is an endpoint of either one of the segments or of both. If a common point of two segments is not an endpoint of either of the segments it is an interior point of both segments.
|
||||
In più quando i due segmenti hanno esattamente un punto in comune potrebbe essere che questo sia un terminale di uno o entrambi i segmenti. Se un punto in comune dei due segmenti non è un punto terminale di nessuno dei due allora è un punto interno di entrambi i segmenti.
|
||||
|
||||
We will call a common point $T$ of two segments $L_1$ and $L_2$ a true intersection point of $L_1$ and $L_2$ if $T$ is the only common point of $L_1$ and $L_2$ and $T$ is an interior point of both segments.
|
||||
Sia $T$, un punto in comune di due segmenti $L_1$ e $L_2$, un punto d'intersezione è vero se è il solo punto in comune di $L_1$ e $L_2$ ed è un punto interno di entrambi i segmenti.
|
||||
|
||||
Consider the three segments $L_1$, $L_2$, and $L_3$:
|
||||
Considera i tre segmenti $L_1$, $L_2$, e $L_3$:
|
||||
|
||||
$$\begin{align} & L_1: (27, 44) \\;\text{to}\\; (12, 32) \\\\
|
||||
& L_2: (46, 53) \\;\text{to}\\; (17, 62) \\\\ & L_3: (46, 70) \\;\text{to}\\; (22, 40) \\\\
|
||||
\end{align}$$
|
||||
|
||||
It can be verified that line segments $L_2$ and $L_3$ have a true intersection point. We note that as the one of the end points of $L_3$: (22, 40) lies on $L_1$ this is not considered to be a true point of intersection. $L_1$ and $L_2$ have no common point. So among the three line segments, we find one true intersection point.
|
||||
Si può verificare che i segmenti $L_2$ e $L_3$ hanno un vero punto di intersezione. Notiamo che essendo uno dei terminali di $L_3$: (22, 40) su $L_1$ questo non è un vero punto d'intersezione. $L_1$ e $L_2$ non hanno un punto in comune. Quindi tra i tre segmenti troviamo un vero punto di intersezione.
|
||||
|
||||
Now let us do the same for 5000 line segments. To this end, we generate 20000 numbers using the so-called "Blum Blum Shub" pseudo-random number generator.
|
||||
Adesso facciamo lo stesso per 5000 segmenti. A questo fine, generiamo 20000 numeri casuali usando il generatore pseudo-casuale di numeri chiamato "Blum Blum Shub".
|
||||
|
||||
$$\begin{align} & s_0 = 290797 \\\\
|
||||
& s_{n + 1} = s_n × s_n (\text{modulo}\\; 50515093) \\\\ & t_n = s_n (\text{modulo}\\; 500) \\\\
|
||||
\end{align}$$
|
||||
|
||||
To create each line segment, we use four consecutive numbers $t_n$. That is, the first line segment is given by:
|
||||
Per creare ogni segmento, usiamo quattro numeri consecutivi $t_n$. Quindi, il primo segmento è dato da:
|
||||
|
||||
($_t$1, $t_2$) to ($t_3$, $t_4$)
|
||||
da ($_t$1, $t_2$) a ($t_3$, $t_4$)
|
||||
|
||||
The first four numbers computed according to the above generator should be: 27, 144, 12 and 232. The first segment would thus be (27, 144) to (12, 232).
|
||||
I primi quattro numeri calcolati con il precedente generatore dovrebbero essere: 27, 144, 12 e 232. Quindi il primo segmento è da (27, 144) a (12, 232).
|
||||
|
||||
How many distinct true intersection points are found among the 5000 line segments?
|
||||
Quante intersezioni vere vengono trovate tra i 5000 segmenti?
|
||||
|
||||
# --hints--
|
||||
|
||||
`distinctIntersections()` should return `2868868`.
|
||||
`distinctIntersections()` dovrebbe restituire `2868868`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(distinctIntersections(), 2868868);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4131000cf542c50ff25
|
||||
title: 'Problem 166: Criss Cross'
|
||||
title: 'Problema 166: criss cross'
|
||||
challengeType: 1
|
||||
forumTopicId: 301800
|
||||
dashedName: problem-166-criss-cross
|
||||
@@ -8,21 +8,21 @@ dashedName: problem-166-criss-cross
|
||||
|
||||
# --description--
|
||||
|
||||
A 4x4 grid is filled with digits $d$, $0 ≤ d ≤ 9$.
|
||||
Una griglia 4x4 è riempita con cifre $d$, $0 ≤ d ≤ 9$.
|
||||
|
||||
It can be seen that in the grid
|
||||
Si può vedere che nella griglia
|
||||
|
||||
$$\begin{array}{} 6 & 3 & 3 & 0 \\\\
|
||||
5 & 0 & 4 & 3 \\\\ 0 & 7 & 1 & 4 \\\\
|
||||
1 & 2 & 4 & 5 \end{array}$$
|
||||
|
||||
the sum of each row and each column has the value 12. Moreover the sum of each diagonal is also 12.
|
||||
la somma di ciascuna riga e di ciascuna colonna ha il valore 12. Inoltre la somma di ogni diagonale è anch'essa 12.
|
||||
|
||||
In how many ways can you fill a 4x4 grid with the digits $d$, $0 ≤ d ≤ 9$ so that each row, each column, and both diagonals have the same sum?
|
||||
In quanti modi puoi riempire una griglia 4x4 con le cifre $d$, $0 ≤ d ≤ 9$ in modo che ogni riga, ogni colonna ed entrambe le diagonali abbiano la stessa somma?
|
||||
|
||||
# --hints--
|
||||
|
||||
`crissCross()` should return `7130034`.
|
||||
`crissCross()` dovrebbe restituire `7130034`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(crissCross(), 7130034);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4141000cf542c50ff26
|
||||
title: 'Problem 167: Investigating Ulam sequences'
|
||||
title: 'Problema 167: analizzare le sequenze di Ulam'
|
||||
challengeType: 1
|
||||
forumTopicId: 301801
|
||||
dashedName: problem-167-investigating-ulam-sequences
|
||||
@@ -8,19 +8,19 @@ dashedName: problem-167-investigating-ulam-sequences
|
||||
|
||||
# --description--
|
||||
|
||||
For two positive integers $a$ and $b$, the Ulam sequence $U(a,b)$ is defined by ${U{(a,b)}\_1} = a$, ${U{(a,b)}\_2} = b$ and for $k > 2$, ${U{(a,b)}\_k}$ is the smallest integer greater than ${U{(a,b)}\_{(k-1)}}$ which can be written in exactly one way as the sum of two distinct previous members of $U(a,b)$.
|
||||
Per due interi positivi $a$ e $b$, la successione di Ulam $U(a,b)$ è definita da ${U{(a,b)}\_1} = a$, ${U{(a,b)}\_2} = b$ e per $k > 2$, ${U{(a,b)}\_k}$ è il più piccolo numero intero maggiore di ${U{(a,b)}\_{(k-1)}}$ che può essere scritto esattamente in un modo come la somma di due membri precedenti distinti di $U(a,b)$.
|
||||
|
||||
For example, the sequence $U(1,2)$ begins with
|
||||
Ad esempio, la successione $U(1,2)$ inizia con
|
||||
|
||||
$$1, 2, 3 = 1 + 2, 4 = 1 + 3, 6 = 2 + 4, 8 = 2 + 6, 11 = 3 + 8$$
|
||||
|
||||
5 does not belong to it because $5 = 1 + 4 = 2 + 3$ has two representations as the sum of two previous members, likewise $7 = 1 + 6 = 3 + 4$.
|
||||
5 non vi appartiene perché $5 = 1 + 4 = 2 + 3$ ha due rappresentazioni come la somma di due membri precedenti, così come $7 = 1 + 6 = 3 + 4$.
|
||||
|
||||
Find $\sum {U(2, 2n + 1)_k}$ for $2 ≤ n ≤ 10$, where $k = {10}^{11}$.
|
||||
Trova $\sum {U(2, 2n + 1)_k}$ per $2 ≤ n ≤ 10$, dove $k = {10}^{11}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`ulamSequences()` should return `3916160068885`.
|
||||
`ulamSequences()` dovrebbe restituire `3916160068885`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(ulamSequences(), 3916160068885);
|
||||
|
||||
@@ -7,7 +7,7 @@ dashedName: step-25
|
||||
|
||||
# --description--
|
||||
|
||||
Your next calculation is the <dfn>mode</dfn>, which is the number that appears most often in the list. To get started, declare a `getMode` function that takes the same `array` parameter you have been using.
|
||||
O próximo cálculo é o da <dfn>moda</dfn>, que é o número que mais aparece na lista. To get started, declare a `getMode` function that takes the same `array` parameter you have been using.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
@@ -7,23 +7,23 @@ dashedName: step-32
|
||||
|
||||
# --description--
|
||||
|
||||
Now chain the filter method to your latest `Object.keys()` call. The callback function should return whether the value of `counts[el]` is equal to your `counts[highest]`.
|
||||
Agora, encadeie o método filter para a chamada mais recente de `Object.keys()`. A função de callback deve retornar se o valor de `counts[el]` é igual a `counts[highest]`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should chain `.filter()` to your last `Object.keys()` call.
|
||||
Você deve encadear o método `.filter()` à chamada mais recente de `Object.keys()`.
|
||||
|
||||
```js
|
||||
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(/);
|
||||
```
|
||||
|
||||
Your `.filter()` method should take a callback function with a parameter `el`.
|
||||
O método `.filter()` deve receber uma função de callback que recebe o parâmetro `el`.
|
||||
|
||||
```js
|
||||
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(function\s*\(\s*el\s*\)/);
|
||||
```
|
||||
|
||||
Your `.filter()` method should return whether the value of `counts[el]` is equal to `counts[highest]`.
|
||||
O método `.filter()` deve retornar se o valor de `counts[el]` é igual a `counts[highest]`.
|
||||
|
||||
```js
|
||||
assert.match(getMode.toString(), /mode\s*=\s*Object\.keys\(\s*counts\s*\)\.filter\(function\s*\(\s*el\s*\)\s*\{\s*return\s*counts\[\s*el\s*\]\s*===\s*counts\[\s*highest\s*\];\s*\}/);
|
||||
|
||||
@@ -7,55 +7,55 @@ dashedName: step-41
|
||||
|
||||
# --description--
|
||||
|
||||
With two `.map()` calls and a `.reduce()` call, you're creating extra arrays and iterating more times than needed. You should move all of the logic into the `.reduce()` call to save time and memory.
|
||||
Com duas chamadas de `.map()` e uma chamada `.reduce()`, você está criando arrays adicionais e iterando mais vezes do que o necessário. Você deve mover toda a lógica para a chamada de `.reduce()` para economizar tempo e memória.
|
||||
|
||||
Remove the `differences`, `squaredDifferences`, and `sumSquaredDifferences` variables (and their values). Declare a `variance` variable, and assign it the value of `array.reduce()`. For the callback, pass in your standard `acc` and `el` parameters, but leave the function body empty for now. Don't forget to set the initial value to `0`.
|
||||
Remova as variáveis `differences`, `squaredDifferences` e `sumSquaredDifferences` (e seus valores). Declare uma variável `variance` e atribua a ela o valor de `array.reduce()`. Para a função de callback, passe os parâmetros `acc` e `el` padrão, mas deixe o corpo da função vazio por enquanto. Não se esqueça de definir o valor inicial como `0`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should remove the `differences` variable.
|
||||
Você deve remover a variável `differences`.
|
||||
|
||||
```js
|
||||
assert.notMatch(getVariance.toString(), /differences\s*=/);
|
||||
```
|
||||
|
||||
You should remove the `squaredDifferences` variable.
|
||||
Você deve remover a variável `squaredDifferences`.
|
||||
|
||||
```js
|
||||
assert.notMatch(getVariance.toString(), /squaredDifferences\s*=/);
|
||||
```
|
||||
|
||||
You should remove the `sumSquaredDifferences` variable.
|
||||
Você deve remover a variável `sumSquaredDifferences`.
|
||||
|
||||
```js
|
||||
assert.notMatch(getVariance.toString(), /sumSquaredDifferences\s*=/);
|
||||
```
|
||||
|
||||
You should have a `variance` variable.
|
||||
Você deve ter uma variável `variance`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=/);
|
||||
```
|
||||
|
||||
Your `variance` variable should use the `array.reduce()` method.
|
||||
A variável `variance` deve usar o método `array.reduce()`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(/);
|
||||
```
|
||||
|
||||
Your `variance` variable should use the `acc` and `el` parameters in the callback function.
|
||||
A variável `variance` deve usar os parâmetros `acc` e `el` na função de callback.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?/);
|
||||
```
|
||||
|
||||
Your `reduce` callback should be an empty function.
|
||||
A função de callback de `reduce` deve estar vazia.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*\}/);
|
||||
```
|
||||
|
||||
Your `reduce` callback should have an initial value of `0`.
|
||||
A função de callback de `reduce` deve ter um valor inicial igual a `0`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*\}\s*,\s*0\s*\)/);
|
||||
|
||||
@@ -7,41 +7,41 @@ dashedName: step-42
|
||||
|
||||
# --description--
|
||||
|
||||
Within your empty `.reduce()` callback, declare a variable `difference` and set it to the value of `el` minus `mean`. Then declare a `squared` variable, and set it to the value of `difference` to the power of `2`. Finally, return the value of `acc` plus `squared`.
|
||||
Dentro da função de callback de `.reduce()` vazia, declare uma variável `difference` e defina-a com o valor de `el` menos `mean`. Depois, declare uma variável `squared` e defina-a com o valor de `difference` na `2`ª potência. Por fim, retorne o valor de `acc` mais `squared`.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `reduce` callback should have a `difference` variable.
|
||||
A função de callback de `reduce` deve ter uma variável `difference`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=/);
|
||||
```
|
||||
|
||||
Your `difference` variable should be set to the value of `el` minus `mean`.
|
||||
A variável `difference` deve ser definida com o valor de `el` menos `mean`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=\s*el\s*-\s*mean\s*;/);
|
||||
```
|
||||
|
||||
Your `reduce` callback should have a `squared` variable.
|
||||
A função de callback de `reduce` deve ter uma variável `squared`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=\s*el\s*-\s*mean\s*;\s*var\s*squared\s*=/);
|
||||
```
|
||||
|
||||
Your `squared` variable should be set to the value of `difference` to the power of 2.
|
||||
A variável `squared` deve estar definida com o valor de `difference` na 2ª potência.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=\s*el\s*-\s*mean\s*;\s*var\s*squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);/);
|
||||
```
|
||||
|
||||
Your `reduce` callback should return the value of `acc` plus `squared`.
|
||||
A função de callback de `reduce` deve retornar o valor de `acc` mais `squared`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=\s*el\s*-\s*mean\s*;\s*var\s*squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s*acc\s*\+\s*squared\s*;/);
|
||||
```
|
||||
|
||||
You should not remove the initial value of `0` from your `.reduce()` method.
|
||||
Você não deve remover o valor inicial de `0` do método `.reduce()`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=\s*el\s*-\s*mean\s*;\s*var\s*squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s*acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\)/);
|
||||
|
||||
@@ -7,19 +7,19 @@ dashedName: step-43
|
||||
|
||||
# --description--
|
||||
|
||||
The final step in calculating the variance is to divide the sum of the squared differences by the count of numbers.
|
||||
O último passo para calcular a variância é dividir a soma das diferenças quadradas pela contagem de números.
|
||||
|
||||
Divide your `.reduce()` call by the length of the array (in your `variance` declaration). Then, return `variance`.
|
||||
Divida a chamada de `.reduce()` pelo comprimento do array (na declaração de `variance`). Em seguida, retorne `variance`.
|
||||
|
||||
# --hints--
|
||||
|
||||
You should divide the result of the `.reduce()` call by the length of the array.
|
||||
Você deve dividir o resultado da chamada de `.reduce()` pelo comprimento do array.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /variance\s*=\s*array\.reduce\(function\s*\(?\s*acc\s*,\s*el\s*\)?\s*\{\s*var\s*difference\s*=\s*el\s*-\s*mean\s*;\s*var\s*squared\s*=\s*Math\.pow\(\s*difference\s*,\s*2\s*\);\s*return\s*acc\s*\+\s*squared\s*;\s*\}\s*,\s*0\)\s*\/\s*array\.length;/);
|
||||
```
|
||||
|
||||
You should return the value of `variance`.
|
||||
Você deve retornar o valor de `variance`.
|
||||
|
||||
```js
|
||||
assert.match(getVariance.toString(), /return\s*variance\s*;/);
|
||||
|
||||
Reference in New Issue
Block a user