chore(i18n,learn): processed translations (#45287)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4251000cf542c50ff38
|
||||
title: 'Problem 185: Number Mind'
|
||||
title: 'Problema 185: Number Mind'
|
||||
challengeType: 5
|
||||
forumTopicId: 301821
|
||||
dashedName: problem-185-number-mind
|
||||
@ -8,24 +8,28 @@ dashedName: problem-185-number-mind
|
||||
|
||||
# --description--
|
||||
|
||||
The game Number Mind is a variant of the well known game Master Mind.
|
||||
Il gioco Number Mind è una variante del ben noto gioco Master Mind.
|
||||
|
||||
Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was 1234 and you guessed 2036, you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place.
|
||||
Invece di chiodini colorati, devi indovinare una sequenza segreta di cifre. Dopo ogni ipotesi ti viene detto solo in quanti posti hai indovinato la cifra corretta. Quindi, se la sequenza era 1234 e avete indovinato 2036, vi sarebbe stato detto che avete una cifra corretta; tuttavia, NON ti sarà detto che hai anche un'altra cifra nel posto sbagliato.
|
||||
|
||||
For instance, given the following guesses for a 5-digit secret sequence, 90342 ;2 correct 70794 ;0 correct 39458 ;2 correct 34109 ;1 correct 51545 ;2 correct 12531 ;1 correct The correct sequence 39542 is unique.
|
||||
Per esempio, date le seguenti ipotesi per una sequenza segreta di 5 cifre,
|
||||
|
||||
Based on the following guesses,
|
||||
$$\begin{align} & 90342 ;2\\;\text{correct}\\\\ & 70794 ;0\\;\text{correct}\\\\ & 39458 ;2\\;\text{correct}\\\\ & 34109 ;1\\;\text{correct}\\\\ & 51545 ;2\\;\text{correct}\\\\ & 12531 ;1\\;\text{correct} \end{align}$$
|
||||
|
||||
5616185650518293 ;2 correct 3847439647293047 ;1 correct 5855462940810587 ;3 correct 9742855507068353 ;3 correct 4296849643607543 ;3 correct 3174248439465858 ;1 correct 4513559094146117 ;2 correct 7890971548908067 ;3 correct 8157356344118483 ;1 correct 2615250744386899 ;2 correct 8690095851526254 ;3 correct 6375711915077050 ;1 correct 6913859173121360 ;1 correct 6442889055042768 ;2 correct 2321386104303845 ;0 correct 2326509471271448 ;2 correct 5251583379644322 ;2 correct 1748270476758276 ;3 correct 4895722652190306 ;1 correct 3041631117224635 ;3 correct 1841236454324589 ;3 correct 2659862637316867 ;2 correct
|
||||
La sequenza corretta 39542 è unica.
|
||||
|
||||
Find the unique 16-digit secret sequence.
|
||||
Sulla base delle ipotesi seguenti,
|
||||
|
||||
$$\begin{align} & 5616185650518293 ;2\\;\text{correct}\\\\ & 3847439647293047 ;1\\;\text{correct}\\\\ & 5855462940810587 ;3\\;\text{correct}\\\\ & 9742855507068353 ;3\\;\text{correct}\\\\ & 4296849643607543 ;3\\;\text{correct}\\\\ & 3174248439465858 ;1\\;\text{correct}\\\\ & 4513559094146117 ;2\\;\text{correct}\\\\ & 7890971548908067 ;3\\;\text{correct}\\\\ & 8157356344118483 ;1\\;\text{correct}\\\\ & 2615250744386899 ;2\\;\text{correct}\\\\ & 8690095851526254 ;3\\;\text{correct}\\\\ & 6375711915077050 ;1\\;\text{correct}\\\\ & 6913859173121360 ;1\\;\text{correct}\\\\ & 6442889055042768 ;2\\;\text{correct}\\\\ & 2321386104303845 ;0\\;\text{correct}\\\\ & 2326509471271448 ;2\\;\text{correct}\\\\ & 5251583379644322 ;2\\;\text{correct}\\\\ & 1748270476758276 ;3\\;\text{correct}\\\\ & 4895722652190306 ;1\\;\text{correct}\\\\ & 3041631117224635 ;3\\;\text{correct}\\\\ & 1841236454324589 ;3\\;\text{correct}\\\\ & 2659862637316867 ;2\\;\text{correct} \end{align}$$
|
||||
|
||||
Trova la sequenza segreta unica a 16 cifre.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler185()` should return 4640261571849533.
|
||||
`numberMind()` dovrebbe restituire `4640261571849533`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler185(), 4640261571849533);
|
||||
assert.strictEqual(numberMind(), 4640261571849533);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +37,12 @@ assert.strictEqual(euler185(), 4640261571849533);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler185() {
|
||||
function numberMind() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler185();
|
||||
numberMind();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4281000cf542c50ff39
|
||||
title: 'Problem 186: Connectedness of a network'
|
||||
title: 'Problema 186: Collegamento di una rete'
|
||||
challengeType: 5
|
||||
forumTopicId: 301822
|
||||
dashedName: problem-186-connectedness-of-a-network
|
||||
@ -8,24 +8,33 @@ dashedName: problem-186-connectedness-of-a-network
|
||||
|
||||
# --description--
|
||||
|
||||
Here are the records from a busy telephone system with one million users:
|
||||
Ecco i dati da un sistema telefonico molto usato con un milione di utenti:
|
||||
|
||||
RecNrCallerCalled120000710005326001835004393600863701497......... The telephone number of the caller and the called number in record n are Caller(n) = S2n-1 and Called(n) = S2n where S1,2,3,... come from the "Lagged Fibonacci Generator":
|
||||
| RecNr | Chiamante | Chiamato |
|
||||
| ----- | --------- | -------- |
|
||||
| 1 | 200007 | 100053 |
|
||||
| 2 | 600183 | 500439 |
|
||||
| 3 | 600863 | 701497 |
|
||||
| ... | ... | ... |
|
||||
|
||||
For 1 ≤ k ≤ 55, Sk = \[100003 - 200003k + 300007k3] (modulo 1000000) For 56 ≤ k, Sk = \[Sk-24 + Sk-55] (modulo 1000000)
|
||||
Il numero di telefono del chiamante e il numero chiamato nel record $n$ sono $Caller(n) = S_{2n - 1}$ e $Called(n) = S_{2n}$ dove ${S}_{1,, 3,\ldots}$ provengono dal "Lagged Fibonacci Generator":
|
||||
|
||||
If Caller(n) = Called(n) then the user is assumed to have misdialled and the call fails; otherwise the call is successful.
|
||||
Per $1 ≤ k ≤ 55$, $S_k = [100003 - 200003k + 300007{k}^3]\\;(\text{modulo}\\;1000000)$
|
||||
|
||||
From the start of the records, we say that any pair of users X and Y are friends if X calls Y or vice-versa. Similarly, X is a friend of a friend of Z if X is a friend of Y and Y is a friend of Z; and so on for longer chains.
|
||||
Per $56 ≤ k$, $S_k = [S_{k - 24} + S_{k - 55}]\\;(\text{modulo}\\;1000000)$
|
||||
|
||||
The Prime Minister's phone number is 524287. After how many successful calls, not counting misdials, will 99% of the users (including the PM) be a friend, or a friend of a friend etc., of the Prime Minister?
|
||||
Se $Caller(n) = Called(n)$ allora si presume che l'utente abbia sbagliato e la chiamata fallisce; altrimenti la chiamata è riuscita.
|
||||
|
||||
Dall'inizio delle registrazioni, diciamo che qualsiasi coppia di utenti $X$ e $Y$ sono amici se $X$ chiama $Y$ o viceversa. Allo stesso modo, $X$ è un amico di un amico di $Z$ se $X$ è un amico di $Y$ e $Y$ è un amico di $Z$; e così via per catene più lunghe.
|
||||
|
||||
Il numero di telefono del Primo Ministro è 524287. Dopo quante chiamate di successo, senza contare gli errori, il 99% degli utenti (compreso il PM) sarà un amico, o un amico di un amico ecc. del Primo Ministro?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler186()` should return 2325629.
|
||||
`connectednessOfANetwork()` dovrebbe restituire `2325629`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler186(), 2325629);
|
||||
assert.strictEqual(connectednessOfANetwork(), 2325629);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +42,12 @@ assert.strictEqual(euler186(), 2325629);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler186() {
|
||||
function connectednessOfANetwork() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler186();
|
||||
connectednessOfANetwork();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4291000cf542c50ff3a
|
||||
title: 'Problem 187: Semiprimes'
|
||||
title: 'Problema 187 Semiprimi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301823
|
||||
dashedName: problem-187-semiprimes
|
||||
@ -8,15 +8,15 @@ dashedName: problem-187-semiprimes
|
||||
|
||||
# --description--
|
||||
|
||||
A composite is a number containing at least two prime factors. For example, 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3.
|
||||
Un composito è un numero contenente almeno due fattori principali. Ad esempio, $15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3 $.
|
||||
|
||||
There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors: 4, 6, 9, 10, 14, 15, 21, 22, 25, 26.
|
||||
Ci sono dieci numeri compositi sotto trenta che contengono esattamente due, non necessariamente distinti, fattori primi: 4, 6, 9, 10, 14, 15, 21, 22, 25, 26.
|
||||
|
||||
How many composite integers, n < 108, have precisely two, not necessarily distinct, prime factors?
|
||||
Quanti numeri interi compositi, $n < {10}^8$, hanno precisamente due, non necessariamente distinti, fattori primi?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler187()` should return 17427258.
|
||||
`semiPrimes()` dovrebbe restituire `17427258`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler187(), 17427258);
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler187(), 17427258);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler187() {
|
||||
function semiPrimes() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler187();
|
||||
semiPrimes();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4291000cf542c50ff3b
|
||||
title: 'Problem 188: The hyperexponentiation of a number'
|
||||
title: 'Problema 188: L''iperesponenziazione di un numero'
|
||||
challengeType: 5
|
||||
forumTopicId: 301824
|
||||
dashedName: problem-188-the-hyperexponentiation-of-a-number
|
||||
@ -8,20 +8,20 @@ dashedName: problem-188-the-hyperexponentiation-of-a-number
|
||||
|
||||
# --description--
|
||||
|
||||
The hyperexponentiation or tetration of a number a by a positive integer b, denoted by a↑↑b or ba, is recursively defined by:
|
||||
L'iperesponenziazione o tetrazione di un numero $a$ di un numero intero positivo $b$, denotata da $a↑b$ o ${}^ba$, è definita ricorsivamente da:
|
||||
|
||||
a↑↑1 = a,
|
||||
$a↑↑1 = a$,
|
||||
|
||||
a↑↑(k+1) = a(a↑↑k).
|
||||
$a↑↑(k+1) = a^{(a↑↑k)}$.
|
||||
|
||||
Thus we have e.g. 3↑↑2 = 33 = 27, hence 3↑↑3 = 327 = 7625597484987 and 3↑↑4 is roughly 103.6383346400240996\*10^12. Find the last 8 digits of 1777↑↑1855.
|
||||
Così abbiamo ad esempio $3↑↑2 = 3^3 = 27$, quindi $3↑↑3 = 3^{27} = 7625597484987$ e $3↑↑4$ è approssimativamente ${10}^{3. 383346400240996 \tvolte {10}^{12}}$. Trova le ultime 8 cifre di $1777↑↑1855$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler188()` should return 95962097.
|
||||
`hyperexponentation()` dovrebbe restituire `95962097`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler188(), 95962097);
|
||||
assert.strictEqual(hyperexponentation(), 95962097);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler188(), 95962097);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler188() {
|
||||
function hyperexponentation() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler188();
|
||||
hyperexponentation();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4291000cf542c50ff3c
|
||||
title: 'Problem 189: Tri-colouring a triangular grid'
|
||||
title: 'Problema 189: Tri-colorare una griglia triangolare'
|
||||
challengeType: 5
|
||||
forumTopicId: 301825
|
||||
dashedName: problem-189-tri-colouring-a-triangular-grid
|
||||
@ -8,22 +8,26 @@ dashedName: problem-189-tri-colouring-a-triangular-grid
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the following configuration of 64 triangles:
|
||||
Considera la seguente configurazione di 64 triangoli:
|
||||
|
||||
We wish to colour the interior of each triangle with one of three colours: red, green or blue, so that no two neighbouring triangles have the same colour. Such a colouring shall be called valid. Here, two triangles are said to be neighbouring if they share an edge. Note: if they only share a vertex, then they are not neighbours.
|
||||
<img class="img-responsive center-block" alt="64 triangoli disposti in modo da creare un triangolo più grande con lunghezza del lato di 8 triangoli" src="https://cdn.freecodecamp.org/curriculum/project-euler/tri-colouring-a-triangular-grid-1.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
For example, here is a valid colouring of the above grid:
|
||||
Desideriamo colorare l'interno di ogni triangolo con uno dei tre colori: rosso, verde o blu, in modo che due triangoli vicini non abbiano lo stesso colore. Tale colorazione è denominata valida. Definiamo vicini due triangoli che condividono un bordo. Nota: se condividono solo un vertice, allora non sono vicini.
|
||||
|
||||
A colouring C' which is obtained from a colouring C by rotation or reflection is considered distinct from C unless the two are identical.
|
||||
Per esempio, ecco una colorazione valida della griglia di cui sopra:
|
||||
|
||||
How many distinct valid colourings are there for the above configuration?
|
||||
<img class="img-responsive center-block" alt="griglia colorata di 64 triangoli" src="https://cdn.freecodecamp.org/curriculum/project-euler/tri-colouring-a-triangular-grid-2.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Una colorazione C' ottenuta da una colorazione C per rotazione o riflessione è considerata distinta da C a meno che le due non siano identiche.
|
||||
|
||||
Quante distinte colorazioni valide esistono per la configurazione di cui sopra?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler189()` should return 10834893628237824.
|
||||
`triangularGridColoring()` dovrebbe restituire `10834893628237824`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler189(), 10834893628237824);
|
||||
assert.strictEqual(triangularGridColoring(), 10834893628237824);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +35,12 @@ assert.strictEqual(euler189(), 10834893628237824);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler189() {
|
||||
function triangularGridColoring() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler189();
|
||||
triangularGridColoring();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f42b1000cf542c50ff3d
|
||||
title: 'Problem 190: Maximising a weighted product'
|
||||
title: 'Problema 190: Massimizzare un prodotto pesato'
|
||||
challengeType: 5
|
||||
forumTopicId: 301828
|
||||
dashedName: problem-190-maximising-a-weighted-product
|
||||
@ -8,18 +8,18 @@ dashedName: problem-190-maximising-a-weighted-product
|
||||
|
||||
# --description--
|
||||
|
||||
Let Sm = (x1, x2, ... , xm) be the m-tuple of positive real numbers with x1 + x2 + ... + xm = m for which Pm = x1 \* x22 \* ... \* xmm is maximised.
|
||||
Sia $S_m = (x_1, x_2, \ldots, x_m)$ la $m$-tuple di numeri reali poisitivi con $x_1 + x_2 + \cdots + x_m = m$ per i quali$P_m = x_1 \times {x_2}^2 \times \cdots \times {x_m}^m$ è massimizzato.
|
||||
|
||||
For example, it can be verified that \[P10] = 4112 (\[ ] is the integer part function).
|
||||
Ad esempio, si può verificare che $[P_{10}] = 4112$ ([ ] è la funzione parte intera).
|
||||
|
||||
Find Σ\[Pm] for 2 ≤ m ≤ 15.
|
||||
Trova $\sum {[P_m]}$ per $2 ≤ m ≤ 15$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler190()` should return 371048281.
|
||||
`maximisingWeightedProduct()` dovrebbe restituire `371048281`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler190(), 371048281);
|
||||
assert.strictEqual(maximisingWeightedProduct(), 371048281);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler190(), 371048281);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler190() {
|
||||
function maximisingWeightedProduct() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler190();
|
||||
maximisingWeightedProduct();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f42b1000cf542c50ff3e
|
||||
title: 'Problem 191: Prize Strings'
|
||||
title: 'Problema 191: Stringhe Premio'
|
||||
challengeType: 5
|
||||
forumTopicId: 301829
|
||||
dashedName: problem-191-prize-strings
|
||||
@ -8,22 +8,28 @@ dashedName: problem-191-prize-strings
|
||||
|
||||
# --description--
|
||||
|
||||
A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize.
|
||||
Una scuola particolare offre premi in denaro ai bambini con una buona frequenza e puntualità. Se sono assenti per tre giorni consecutivi o in ritardo in più di un'occasione, allora perdono il loro premio.
|
||||
|
||||
During an n-day period a trinary string is formed for each child consisting of L's (late), O's (on time), and A's (absent).
|
||||
Durante un periodo di n-giorni viene formata una stringa ternaria per ogni bambino costituita da L (tardi), O (in orario) e A (assente).
|
||||
|
||||
Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize:
|
||||
Anche se ci sono ottantuno stringhe ternarie che possono essere formate per un periodo di 4 giorni, esattamente quarantatre stringhe porterebbero a un premio:
|
||||
|
||||
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA LAOO LAOA LAAO
|
||||
```
|
||||
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA
|
||||
OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO
|
||||
AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL
|
||||
AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA
|
||||
LAOO LAOA LAAO
|
||||
```
|
||||
|
||||
How many "prize" strings exist over a 30-day period?
|
||||
Quante stringhe "premio" esistono in un periodo di 30 giorni?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler191()` should return 1918080160.
|
||||
`prizeStrings()` dovrebbe restituire `1918080160`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler191(), 1918080160);
|
||||
assert.strictEqual(prizeStrings(), 1918080160);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +37,12 @@ assert.strictEqual(euler191(), 1918080160);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler191() {
|
||||
function prizeStrings() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler191();
|
||||
prizeStrings();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f42c1000cf542c50ff3f
|
||||
title: 'Problem 192: Best Approximations'
|
||||
title: 'Problema 192: Migliori approssimazioni'
|
||||
challengeType: 5
|
||||
forumTopicId: 301830
|
||||
dashedName: problem-192-best-approximations
|
||||
@ -8,22 +8,22 @@ dashedName: problem-192-best-approximations
|
||||
|
||||
# --description--
|
||||
|
||||
Let x be a real number.
|
||||
Sia $x$ sia un numero reale.
|
||||
|
||||
A best approximation to x for the denominator bound d is a rational number r/s in reduced form, with s ≤ d, such that any rational number which is closer to x than r/s has a denominator larger than d:
|
||||
Una migliore approssimazione a $x$ per limite del denominatore $d$ è un numero razionale $\frac{r}{s}$ in forma ridotta, con $s ≤ d$, tale che qualsiasi numero razionale più vicino a $x$ rispetto a $\frac{r}{s}$ abbia un denominatore più grande di $d$:
|
||||
|
||||
|p/q-x| < |r/s-x| ⇒ q > d
|
||||
$$|\frac{p}{q} - x| < |\frac{r}{s} - x| ⇒ q > d$$
|
||||
|
||||
For example, the best approximation to √13 for the denominator bound 20 is 18/5 and the best approximation to √13 for the denominator bound 30 is 101/28.
|
||||
Ad esempio, la migliore approssimazione a $\sqrt{13}$ per limite del denominatore $20$ è $\frac{18}{5}$ e la migliore approssimazione a $\sqrt{13}$ per limite del denominatore $30$ è $\frac{101}{28}$.
|
||||
|
||||
Find the sum of all denominators of the best approximations to √n for the denominator bound 1012, where n is not a perfect square and 1 < n ≤ 100000.
|
||||
Trova la somma di tutti i denominatori delle migliori approssimazioni a $\sqrt{n}$ per limite del denominatore ${10}^{12}$, dove $n$ non è un quadrato perfetto e $1 < n ≤ 100000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler192()` should return 57060635927998344.
|
||||
`bestApproximations()` dovrebbe restituire `57060635927998344`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler192(), 57060635927998344);
|
||||
assert.strictEqual(bestApproximations(), 57060635927998344);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler192(), 57060635927998344);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler192() {
|
||||
function bestApproximations() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler192();
|
||||
bestApproximations();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f42f1000cf542c50ff41
|
||||
title: 'Problem 193: Squarefree Numbers'
|
||||
title: 'Problema 193: Numeri senza quadrati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301831
|
||||
dashedName: problem-193-squarefree-numbers
|
||||
@ -8,16 +8,16 @@ dashedName: problem-193-squarefree-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A positive integer n is called squarefree, if no square of a prime divides n, thus 1, 2, 3, 5, 6, 7, 10, 11 are squarefree, but not 4, 8, 9, 12.
|
||||
Un numero intero positivo $n$ è chiamato senza quadrati se nessun quadrato di un numero primo divide $n$, così 1, 2, 3, 5, 6, 7, 10, 11 sono senza quadrati, ma non 4, 8, 9, 12.
|
||||
|
||||
How many squarefree numbers are there below 250?
|
||||
Quanti numeri senza quadrati ci sono sotto $2^{50}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler193()` should return 684465067343069.
|
||||
`squarefreeNumbers()` dovrebbe restituire `684465067343069`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler193(), 684465067343069);
|
||||
assert.strictEqual(squarefreeNumbers(), 684465067343069);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +25,12 @@ assert.strictEqual(euler193(), 684465067343069);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler193() {
|
||||
function squarefreeNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler193();
|
||||
squarefreeNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f42f1000cf542c50ff40
|
||||
title: 'Problem 194: Coloured Configurations'
|
||||
title: 'Problema 194: Configurazioni colorate'
|
||||
challengeType: 5
|
||||
forumTopicId: 301832
|
||||
dashedName: problem-194-coloured-configurations
|
||||
@ -8,24 +8,22 @@ dashedName: problem-194-coloured-configurations
|
||||
|
||||
# --description--
|
||||
|
||||
Consider graphs built with the units A:
|
||||
Considera i grafici costruiti con le unità A:
|
||||
<img class="img-responsive" alt="grafico unità A" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-1.png" style="display: inline-block; background-color: white; padding: 10px;" />
|
||||
e B: <img class="img-responsive" alt="graph unit B" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-2.png" style="display: inline-block; background-color: white; padding: 10px;" />, dove le unità sono presentate lungo i bordi verticali come nel grafico <img class="img-responsive" alt="graph with four units glued along the vertical edges" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-3.png" style="display: inline-block; background-color: white; padding: 10px;" />.
|
||||
|
||||
and B: , where the units are glued along
|
||||
Una configurazione di tipo $(a,b,c)$ è un grafico così costruito di $a$ unità A e $b$ unità B, dove i vertici del grafico sono colorati utilizzando fino a $c$ colori, in modo che non vi siano due vertici adiacenti aventi lo stesso colore. Il grafico composto sopra è un esempio di configurazione di tipo $(2,2,6)$, infatti di tipo $(2,2,c)$ per tutti i $c ≥ 4$
|
||||
|
||||
the vertical edges as in the graph .
|
||||
Sia $N(a,b,c)$ il numero di configurazioni di tipo $(a,b,c)$. Ad esempio $N(1,0,3) = 24$, $N(0,2,4) = 92928$ e $N(2,2,3) = 20736$.
|
||||
|
||||
A configuration of type (a,b,c) is a graph thus built of a units A and b units B, where the graph's vertices are coloured using up to c colours, so that no two adjacent vertices have the same colour. The compound graph above is an example of a configuration of type (2,2,6), in fact of type (2,2,c) for all c ≥ 4.
|
||||
|
||||
Let N(a,b,c) be the number of configurations of type (a,b,c). For example, N(1,0,3) = 24, N(0,2,4) = 92928 and N(2,2,3) = 20736.
|
||||
|
||||
Find the last 8 digits of N(25,75,1984).
|
||||
Trova le ultime 8 cifre di $N(25,75,1984)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler194()` should return 61190912.
|
||||
`coloredConfigurations()` dovrebbe restituire `61190912`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler194(), 61190912);
|
||||
assert.strictEqual(coloredConfigurations(), 61190912);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +31,12 @@ assert.strictEqual(euler194(), 61190912);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler194() {
|
||||
function coloredConfigurations() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler194();
|
||||
coloredConfigurations();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4311000cf542c50ff43
|
||||
title: 'Problem 195: Inscribed circles of triangles with one angle of 60 degrees'
|
||||
title: 'Problema 195: Cerchi inscritti in triangoli con un angolo di 60 gradi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301833
|
||||
dashedName: problem-195-inscribed-circles-of-triangles-with-one-angle-of-60-degrees
|
||||
@ -8,24 +8,22 @@ dashedName: problem-195-inscribed-circles-of-triangles-with-one-angle-of-60-degr
|
||||
|
||||
# --description--
|
||||
|
||||
Let's call an integer sided triangle with exactly one angle of 60 degrees a 60-degree triangle.
|
||||
Chiamiamo un triangolo a lati interi con esattamente un angolo di 60° un triangolo a 60°.
|
||||
|
||||
Let r be the radius of the inscribed circle of such a 60-degree triangle.
|
||||
Sia $r$ il raggio del cerchio inscritto di un triangolo a 60°.
|
||||
|
||||
There are 1234 60-degree triangles for which r ≤ 100.
|
||||
Ci sono 1234 triangoli a 60° per i quali $r ≤ 100$.
|
||||
|
||||
Let T(n) be the number of 60-degree triangles for which r ≤ n, so
|
||||
Sia $T(n)$ sia il numero di triangoli a 60° per i quali $r ≤ n$, quindi $T(100) = 1234$, $T(1000) = 22767$, e $T(10000) = 359912$.
|
||||
|
||||
T(100) = 1234, T(1000) = 22767, and T(10000) = 359912.
|
||||
|
||||
Find T(1053779).
|
||||
Trova $T(1053779)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler195()` should return 75085391.
|
||||
`inscribedCirclesOfTriangles()` dovrebbe restituire `75085391`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler195(), 75085391);
|
||||
assert.strictEqual(inscribedCirclesOfTriangles(), 75085391);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +31,12 @@ assert.strictEqual(euler195(), 75085391);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler195() {
|
||||
function inscribedCirclesOfTriangles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler195();
|
||||
inscribedCirclesOfTriangles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4301000cf542c50ff42
|
||||
title: 'Problem 196: Prime triplets'
|
||||
title: 'Problema 196: Triplette di numeri primi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301834
|
||||
dashedName: problem-196-prime-triplets
|
||||
@ -8,30 +8,30 @@ dashedName: problem-196-prime-triplets
|
||||
|
||||
# --description--
|
||||
|
||||
Build a triangle from all positive integers in the following way:
|
||||
Costruisci un triangolo da tutti gli interi positivi nel modo seguente:
|
||||
|
||||
1 2 3 4 5 6 7 8 9 1011 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2829 30 31 32 33 34 35 3637 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 . . .
|
||||
$$\begin{array}{rrr} & 1 \\\\ & \color{red}{2} & \color{red}{3} \\\\ & 4 & \color{red}{5} & 6 \\\\ & \color{red}{7} & 8 & 9 & 10 \\\\ & \color{red}{11} & 12 & \color{red}{13} & 14 & 15 \\\\ & 16 & \color{red}{17} & 18 & \color{red}{19} & 20 & 21 \\\\ & 22 & \color{red}{23} & 24 & 25 & 26 & 27 & 28 \\\\ & \color{red}{29} & 30 & \color{red}{31} & 32 & 33 & 34 & 35 & 36 \\\\ & \color{red}{37} & 38 & 39 & 40 & \color{red}{41} & 42 & \color{red}{43} & 44 & 45 \\\\ & 46 & \color{red}{47} & 48 & 49 & 50 & 51 & 52 & \color{red}{53} & 54 & 55 \\\\ & 56 & 57 & 58 & \color{red}{59} & 60 & \color{red}{61} & 62 & 63 & 64 & 65 & 66 \\\\ & \cdots \end{array}$$
|
||||
|
||||
Each positive integer has up to eight neighbours in the triangle.
|
||||
Ogni numero intero positivo ha fino a otto vicini nel triangolo.
|
||||
|
||||
A set of three primes is called a prime triplet if one of the three primes has the other two as neighbours in the triangle.
|
||||
Un insieme di tre primi è chiamato una tripletta prima se uno dei tre primi ha gli altri due come vicini nel triangolo.
|
||||
|
||||
For example, in the second row, the prime numbers 2 and 3 are elements of some prime triplet.
|
||||
Ad esempio, nella seconda fila, i numeri primi 2 e 3 sono elementi di una tripletta prima.
|
||||
|
||||
If row 8 is considered, it contains two primes which are elements of some prime triplet, i.e. 29 and 31. If row 9 is considered, it contains only one prime which is an element of some prime triplet: 37.
|
||||
Se si considera la riga 8, essa contiene due primi che sono elementi di una tripletta prima, cioè 29 e 31. Se consideriamo la riga 9, essa contiene solo un primo che è un elemento di una tripletta prima: 37.
|
||||
|
||||
Define S(n) as the sum of the primes in row n which are elements of any prime triplet. Then S(8)=60 and S(9)=37.
|
||||
Definisci $S(n)$ come la somma dei numeri primi nella riga $n$ che sono elementi di qualsiasi tripletta prima. Poi $S(8) = 60$ e $S(9) = 37$.
|
||||
|
||||
You are given that S(10000)=950007619.
|
||||
Dato $S(10000) = 950007619$.
|
||||
|
||||
Find S(5678027) + S(7208785).
|
||||
Trova $S(5678027) + S(7208785)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler196()` should return 322303240771079940.
|
||||
`primeTriplets()` dovrebbe restituire `322303240771079940`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler196(), 322303240771079940);
|
||||
assert.strictEqual(primeTriplets(), 322303240771079940);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +39,12 @@ assert.strictEqual(euler196(), 322303240771079940);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler196() {
|
||||
function primeTriplets() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler196();
|
||||
primeTriplets();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4311000cf542c50ff44
|
||||
title: 'Problem 197: Investigating the behaviour of a recursively defined sequence'
|
||||
title: 'Problema 197: Indagare il comportamento di una sequenza definita ricorsivamente'
|
||||
challengeType: 5
|
||||
forumTopicId: 301835
|
||||
dashedName: problem-197-investigating-the-behaviour-of-a-recursively-defined-sequence
|
||||
@ -8,18 +8,16 @@ dashedName: problem-197-investigating-the-behaviour-of-a-recursively-defined-seq
|
||||
|
||||
# --description--
|
||||
|
||||
Given is the function f(x) = ⌊230.403243784-x2⌋ × 10-9 ( ⌊ ⌋ is the floor-function),
|
||||
Data la funzione $f(x) = ⌊{2}^{30. 03243784 - x^2}⌋ × {10}^{-9}$ ( ⌊ ⌋ è la funzione floor), la sequenza $u_n$ è definita da $u_0 = -1$ e $u_{n + 1} = f(u_n)$.
|
||||
|
||||
the sequence un is defined by u0 = -1 and un+1 = f(un).
|
||||
|
||||
Find un + un+1 for n = 1012. Give your answer with 9 digits after the decimal point.
|
||||
Trova $u_n + u_{n + 1}$ per $n = {10}^{12}$. Dai la tua risposta con 9 cifre dopo il punto decimale.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler197()` should return 1.710637717.
|
||||
`recursivelyDefinedSequence()` dovrebbe restituire `1.710637717`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler197(), 1.710637717);
|
||||
assert.strictEqual(recursivelyDefinedSequence(), 1.710637717);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +25,12 @@ assert.strictEqual(euler197(), 1.710637717);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler197() {
|
||||
function recursivelyDefinedSequence() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler197();
|
||||
recursivelyDefinedSequence();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4331000cf542c50ff45
|
||||
title: 'Problem 198: Ambiguous Numbers'
|
||||
title: 'Problema 198: Numeri Ambigui'
|
||||
challengeType: 5
|
||||
forumTopicId: 301836
|
||||
dashedName: problem-198-ambiguous-numbers
|
||||
@ -8,18 +8,18 @@ dashedName: problem-198-ambiguous-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A best approximation to a real number x for the denominator bound d is a rational number r/s (in reduced form) with s ≤ d, so that any rational number p/q which is closer to x than r/s has q > d.
|
||||
Una migliore approssimazione a un numero reale $x$ con il limite del denominatore $d$ è un numero razionale $\frac{r}{s}$ (in forma semplificata) con $s ≤ d$, in modo che qualsiasi numero razionale $\frac{p}{q}$ che è più vicino a $x$ di $\frac{r}{s}$ abbia $q > d$.
|
||||
|
||||
Usually the best approximation to a real number is uniquely determined for all denominator bounds. However, there are some exceptions, e.g. 9/40 has the two best approximations 1/4 and 1/5 for the denominator bound 6. We shall call a real number x ambiguous, if there is at least one denominator bound for which x possesses two best approximations. Clearly, an ambiguous number is necessarily rational.
|
||||
Di solito la migliore approssimazione a un numero reale è determinata univocamente per tutti i limiti del denominatore. Vi sono tuttavia alcune eccezioni, ad es. $\frac{9}{40}$ ha le due migliori approssimazioni $\frac{1}{4}$ e $\frac{1}{5}$ per il limite del denominatore $6$. Chiameremo un numero reale $x$ ambiguo se c'è almeno un limite del denominatore per il quale $x$ possiede due migliori approssimazioni. Chiaramente, un numero ambiguo è necessariamente razionale.
|
||||
|
||||
How many ambiguous numbers x = p/q, 0 < x < 1/100, are there whose denominator q does not exceed 108?
|
||||
Quanti numeri ambigui $x = \frac{p}{q}$, $0 < x < \frac{1}{100}$, ci sono il cui denominatore $q$ non supera ${10}^8$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler198()` should return 52374425.
|
||||
`ambiguousNumbers()` dovrebbe restituire `52374425`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler198(), 52374425);
|
||||
assert.strictEqual(ambiguousNumbers(), 52374425);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler198(), 52374425);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler198() {
|
||||
function ambiguousNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler198();
|
||||
ambiguousNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4341000cf542c50ff46
|
||||
title: 'Problem 199: Iterative Circle Packing'
|
||||
title: 'Problema 199: Impacchettamento iterativo dei cerchi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301837
|
||||
dashedName: problem-199-iterative-circle-packing
|
||||
@ -8,29 +8,29 @@ dashedName: problem-199-iterative-circle-packing
|
||||
|
||||
# --description--
|
||||
|
||||
Three circles of equal radius are placed inside a larger circle such that each pair of circles is tangent to one another and the inner circles do not overlap. There are four uncovered "gaps" which are to be filled iteratively with more tangent circles.
|
||||
Tre cerchi di raggio uguale sono posizionati all'interno di un cerchio più grande in modo che ogni coppia di cerchi sia tangente l'uno all'altro e i cerchi interni non si sovrappongono. Ci sono quattro "lacune" scoperte che devono essere riempite iterativamente con più cerchi tangenti.
|
||||
|
||||
<img class="img-responsive center-block" alt="a diagram of non-overlapping concentric circles" src="https://cdn-media-1.freecodecamp.org/project-euler/199-circles-in-circles.gif" style="background-color: white; padding: 10px;" />
|
||||
<img class="img-responsive center-block" alt="un diagramma di cerchi non sovrapposti" src="https://cdn-media-1.freecodecamp.org/project-euler/199-circles-in-circles.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
At each iteration, a maximally sized circle is placed in each gap, which creates more gaps for the next iteration. After 3 iterations (pictured), there are 108 gaps and the fraction of the area which is not covered by circles is 0.06790342, rounded to eight decimal places.
|
||||
A ogni iterazione viene posto un cerchio di dimensioni massime in ogni divario, che crea più vuoti per la successiva iterazione. Dopo 3 iterazioni (foto), ci sono 108 vuoti e la frazione della zona che non è coperta da cerchi è 0.06790342, arrotondato all’ottavo decimale.
|
||||
|
||||
What fraction of the area is not covered by circles after `n` iterations? Give your answer rounded to eight decimal places using the format x.xxxxxxxx .
|
||||
Quale frazione della zona non è coperta da cerchi dopo `n` iterazioni? Dare la risposta arrotondata a otto decimali utilizzando il formato x.xxxxxxxx .
|
||||
|
||||
# --hints--
|
||||
|
||||
`iterativeCirclePacking(10)` should return a number.
|
||||
`iterativeCirclePacking(10)` dovrebbe restituire un numero.
|
||||
|
||||
```js
|
||||
assert(typeof iterativeCirclePacking(10) === 'number');
|
||||
```
|
||||
|
||||
`iterativeCirclePacking(10)` should return 0.00396087.
|
||||
`iterativeCirclePacking(10)` dovrebbe restituire `0.00396087`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(iterativeCirclePacking(10), 0.00396087);
|
||||
```
|
||||
|
||||
`iterativeCirclePacking(3)` should return 0.06790342.
|
||||
`iterativeCirclePacking(3)` dovrebbe restituire `0.06790342`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(iterativeCirclePacking(3), 0.06790342);
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
id: 5900f4351000cf542c50ff47
|
||||
title: >-
|
||||
Problem 200: Find the 200th prime-proof sqube containing the contiguous sub-string "200"
|
||||
Problema 200: Trova il 200° sqube a prova di primo contenente la sotto-stringa contigua "200"
|
||||
challengeType: 5
|
||||
forumTopicId: 301840
|
||||
dashedName: >-
|
||||
@ -10,22 +10,22 @@ dashedName: >-
|
||||
|
||||
# --description--
|
||||
|
||||
We shall define a sqube to be a number of the form, p2q3, where p and q are distinct primes.
|
||||
Definiamo uno sqube come un numero nella forma ${p^2}{q^3}$, dove $p$ e $q$ sono primi distinti.
|
||||
|
||||
For example, 200 = 5223 or 120072949 = 232613.
|
||||
Ad esempio, $200 = {5^2}{2^3}$ o $120072949 = {{23}^2}{{61}^3}$.
|
||||
|
||||
The first five squbes are 72, 108, 200, 392, and 500.
|
||||
I primi cinque sqube sono 72, 108, 200, 392 e 500.
|
||||
|
||||
Interestingly, 200 is also the first number for which you cannot change any single digit to make a prime; we shall call such numbers, prime-proof. The next prime-proof sqube which contains the contiguous sub-string "200" is 1992008.
|
||||
È interessante notare che 200 è anche il primo numero per il quale non si può cambiare nessuna singola cifra ottenendo un primo; chiameremo tali numeri, "a prova di primo". Il prossimo sqube a prova di primo che contiene la sotto-stringa contigua `200` è 1992008.
|
||||
|
||||
Find the 200th prime-proof sqube containing the contiguous sub-string "200".
|
||||
Trova il 200mo sqube a prova di primo contenente la sotto-stringa contigua `200`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler200()` should return 229161792008.
|
||||
`primeProofSqubeWithSubString()` dovrebbe restituire `229161792008`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler200(), 229161792008);
|
||||
assert.strictEqual(primeProofSqubeWithSubString(), 229161792008);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler200(), 229161792008);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler200() {
|
||||
function primeProofSqubeWithSubString() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler200();
|
||||
primeProofSqubeWithSubString();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4361000cf542c50ff48
|
||||
title: 'Problem 201: Subsets with a unique sum'
|
||||
title: 'Problema 201: Sottoinsiemi con una somma unica'
|
||||
challengeType: 5
|
||||
forumTopicId: 301841
|
||||
dashedName: problem-201-subsets-with-a-unique-sum
|
||||
@ -8,24 +8,24 @@ dashedName: problem-201-subsets-with-a-unique-sum
|
||||
|
||||
# --description--
|
||||
|
||||
For any set A of numbers, let sum(A) be the sum of the elements of A.
|
||||
Per qualsiasi insieme $A$ di numeri, sia $sum(A)$ la somma degli elementi di $A$.
|
||||
|
||||
Consider the set B = {1,3,6,8,10,11}. There are 20 subsets of B containing three elements, and their sums are:
|
||||
Considera l'insieme $B = \\{1,3,6,8,10,11\\}$. Ci sono 20 sottoinsiemi di $B$ contenenti tre elementi, e le loro somme sono:
|
||||
|
||||
sum({1,3,6}) = 10, sum({1,3,8}) = 12, sum({1,3,10}) = 14, sum({1,3,11}) = 15, sum({1,6,8}) = 15, sum({1,6,10}) = 17, sum({1,6,11}) = 18, sum({1,8,10}) = 19, sum({1,8,11}) = 20, sum({1,10,11}) = 22, sum({3,6,8}) = 17, sum({3,6,10}) = 19, sum({3,6,11}) = 20, sum({3,8,10}) = 21, sum({3,8,11}) = 22, sum({3,10,11}) = 24, sum({6,8,10}) = 24, sum({6,8,11}) = 25, sum({6,10,11}) = 27, sum({8,10,11}) = 29.
|
||||
$$\begin{align} & sum(\\{1,3,6\\}) = 10 \\\\ & sum(\\{1,3,8\\}) = 12 \\\\ & sum(\\{1,3,10\\}) = 14 \\\\ & sum(\\{1,3,11\\}) = 15 \\\\ & sum(\\{1,6,8\\}) = 15 \\\\ & sum(\\{1,6,10\\}) = 17 \\\\ & sum(\\{1,6,11\\}) = 18 \\\\ & sum(\\{1,8,10\\}) = 19 \\\\ & sum(\\{1,8,11\\}) = 20 \\\\ & sum(\\{1,10,11\\}) = 22 \\\\ & sum(\\{3,6,8\\}) = 17 \\\\ & sum(\\{3,6,10\\}) = 19 \\\\ & sum(\\{3,6,11\\}) = 20 \\\\ & sum(\\{3,8,10\\}) = 21 \\\\ & sum(\\{3,8,11\\}) = 22 \\\\ & sum(\\{3,10,11\\}) = 24 \\\\ & sum(\\{6,8,10\\}) = 24 \\\\ & sum(\\{6,8,11\\}) = 25 \\\\ & sum(\\{6,10,11\\}) = 27 \\\\ & sum(\\{8,10,11\\}) = 29 \\end{align}$$
|
||||
|
||||
Some of these sums occur more than once, others are unique. For a set A, let U(A,k) be the set of unique sums of k-element subsets of A, in our example we find U(B,3) = {10,12,14,18,21,25,27,29} and sum(U(B,3)) = 156.
|
||||
Alcune di queste somme si verificano più di una volta, altre sono uniche. Per un insieme $A$, sia $U(A,k)$ l'insieme di somme uniche dei sottoinsiemi di $k$ elementi di $A$, nel nostro esempio troviamo $U(B,3) = \\{10,12,14,18,21,25,27,29\\}$ e $sum(U(B,3)) = 156$.
|
||||
|
||||
Now consider the 100-element set S = {12, 22, ... , 1002}. S has 100891344545564193334812497256 50-element subsets.
|
||||
Considera ora l'insieme di $100$ elementi $S = \\{1^2, 2^2, \ldots , {100}^2\\}$. $S$ ha sottoinsiemi di $50$ elementi $100\\,891\\,344\\,545\\,564\\,193\\,334\\,812\\,497\\,256\\;$.
|
||||
|
||||
Determine the sum of all integers which are the sum of exactly one of the 50-element subsets of S, i.e. find sum(U(S,50)).
|
||||
Determina la somma di tutti i numeri interi che sono la somma esatta di uno dei sottoinsiemi di $50$ elementi di $S$, cioè trova $sum(U(S,50)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler201()` should return 115039000.
|
||||
`uniqueSubsetsSum()` dovrebbe restituire `115039000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler201(), 115039000);
|
||||
assert.strictEqual(uniqueSubsetsSum(), 115039000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler201(), 115039000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler201() {
|
||||
function uniqueSubsetsSum() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler201();
|
||||
uniqueSubsetsSum();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4371000cf542c50ff49
|
||||
title: 'Problem 202: Laserbeam'
|
||||
title: 'Problema 202: Raggio Laser'
|
||||
challengeType: 5
|
||||
forumTopicId: 301843
|
||||
dashedName: problem-202-laserbeam
|
||||
@ -8,20 +8,22 @@ dashedName: problem-202-laserbeam
|
||||
|
||||
# --description--
|
||||
|
||||
Three mirrors are arranged in the shape of an equilateral triangle, with their reflective surfaces pointing inwards. There is an infinitesimal gap at each vertex of the triangle through which a laser beam may pass.
|
||||
Tre specchi sono disposti a forma di triangolo equilatero, con le loro superfici riflettenti orientate verso l'interno. C'è un divario infinitesimale a ogni vertice del triangolo attraverso il quale un raggio laser può passare.
|
||||
|
||||
Label the vertices A, B and C. There are 2 ways in which a laser beam may enter vertex C, bounce off 11 surfaces, then exit through the same vertex: one way is shown below; the other is the reverse of that.
|
||||
Etichetta i vertici $A$, $B$ e $C$. Ci sono due modi in cui un raggio laser possa entrare il vertice $C$, rimbalzare su 11 superfici, e quindi uscire attraverso lo stesso vertice: uno di questi è mostrato qua sotto; l'altro è l'inverso di questo.
|
||||
|
||||
There are 80840 ways in which a laser beam may enter vertex C, bounce off 1000001 surfaces, then exit through the same vertex.
|
||||
<img class="img-responsive center-block" alt="un modo in cui il raggio laser possa entrare il vertice C, rimbalzare su 11 superfici e uscire attraverso lo stesso vertice" src="https://cdn.freecodecamp.org/curriculum/project-euler/laserbeam.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
In how many ways can a laser beam enter at vertex C, bounce off 12017639147 surfaces, then exit through the same vertex?
|
||||
Ci sono 80840 modi in cui un raggio laser possa entrare attraverso il vertice $C$, rimbalzare su 100000 superfici, e uscire attraverso lo stesso vertice.
|
||||
|
||||
In quanti modi può un raggio laser entrare nel vertice $C$, rimbalzare su 12017639147 superfici, e poi uscire attraverso lo stesso vertice?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler202()` should return 1209002624.
|
||||
`laserbeam()` dovrebbe restituire `1209002624`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler202(), 1209002624);
|
||||
assert.strictEqual(laserbeam(), 1209002624);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +31,12 @@ assert.strictEqual(euler202(), 1209002624);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler202() {
|
||||
function laserbeam() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler202();
|
||||
laserbeam();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4381000cf542c50ff4a
|
||||
title: 'Problem 203: Squarefree Binomial Coefficients'
|
||||
title: 'Problema 203: Coefficienti binomiali privi di quadrati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301844
|
||||
dashedName: problem-203-squarefree-binomial-coefficients
|
||||
@ -8,22 +8,22 @@ dashedName: problem-203-squarefree-binomial-coefficients
|
||||
|
||||
# --description--
|
||||
|
||||
The binomial coefficients nCk can be arranged in triangular form, Pascal's triangle, like this:
|
||||
I coefficienti binomiali $\displaystyle\binom{n}{k}$ possono essere disposti in forma triangolare (il triangolo di Pascal) in questo modo:
|
||||
|
||||
111121133114641151010511615201561172135352171 .........
|
||||
$$\begin{array}{ccccccccccccccc} & & & & & & & 1 & & & & & & & \\\\ & & & & & & 1 & & 1 & & & & & & \\\\ & & & & & 1 & & 2 & & 1 & & & & & \\\\ & & & & 1 & & 3 & & 3 & & 1 & & & & \\\\ & & & 1 & & 4 & & 6 & & 4 & & 1 & & & \\\\ & & 1 & & 5 & & 10 & & 10 & & 5 & & 1 & & \\\\ & 1 & & 6 & & 15 & & 20 & & 15 & & 6 & & 1 & \\\\ 1 & & 7 & & 21 & & 35 & & 35 & & 21 & & 7 & & 1 \\\\ & & & & & & & \ldots \end{array}$$
|
||||
|
||||
It can be seen that the first eight rows of Pascal's triangle contain twelve distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35.
|
||||
Si può notare che le prime otto righe del triangolo di Pascal contengono dodici numeri distinti: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 e 35.
|
||||
|
||||
A positive integer n is called squarefree if no square of a prime divides n. Of the twelve distinct numbers in the first eight rows of Pascal's triangle, all except 4 and 20 are squarefree. The sum of the distinct squarefree numbers in the first eight rows is 105.
|
||||
Un numero intero positivo è detto privo di quadrati se nessun quadrato di un primo divide n. Dei dodici numeri distinti nelle prime otto file del triangolo di Pascal, tutti tranne 4 e 20 sono privi di quadrati. La somma dei numeri privi di quadrati distinti nelle prime otto righe è 105.
|
||||
|
||||
Find the sum of the distinct squarefree numbers in the first 51 rows of Pascal's triangle.
|
||||
Trova la somma dei numeri privi di quadrati distinti nelle prime 51 righe del triangolo di Pascal.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler203()` should return 34029210557338.
|
||||
`squarefreeBinomialCoefficients()` dovrebbe restituire `34029210557338`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler203(), 34029210557338);
|
||||
assert.strictEqual(squarefreeBinomialCoefficients(), 34029210557338);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler203(), 34029210557338);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler203() {
|
||||
function squarefreeBinomialCoefficients() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler203();
|
||||
squarefreeBinomialCoefficients();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4381000cf542c50ff4b
|
||||
title: 'Problem 204: Generalised Hamming Numbers'
|
||||
title: 'Problema 204: Numeri Di Hamming generalizzati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301845
|
||||
dashedName: problem-204-generalised-hamming-numbers
|
||||
@ -8,22 +8,22 @@ dashedName: problem-204-generalised-hamming-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A Hamming number is a positive number which has no prime factor larger than 5.
|
||||
Un numero di Hamming è un numero positivo che non ha un fattore primo maggiore di 5.
|
||||
|
||||
So the first few Hamming numbers are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15.
|
||||
Così i primi numeri di Hamming sono 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15.
|
||||
|
||||
There are 1105 Hamming numbers not exceeding 108.
|
||||
Ci sono 1105 numeri di Hamming non superiori a ${10}^8$.
|
||||
|
||||
We will call a positive number a generalised Hamming number of type n, if it has no prime factor larger than n. Hence the Hamming numbers are the generalised Hamming numbers of type 5.
|
||||
Chiameremo un numero positivo un numero generalizzato di Hamming di tipo $n$, se non ha un fattore primo maggiore di $n$. Di conseguenza, i numeri di Hamming sono i numeri di Hamming generalizzati di tipo 5.
|
||||
|
||||
How many generalised Hamming numbers of type 100 are there which don't exceed 109?
|
||||
Quanti numeri di Hamming generalizzati di tipo 100 ci sono che non superano ${10}^9$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler204()` should return 2944730.
|
||||
`generalisedHammingNumbers()` dovrebbe restituire `2944730`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler204(), 2944730);
|
||||
assert.strictEqual(generalisedHammingNumbers(), 2944730);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler204(), 2944730);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler204() {
|
||||
function generalisedHammingNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler204();
|
||||
generalisedHammingNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4391000cf542c50ff4c
|
||||
title: 'Problem 205: Dice Game'
|
||||
title: 'Problema 205: Gioco Dei Dadi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301846
|
||||
dashedName: problem-205-dice-game
|
||||
@ -8,20 +8,20 @@ dashedName: problem-205-dice-game
|
||||
|
||||
# --description--
|
||||
|
||||
Peter has nine four-sided (pyramidal) dice, each with faces numbered 1, 2, 3, 4.
|
||||
Peter ha nove dadi a quattro facce (piramidali), ciascuno con facce numerate 1, 2, 3, 4.
|
||||
|
||||
Colin has six six-sided (cubic) dice, each with faces numbered 1, 2, 3, 4, 5, 6.
|
||||
Colin ha sei dadi a sei facce (cubici), ciascuno con facce numerate 1, 2, 3, 4, 5, 6.
|
||||
|
||||
Peter and Colin roll their dice and compare totals: the highest total wins. The result is a draw if the totals are equal.
|
||||
Peter e Colin rotolano i loro dadi e confrontano i totali: il totale più alto vince. Il risultato è un pareggio se i totali sono uguali.
|
||||
|
||||
What is the probability that Pyramidal Pete beats Cubic Colin? Give your answer rounded to seven decimal places in the form 0.abcdefg
|
||||
Qual è la probabilità che Pete Piramidale batta Colin Cubico? Dai la risposta arrotondata a sette decimali nella forma 0.abcdefg
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler205()` should return 0.5731441.
|
||||
`diceGame()` dovrebbe restituire `0.5731441`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler205(), 0.5731441);
|
||||
assert.strictEqual(diceGame(), 0.5731441);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler205(), 0.5731441);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler205() {
|
||||
function diceGame() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler205();
|
||||
diceGame();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f43a1000cf542c50ff4d
|
||||
title: 'Problem 206: Concealed Square'
|
||||
title: 'Problema 206: Quadrato Nascosto'
|
||||
challengeType: 5
|
||||
forumTopicId: 301847
|
||||
dashedName: problem-206-concealed-square
|
||||
@ -8,14 +8,14 @@ dashedName: problem-206-concealed-square
|
||||
|
||||
# --description--
|
||||
|
||||
Find the unique positive integer whose square has the form 1_2_3_4_5_6_7_8_9_0, where each “\_” is a single digit.
|
||||
Trova l'intero positivo univoco il cui quadrato ha la forma 1_2_3_4_5_6_7_8_9_0, dove ogni "_" è un singolo numero.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler206()` should return 1389019170.
|
||||
`concealedSquare()` dovrebbe restituire `1389019170`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler206(), 1389019170);
|
||||
assert.strictEqual(concealedSquare(), 1389019170);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -23,12 +23,12 @@ assert.strictEqual(euler206(), 1389019170);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler206() {
|
||||
function concealedSquare() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler206();
|
||||
concealedSquare();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f43c1000cf542c50ff4e
|
||||
title: 'Problem 207: Integer partition equations'
|
||||
title: 'Problema 207: Equazioni di partizione di numeri interi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301848
|
||||
dashedName: problem-207-integer-partition-equations
|
||||
@ -8,24 +8,28 @@ dashedName: problem-207-integer-partition-equations
|
||||
|
||||
# --description--
|
||||
|
||||
For some positive integers k, there exists an integer partition of the form 4t = 2t + k,
|
||||
Per alcuni numeri interi positivi $k$ esiste una partizione intera del modulo $4^t = 2^t + k$,
|
||||
|
||||
where 4t, 2t, and k are all positive integers and t is a real number.
|
||||
dove $4^t$, $2^t$, e $k$ sono tutti interi positivi e $t$ è un numero reale.
|
||||
|
||||
The first two such partitions are 41 = 21 + 2 and 41.5849625... = 21.5849625... + 6.
|
||||
Le prime due partizioni sono $4^1 = 2^1 + 2$ and $4^{1.584\\,962\\,5\ldots} = 2^{1.584\\,962\\,5\ldots} + 6$.
|
||||
|
||||
Partitions where t is also an integer are called perfect. For any m ≥ 1 let P(m) be the proportion of such partitions that are perfect with k ≤ m. Thus P(6) = 1/2.
|
||||
Le partizioni dove $t$ è anche un intero sono chiamate perfette. Per ogni $m ≥ 1$ sia $P(m)$ la proporzione di tali partizioni che sono perfette con $k ≤ m$.
|
||||
|
||||
In the following table are listed some values of P(m) P(5) = 1/1 P(10) = 1/2 P(15) = 2/3 P(20) = 1/2 P(25) = 1/2 P(30) = 2/5 ... P(180) = 1/4 P(185) = 3/13
|
||||
Così $P(6) = \frac{1}{2}$.
|
||||
|
||||
Find the smallest m for which P(m) < 1/12345
|
||||
Nella tabella seguente sono elencati alcuni valori di $P(m)$
|
||||
|
||||
$$\begin{align} & P(5) = \frac{1}{1} \\\\ & P(10) = \frac{1}{2} \\\\ & P(15) = \frac{2}{3} \\\\ & P(20) = \frac{1}{2} \\\\ & P(25) = \frac{1}{2} \\\\ & P(30) = \frac{2}{5} \\\\ & \ldots \\\\ & P(180) = \frac{1}{4} \\\\ & P(185) = \frac{3}{13} \end{align}$$
|
||||
|
||||
Trova il più piccolo $m$ per il quale $P(m) < \frac{1}{12\\,345}
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler207()` should return 44043947822.
|
||||
`integerPartitionEquations()` dovrebbe restituire `44043947822`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler207(), 44043947822);
|
||||
assert.strictEqual(integerPartitionEquations(), 44043947822);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +37,12 @@ assert.strictEqual(euler207(), 44043947822);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler207() {
|
||||
function integerPartitionEquations() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler207();
|
||||
integerPartitionEquations();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f43f1000cf542c50ff51
|
||||
title: 'Problem 208: Robot Walks'
|
||||
title: 'Problema 208: Passeggiate Robot'
|
||||
challengeType: 5
|
||||
forumTopicId: 301849
|
||||
dashedName: problem-208-robot-walks
|
||||
@ -8,18 +8,22 @@ dashedName: problem-208-robot-walks
|
||||
|
||||
# --description--
|
||||
|
||||
A robot moves in a series of one-fifth circular arcs (72°), with a free choice of a clockwise or an anticlockwise arc for each step, but no turning on the spot.
|
||||
Un robot si muove in una serie di archi di un quinto di cerchio (72°), con la scelta libera di fare l'arco in senso orario o antiorario per ogni step, ma senza potersi girare sul posto.
|
||||
|
||||
One of 70932 possible closed paths of 25 arcs starting northward is
|
||||
Uno dei possibili 70932 percorsi chiusi di 25 archi iniziando verso nord è
|
||||
|
||||
Given that the robot starts facing North, how many journeys of 70 arcs in length can it take that return it, after the final arc, to its starting position? (Any arc may be traversed multiple times.)
|
||||
<img class="img-responsive center-block" alt="percorso chiuso di 25 archi, iniziando verso nord" src="https://cdn.freecodecamp.org/curriculum/project-euler/robot-walks.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Dato che il robot inizia guardando verso nord, quanti viaggi di 70 archi di lunghezza può fare per tornare, dopo l'arco finale, alla sua posizione di partenza?
|
||||
|
||||
**Nota:** Qualsiasi arco può essere attraversato più volte.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler208()` should return 331951449665644800.
|
||||
`robotWalks()` dovrebbe restituire `331951449665644800`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler208(), 331951449665644800);
|
||||
assert.strictEqual(robotWalks(), 331951449665644800);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +31,12 @@ assert.strictEqual(euler208(), 331951449665644800);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler208() {
|
||||
function robotWalks() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler208();
|
||||
robotWalks();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f43e1000cf542c50ff4f
|
||||
title: 'Problem 209: Circular Logic'
|
||||
title: 'Problema 209: Logica Circolare'
|
||||
challengeType: 5
|
||||
forumTopicId: 301850
|
||||
dashedName: problem-209-circular-logic
|
||||
@ -8,20 +8,34 @@ dashedName: problem-209-circular-logic
|
||||
|
||||
# --description--
|
||||
|
||||
A k-input binary truth table is a map from k input bits
|
||||
Una tabella della verità binaria $k$-input è una mappa da un input a $k$ bit (cifre binarie, 0 [false] o 1 [true]) a 1 bit di output. Per esempio, le tabelle binarie della verità a $2$ bit di input per le funzioni logiche $AND$ e $XOR$ sono:
|
||||
|
||||
(binary digits, 0 \[false] or 1 \[true]) to 1 output bit. For example, the 2-input binary truth tables for the logical AND and XOR functions are:
|
||||
| x | y | x AND y |
|
||||
| - | - | ------- |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 |
|
||||
| 1 | 0 | 0 |
|
||||
| 1 | 1 | 1 |
|
||||
|
||||
x y x AND y000010100111x y x XOR y000011101110How many 6-input binary truth tables, τ, satisfy the formula
|
||||
| x | y | x XOR y |
|
||||
| - | - | ------- |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 |
|
||||
|
||||
τ(a, b, c, d, e, f) AND τ(b, c, d, e, f, a XOR (b AND c)) = 0 for all 6-bit inputs (a, b, c, d, e, f)?
|
||||
Quante tabelle binarie della verità a $6$ bit di input, $τ$, soddisfano la formula
|
||||
|
||||
$$τ(a, b, c, d, e, f) \\; AND \\; τ(b, c, d, e, f, a \\; XOR \\; (b \\; AND \\; c)) = 0$$
|
||||
|
||||
per tutti gli input a $6$ bit ($a$, $b$, $c$, $d$, $e$, $f$)?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler209()` should return 15964587728784.
|
||||
`circularLogic()` dovrebbe restituire `15964587728784`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler209(), 15964587728784);
|
||||
assert.strictEqual(circularLogic(), 15964587728784);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +43,12 @@ assert.strictEqual(euler209(), 15964587728784);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler209() {
|
||||
function circularLogic() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler209();
|
||||
circularLogic();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f43e1000cf542c50ff50
|
||||
title: 'Problem 210: Obtuse Angled Triangles'
|
||||
title: 'Problema 210: Triangoli con angoli ottusi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301852
|
||||
dashedName: problem-210-obtuse-angled-triangles
|
||||
@ -8,22 +8,22 @@ dashedName: problem-210-obtuse-angled-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the set S(r) of points (x,y) with integer coordinates satisfying |x| + |y| ≤ r.
|
||||
Considera il set $S(r)$ di punti ($x$, $y$) con numeri interi come coordinate che soddisfano $|x| + |y| ≤ r$.
|
||||
|
||||
Let O be the point (0,0) and C the point (r/4,r/4).
|
||||
Sia $O$ il punto (0,0) e $C$ il punto ($\frac{r}{4}$,$\frac{r}{4}$).
|
||||
|
||||
Let N(r) be the number of points B in S(r), so that the triangle OBC has an obtuse angle, i.e. the largest angle α satisfies 90°<α<180°.
|
||||
Sia $N(r)$ il numeri di punti $B$ in $S(r)$, cosicché il triangolo $OBC$ abbia un angolo ottuso, cioè l'angolo più grande $α$ soddisfa $90°<α<180°$.
|
||||
|
||||
So, for example, N(4)=24 and N(8)=100.
|
||||
Per esempio, $N(4)=24$ e $N(8)=100$.
|
||||
|
||||
What is N(1,000,000,000)?
|
||||
Cos'è $N(1\\,000\\,000\\,000)$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler210()` should return 1598174770174689500.
|
||||
`obtuseAngledTriangles()` dovrebbe restituire `1598174770174689500`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler210(), 1598174770174689500);
|
||||
assert.strictEqual(obtuseAngledTriangles(), 1598174770174689500);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler210(), 1598174770174689500);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler210() {
|
||||
function obtuseAngledTriangles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler210();
|
||||
obtuseAngledTriangles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f43f1000cf542c50ff52
|
||||
title: 'Problem 211: Divisor Square Sum'
|
||||
title: 'Problema 211: Somma dei quadrati dei divisori'
|
||||
challengeType: 5
|
||||
forumTopicId: 301853
|
||||
dashedName: problem-211-divisor-square-sum
|
||||
@ -8,18 +8,18 @@ dashedName: problem-211-divisor-square-sum
|
||||
|
||||
# --description--
|
||||
|
||||
For a positive integer n, let σ2(n) be the sum of the squares of its divisors. For example,
|
||||
Per un numero intero positivo $n$, sia $σ_2(n)$ la somma dei quadrati dei suoi divisori. Ad esempio,
|
||||
|
||||
σ2(10) = 1 + 4 + 25 + 100 = 130.
|
||||
$$σ_2(10) = 1 + 4 + 25 + 100 = 130$$
|
||||
|
||||
Find the sum of all n, 0 < n < 64,000,000 such that σ2(n) is a perfect square.
|
||||
Trova la somma di tutti i $n$, $0 < n < 64\\,000\\,000$ tali che $σ_2(n)$ sia un quadrato perfetto.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler211()` should return 1922364685.
|
||||
`divisorSquareSum()` dovrebbe restituire `1922364685`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler211(), 1922364685);
|
||||
assert.strictEqual(divisorSquareSum(), 1922364685);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler211(), 1922364685);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler211() {
|
||||
function divisorSquareSum() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler211();
|
||||
divisorSquareSum();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4411000cf542c50ff53
|
||||
title: 'Problem 212: Combined Volume of Cuboids'
|
||||
title: 'Problema 212: Volume combinato di cuboidi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301854
|
||||
dashedName: problem-212-combined-volume-of-cuboids
|
||||
@ -8,28 +8,30 @@ dashedName: problem-212-combined-volume-of-cuboids
|
||||
|
||||
# --description--
|
||||
|
||||
An axis-aligned cuboid, specified by parameters { (x0,y0,z0), (dx,dy,dz) }, consists of all points (X,Y,Z) such that x0 ≤ X ≤ x0+dx, y0 ≤ Y ≤ y0+dy and z0 ≤ Z ≤ z0+dz. The volume of the cuboid is the product, dx × dy × dz. The combined volume of a collection of cuboids is the volume of their union and will be less than the sum of the individual volumes if any cuboids overlap.
|
||||
Un cuboid allineato all'asse, specificato dai parametri $\{ (x_0,y_0,z_0), (dx,dy,dz) \}$, è costituito da tutti i punti ($X$,$Y$,$Z$) tali che $x_0 ≤ X ≤ x_0 + dx$, $y_0 ≤ Y ≤ y_0 + dy$ e $z_0 ≤ Z ≤ z_0 + dz$. Il volume del cuboide è il prodotto, $dx × dy × dz$. Il volume combinato di una collezione di cuboidi è il volume della loro unione e sarà inferiore alla somma dei singoli volumi se eventuali cuboidi si sovrappongono.
|
||||
|
||||
Let C1,...,C50000 be a collection of 50000 axis-aligned cuboids such that Cn has parameters
|
||||
Sia $C_1, \ldots, C_{50000}$ una collezione di 50000 cuboidi allineati assialmente in modo che $C_n$ abbia parametri
|
||||
|
||||
x0 = S6n-5 modulo 10000y0 = S6n-4 modulo 10000z0 = S6n-3 modulo 10000dx = 1 + (S6n-2 modulo 399)dy = 1 + (S6n-1 modulo 399)dz = 1 + (S6n modulo 399)
|
||||
$$\begin{align} & x_0 = S_{6n - 5} \\; \text{modulo} \\; 10000 \\\\ & y_0 = S_{6n - 4} \\; \text{modulo} \\; 10000 \\\\ & z_0 = S_{6n - 3} \\; \text{modulo} \\; 10000 \\\\ & dx = 1 + (S_{6n - 2} \\; \text{modulo} \\; 399) \\\\ & dy = 1 + (S_{6n - 1} \\; \text{modulo} \\; 399) \\\\ & dz = 1 + (S_{6n} \\; \text{modulo} \\; 399) \\\\ \end{align}$$
|
||||
|
||||
where S1,...,S300000 come from the "Lagged Fibonacci Generator":
|
||||
dove $S_1, \ldots, S_{300000}$ provengono dal "Lagged Fibonacci Generator":
|
||||
|
||||
For 1 ≤ k ≤ 55, Sk = \[100003 - 200003k + 300007k3] (modulo 1000000)For 56 ≤ k, Sk = \[Sk-24 + Sk-55] (modulo 1000000)
|
||||
Per $1 ≤ k ≤ 55$, $S_k = [100003 - 200003k + 300007k^3] \\; (modulo \\; 1000000)$
|
||||
|
||||
Thus, C1 has parameters {(7,53,183),(94,369,56)}, C2 has parameters {(2383,3563,5079),(42,212,344)}, and so on.
|
||||
Per $56 ≤ k$, $S_k = [S_{k - 24} + S_{k - 55}] \\; (modulo \\; 1000000)$
|
||||
|
||||
The combined volume of the first 100 cuboids, C1,...,C100, is 723581599.
|
||||
Così, $C_1$ ha parametri $\{(7,53,183), (94,369,56)\}$, $C_2$ ha parametri $\{(2383,3563,5079), (42,212,344)\}$, e così via.
|
||||
|
||||
What is the combined volume of all 50000 cuboids, C1,...,C50000 ?
|
||||
Il volume combinato dei primi 100 cuboidi, $C_1, \ldots, C_{100}$, è 723581599.
|
||||
|
||||
Qual è il volume combinato di tutti i 50000 cuboids, $C_1, \ldots, C_{50000}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler212()` should return 328968937309.
|
||||
`combinedValueOfCuboids()` dovrebbe restituire `328968937309`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler212(), 328968937309);
|
||||
assert.strictEqual(combinedValueOfCuboids(), 328968937309);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -37,12 +39,12 @@ assert.strictEqual(euler212(), 328968937309);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler212() {
|
||||
function combinedValueOfCuboids() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler212();
|
||||
combinedValueOfCuboids();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4411000cf542c50ff54
|
||||
title: 'Problem 213: Flea Circus'
|
||||
title: 'Problema 213: Circo delle Pulci'
|
||||
challengeType: 5
|
||||
forumTopicId: 301855
|
||||
dashedName: problem-213-flea-circus
|
||||
@ -8,18 +8,18 @@ dashedName: problem-213-flea-circus
|
||||
|
||||
# --description--
|
||||
|
||||
A 30×30 grid of squares contains 900 fleas, initially one flea per square.
|
||||
Una griglia di 30×30 quadrati contiene 900 pulci, inizialmente una pulce per quadrato.
|
||||
|
||||
When a bell is rung, each flea jumps to an adjacent square at random (usually 4 possibilities, except for fleas on the edge of the grid or at the corners).
|
||||
Quando una campana viene suonata, ogni pulce salta in un quadrato adiacente a caso (di solito quattro possibilità, a eccezione delle pulci sul bordo della griglia o negli angoli).
|
||||
|
||||
What is the expected number of unoccupied squares after 50 rings of the bell? Give your answer rounded to six decimal places.
|
||||
Qual è il numero previsto di quadrati non occupati dopo 50 rintocchi della campana? Dai la risposta arrotondata a sei decimali.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler213()` should return 330.721154.
|
||||
`fleaCircus()` dovrebbe restituire `330.721154`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler213(), 330.721154);
|
||||
assert.strictEqual(fleaCircus(), 330.721154);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler213(), 330.721154);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler213() {
|
||||
function fleaCircus() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler213();
|
||||
fleaCircus();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4421000cf542c50ff55
|
||||
title: 'Problem 214: Totient Chains'
|
||||
title: 'Problema 214: Catene tozienti'
|
||||
challengeType: 5
|
||||
forumTopicId: 301856
|
||||
dashedName: problem-214-totient-chains
|
||||
@ -8,24 +8,22 @@ dashedName: problem-214-totient-chains
|
||||
|
||||
# --description--
|
||||
|
||||
Let φ be Euler's totient function, i.e. for a natural number n,
|
||||
Sia $φ$ la funzione toziente di Eulero, cioè per un numero naturale $n$, $φ(n)$ è il numero di $k$, $1 ≤ k ≤ n$, per cui $gcd(k,n) = 1$.
|
||||
|
||||
φ(n) is the number of k, 1 ≤ k ≤ n, for which gcd(k,n) = 1.
|
||||
Iterando $φ$, ogni numero intero positivo genera una serie decrescente di numeri che termina con 1. Ad es. se iniziamo con 5 viene generata la sequenza 5,4,2,1. Ecco un elenco di tutte le catene con lunghezza 4:
|
||||
|
||||
By iterating φ, each positive integer generates a decreasing chain of numbers ending in 1. E.g. if we start with 5 the sequence 5,4,2,1 is generated. Here is a listing of all chains with length 4:
|
||||
$$\begin{align} 5,4,2,1 & \\\\ 7,6,2,1 & \\\\ 8,4,2,1 & \\\\ 9,6,2,1 & \\\\ 10,4,2,1 & \\\\ 12,4,2,1 & \\\\ 14,6,2,1 & \\\\ 18,6,2,1 & \end{align}$$
|
||||
|
||||
5,4,2,1 7,6,2,1 8,4,2,1 9,6,2,1 10,4,2,1 12,4,2,1 14,6,2,1 18,6,2,1
|
||||
Solo due di queste catene iniziano con un primo, la loro somma è 12.
|
||||
|
||||
Only two of these chains start with a prime, their sum is 12.
|
||||
|
||||
What is the sum of all primes less than 40000000 which generate a chain of length 25?
|
||||
Qual è la somma di tutti i primi inferiori a $40\\,000\\,000$ che generano una catena di lunghezza 25?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler214()` should return 1677366278943.
|
||||
`totientChains()` dovrebbe restituire `1677366278943`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler214(), 1677366278943);
|
||||
assert.strictEqual(totientChains(), 1677366278943);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +31,12 @@ assert.strictEqual(euler214(), 1677366278943);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler214() {
|
||||
function totientChains() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler214();
|
||||
totientChains();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4431000cf542c50ff56
|
||||
title: 'Problem 215: Crack-free Walls'
|
||||
title: 'Problema 215: Muri senza fenditure'
|
||||
challengeType: 5
|
||||
forumTopicId: 301857
|
||||
dashedName: problem-215-crack-free-walls
|
||||
@ -8,20 +8,22 @@ dashedName: problem-215-crack-free-walls
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the problem of building a wall out of 2×1 and 3×1 bricks (horizontal×vertical dimensions) such that, for extra strength, the gaps between horizontally-adjacent bricks never line up in consecutive layers, i.e. never form a "running crack".
|
||||
Considera il problema della costruzione di un muro con mattoni 2×1 e 3×1 (dimensioni orizzontali × verticali) tale che, per maggiore resistenza, gli spazi tra mattoni orizzontalmente adiacenti non si allineino mai in strati consecutivi, cioè non si deve mai formare una "fenditura corrente".
|
||||
|
||||
For example, the following 9×3 wall is not acceptable due to the running crack shown in red:
|
||||
Ad esempio, la seguente parete 9×3 non è accettabile a causa della fenditura corrente mostrata in rosso:
|
||||
|
||||
There are eight ways of forming a crack-free 9×3 wall, written W(9,3) = 8.
|
||||
<img class="img-responsive center-block" alt="Parete 9x3 con uno spazio allineato tra mattoni orizzontalmente adiacenti" src="https://cdn.freecodecamp.org/curriculum/project-euler/crack-free-walls.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Calculate W(32,10).
|
||||
Ci sono otto modi per formare un muro senza fenditure 9×3, che possiamo scrivere come $W(9,3) = 8$.
|
||||
|
||||
Calcola $W(32,10)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler215()` should return 806844323190414.
|
||||
`crackFreeWalls()` dovrebbe restituire `806844323190414`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler215(), 806844323190414);
|
||||
assert.strictEqual(crackFreeWalls(), 806844323190414);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +31,12 @@ assert.strictEqual(euler215(), 806844323190414);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler215() {
|
||||
function crackFreeWalls() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler215();
|
||||
crackFreeWalls();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4451000cf542c50ff57
|
||||
title: 'Problem 216: Investigating the primality of numbers of the form 2n2-1'
|
||||
title: 'Problema 216: Indagare la primalità dei numeri nella forma 2n2-1'
|
||||
challengeType: 5
|
||||
forumTopicId: 301858
|
||||
dashedName: problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1
|
||||
@ -8,22 +8,22 @@ dashedName: problem-216-investigating-the-primality-of-numbers-of-the-form-2n2-1
|
||||
|
||||
# --description--
|
||||
|
||||
Consider numbers t(n) of the form t(n) = 2n2-1 with n > 1.
|
||||
Considera i numeri $t(n)$ nella forma $t(n) = 2n^2 - 1$ con $n > 1$.
|
||||
|
||||
The first such numbers are 7, 17, 31, 49, 71, 97, 127 and 161.
|
||||
I primi di questi numeri sono 7, 17, 31, 49, 71, 97, 127 e 161.
|
||||
|
||||
It turns out that only 49 = 7\*7 and 161 = 7\*23 are not prime.
|
||||
Si scopre che solo $49 = 7 \tvolte 7$ e $161 = 7 \tvolte 23$ non sono primi.
|
||||
|
||||
For n ≤ 10000 there are 2202 numbers t(n) that are prime.
|
||||
Per $n ≤ 10000$ ci sono 2202 numeri $t(n)$ che sono primi.
|
||||
|
||||
How many numbers t(n) are prime for n ≤ 50,000,000 ?
|
||||
Quanti numeri $t(n)$ sono primi per $n ≤ 50\\,000\\,000$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler216()` should return 5437849.
|
||||
`primalityOfNumbers()` dovrebbe restituire `5437849`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler216(), 5437849);
|
||||
assert.strictEqual(primalityOfNumbers(), 5437849);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler216(), 5437849);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler216() {
|
||||
function primalityOfNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler216();
|
||||
primalityOfNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4461000cf542c50ff58
|
||||
title: 'Problem 217: Balanced Numbers'
|
||||
title: 'Problema 217: Numeri Bilanciati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301859
|
||||
dashedName: problem-217-balanced-numbers
|
||||
@ -8,22 +8,22 @@ dashedName: problem-217-balanced-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A positive integer with k (decimal) digits is called balanced if its first ⌈k/2⌉ digits sum to the same value as its last ⌈k/2⌉ digits, where ⌈x⌉, pronounced ceiling of x, is the smallest integer ≥ x, thus ⌈π⌉ = 4 and ⌈5⌉ = 5.
|
||||
Un numero intero positivo con $k$ cifre decimali è chiamato bilanciato se la somma delle sue prime $⌈\frac{k}{2}⌉$ cifre è pari a quella delle sue ultime $⌈\frac{k}{2}⌉$ dove $⌈x⌉$, detto ceiling di $x$, è il più piccolo intero $≥ x$, quindi $⌈π⌉ = 4$ e $⌈5⌉ = 5$.
|
||||
|
||||
So, for example, all palindromes are balanced, as is 13722.
|
||||
Così, per esempio, tutti i palindromi sono bilanciati, come lo è 13722.
|
||||
|
||||
Let T(n) be the sum of all balanced numbers less than 10n.
|
||||
Sia $T(n)$ la somma di tutti i numeri bilanciati minori di $10^n$.
|
||||
|
||||
Thus: T(1) = 45, T(2) = 540 and T(5) = 334795890.
|
||||
Così: $T(1) = 45$, $T(2) = 540$ e $T(5) = 334\\,795\\,890$.
|
||||
|
||||
Find T(47) mod 315
|
||||
Trova $T(47)\\,mod\\,3^{15}$
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler217()` should return 6273134.
|
||||
`balancedNumbers()` dovrebbe restituire `6273134`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler217(), 6273134);
|
||||
assert.strictEqual(balancedNumbers(), 6273134);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler217(), 6273134);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler217() {
|
||||
function balancedNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler217();
|
||||
balancedNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4461000cf542c50ff59
|
||||
title: 'Problem 218: Perfect right-angled triangles'
|
||||
title: 'Problema 218: triangoli rettangoli perfetti'
|
||||
challengeType: 5
|
||||
forumTopicId: 301860
|
||||
dashedName: problem-218-perfect-right-angled-triangles
|
||||
@ -8,26 +8,32 @@ dashedName: problem-218-perfect-right-angled-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the right angled triangle with sides a=7, b=24 and c=25.
|
||||
Considera il triangolo rettangolo con lati $a=7$, $b=24$ e $c=25$.
|
||||
|
||||
The area of this triangle is 84, which is divisible by the perfect numbers 6 and 28.
|
||||
L'area di questo triangolo è 84, che è divisibile per i numeri perfetti 6 e 28.
|
||||
|
||||
Moreover it is a primitive right angled triangle as gcd(a,b)=1 and gcd(b,c)=1.
|
||||
In più è un triangolo rettangolo primitivo visto che $gcd(a,b) = 1$ e $gcd(b,c) = 1$.
|
||||
|
||||
Also c is a perfect square.
|
||||
In più $c$ è un triangolo perfetto.
|
||||
|
||||
We will call a right angled triangle perfect if -it is a primitive right angled triangle -its hypotenuse is a perfect square
|
||||
Chiamiamo un triangolo rettangolo perfetto se:
|
||||
|
||||
We will call a right angled triangle super-perfect if -it is a perfect right angled triangle and -its area is a multiple of the perfect numbers 6 and 28.
|
||||
- è un triangolo rettangolo positivo
|
||||
- l'ipotenusa è un quadrato perfetto
|
||||
|
||||
How many perfect right-angled triangles with c≤1016 exist that are not super-perfect?
|
||||
Chiamiamo un triangolo rettangolo super-perfetto se:
|
||||
|
||||
- è un triangolo rettangolo perfetto
|
||||
- la sua zona è un multiplo dei numeri perfetti 6 e 28.
|
||||
|
||||
Quanti triangoli rettangoli perfetti con $c ≤ {10}^{16}$ esistono che non sono super-perfetti?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler218()` should return 0.
|
||||
`perfectRightAngledTriangles()` dovrebbe restituire `0`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler218(), 0);
|
||||
assert.strictEqual(perfectRightAngledTriangles(), 0);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +41,12 @@ assert.strictEqual(euler218(), 0);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler218() {
|
||||
function perfectRightAngledTriangles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler218();
|
||||
perfectRightAngledTriangles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4481000cf542c50ff5a
|
||||
title: 'Problem 219: Skew-cost coding'
|
||||
title: 'Problema 219: Codifica Skew-cost'
|
||||
challengeType: 5
|
||||
forumTopicId: 301861
|
||||
dashedName: problem-219-skew-cost-coding
|
||||
@ -8,26 +8,26 @@ dashedName: problem-219-skew-cost-coding
|
||||
|
||||
# --description--
|
||||
|
||||
Let A and B be bit strings (sequences of 0's and 1's).
|
||||
$A$ e $B$ siano stringhe di bit (sequenze di 0 e 1).
|
||||
|
||||
If A is equal to the leftmost length(A) bits of B, then A is said to be a prefix of B.
|
||||
Se $A$ è uguale ai ($A$)<u>bit di sinistra</u> di $B$, $A$ si dice un prefisso di $B$.
|
||||
|
||||
For example, 00110 is a prefix of 001101001, but not of 00111 or 100110.
|
||||
Ad esempio, 00110 è un prefisso di <u>00110</u>1001, ma non di 00111 o 100110.
|
||||
|
||||
A prefix-free code of size n is a collection of n distinct bit strings such that no string is a prefix of any other. For example, this is a prefix-free code of size 6:
|
||||
Un codice privo di prefisso della dimensione $n$ è una raccolta di $n$ stringhe di bit distinte in modo che nessuna stringa sia un prefisso di qualunque altra. Ad esempio, questo è un codice privo di prefisso di dimensione 6:
|
||||
|
||||
0000, 0001, 001, 01, 10, 11
|
||||
$$0000, 0001, 001, 01, 10, 11$$
|
||||
|
||||
Now suppose that it costs one penny to transmit a '0' bit, but four pence to transmit a '1'. Then the total cost of the prefix-free code shown above is 35 pence, which happens to be the cheapest possible for the skewed pricing scheme in question. In short, we write Cost(6) = 35.
|
||||
Ora supponiamo che costi un centesimo trasmettere un bit '0', ma quattro pence trasmettere un '1'. Quindi il costo totale del codice privo di prefisso mostrato sopra è 35 pence, che risulta essere il più economico possibile per il regime di prezzi non lineare in questione. In breve, scriviamo $Cost(6) = 35$.
|
||||
|
||||
What is Cost(109) ?
|
||||
Cos'è $Cost(10^9)$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler219()` should return 64564225042.
|
||||
`skewCostCoding()` dovrebbe restituire `64564225042`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler219(), 64564225042);
|
||||
assert.strictEqual(skewCostCoding(), 64564225042);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +35,12 @@ assert.strictEqual(euler219(), 64564225042);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler219() {
|
||||
function skewCostCoding() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler219();
|
||||
skewCostCoding();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4481000cf542c50ff5b
|
||||
title: 'Problem 220: Heighway Dragon'
|
||||
title: 'Problema 220: Heighway Dragon'
|
||||
challengeType: 5
|
||||
forumTopicId: 301863
|
||||
dashedName: problem-220-heighway-dragon
|
||||
@ -8,24 +8,33 @@ dashedName: problem-220-heighway-dragon
|
||||
|
||||
# --description--
|
||||
|
||||
Let D0 be the two-letter string "Fa". For n≥1, derive Dn from Dn-1 by the string-rewriting rules:
|
||||
Sia $D_0$ la stringa con due lettere "Fa". Per $n ≥ 1$, deriva $D_n$ da $D_{n - 1}$ usando le regole per riscrivere le stringhe:
|
||||
|
||||
"a" → "aRbFR" "b" → "LFaLb"
|
||||
- "a" → "aRbFR"
|
||||
- "b" → "LFaLb"
|
||||
|
||||
Thus, D0 = "Fa", D1 = "FaRbFR", D2 = "FaRbFRRLFaLbFR", and so on.
|
||||
Così, $D_0$ = "Fa", $D_1$ = "FaRbFR", $D_2$ = "FaRbFRRLFaLbFR", e così via.
|
||||
|
||||
These strings can be interpreted as instructions to a computer graphics program, with "F" meaning "draw forward one unit", "L" meaning "turn left 90 degrees", "R" meaning "turn right 90 degrees", and "a" and "b" being ignored. The initial position of the computer cursor is (0,0), pointing up towards (0,1).
|
||||
Queste stringhe possono essere interpretate come istruzioni da un programma di grafica del computer, con "F" che significa "disegna in avanti di una unità", "L" significa "gira a sinistra di 90 gradi", "R" significa "gira a destra di 90 gradi", e "a" e "b" che vengono ignorati. La posizione iniziale del cursore del computer è (0,0), puntando in alto verso (0,1).
|
||||
|
||||
Then Dn is an exotic drawing known as the Heighway Dragon of order n. For example, D10 is shown below; counting each "F" as one step, the highlighted spot at (18,16) is the position reached after 500 steps.
|
||||
Allora $D_n$ è un disegno esotico conosciuto col nome di Heighway Dragon di ordine $n$. Per esempio, $D_{10}$ è mostrato qua sotto; contando ogni "F" come uno step, il punto evidenziato a (18,16) è la posizione raggiunta dopo 500 step.
|
||||
|
||||
What is the position of the cursor after 1012 steps in D50 ? Give your answer in the form x,y with no spaces.
|
||||
<img class="img-responsive center-block" alt="disegno del Heighway Dragon dopo 500 step" src="https://cdn.freecodecamp.org/curriculum/project-euler/heighway-dragon.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Qual è la posizione del cursore dopo ${10}^{12}$ passi in $D_{50}$? Dai la tua risposta come una stringa nella forma `x,y` senza spazi.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler220()` should return 139776, 963904.
|
||||
`heighwayDragon()` dovrebbe restituire una stringa.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler220(), 139776, 963904);
|
||||
assert(typeof heighwayDragon() === 'string');
|
||||
```
|
||||
|
||||
`heighwayDragon()` dovrebbe restituire la stringa `139776,963904`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(heighwayDragon(), '139776,963904');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +42,12 @@ assert.strictEqual(euler220(), 139776, 963904);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler220() {
|
||||
function heighwayDragon() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler220();
|
||||
heighwayDragon();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4491000cf542c50ff5c
|
||||
title: 'Problem 221: Alexandrian Integers'
|
||||
title: 'Problema 221: Interi Alessandrini'
|
||||
challengeType: 5
|
||||
forumTopicId: 301864
|
||||
dashedName: problem-221-alexandrian-integers
|
||||
@ -8,20 +8,25 @@ dashedName: problem-221-alexandrian-integers
|
||||
|
||||
# --description--
|
||||
|
||||
We shall call a positive integer A an "Alexandrian integer", if there exist integers p, q, r such that: A = p · q · r and 1/A = 1/p + 1/q + 1/r
|
||||
Chiameremo un intero positivo $A$ un "intero Alessandrino", se esistono degli interi $p$, $q$, $r$ tali che:
|
||||
|
||||
<!-- TODO Use MathJax -->
|
||||
$$A = p \times q \times r$$
|
||||
|
||||
For example, 630 is an Alexandrian integer (p = 5, q = −7, r = −18). In fact, 630 is the 6th Alexandrian integer, the first 6 Alexandrian integers being: 6, 42, 120, 156, 420 and 630.
|
||||
e
|
||||
|
||||
Find the 150000th Alexandrian integer.
|
||||
$$$\frac{1}{A} = \frac{1}{p} + \frac{1}{q} + \frac{1}{r}$$
|
||||
|
||||
|
||||
Ad esempio, 630 è un numero intero Alessandrino ($p = 5$, $q = −7$, $r = −18$). Infatti 630 è il 6° numero intero Alessandrino, i primi 6 interi Alessandrini sono: 6, 42, 120, 156, 420 e 630.
|
||||
|
||||
Trova il 150000esimo intero Alessandrino.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler221()` should return 1884161251122450.
|
||||
`alexandrianIntegers()` dovrebbe restituire `1884161251122450`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler221(), 1884161251122450);
|
||||
assert.strictEqual(alexandrianIntegers(), 1884161251122450);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +34,12 @@ assert.strictEqual(euler221(), 1884161251122450);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler221() {
|
||||
function alexandrianIntegers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler221();
|
||||
alexandrianIntegers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f44b1000cf542c50ff5d
|
||||
title: 'Problem 222: Sphere Packing'
|
||||
title: 'Problema 222: Imballaggio di una sfera'
|
||||
challengeType: 5
|
||||
forumTopicId: 301865
|
||||
dashedName: problem-222-sphere-packing
|
||||
@ -8,16 +8,16 @@ dashedName: problem-222-sphere-packing
|
||||
|
||||
# --description--
|
||||
|
||||
What is the length of the shortest pipe, of internal radius 50mm, that can fully contain 21 balls of radii 30mm, 31mm, ..., 50mm?
|
||||
Qual è la lunghezza del tubo più corto, di raggio interno 50mm, che può contenere completamente 21 sfere di raggio 30mm, 31mm, ..., 50mm?
|
||||
|
||||
Give your answer in micrometres (10-6 m) rounded to the nearest integer.
|
||||
Dai la tua risposta in micrometri (${10}^{-6}$ m) arrotondata al numero intero più vicino.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler222()` should return 1590933.
|
||||
`spherePacking()` dovrebbe restituire `1590933`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler222(), 1590933);
|
||||
assert.strictEqual(spherePacking(), 1590933);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +25,12 @@ assert.strictEqual(euler222(), 1590933);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler222() {
|
||||
function spherePacking() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler222();
|
||||
spherePacking();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f44b1000cf542c50ff5e
|
||||
title: 'Problem 223: Almost right-angled triangles I'
|
||||
title: 'Problema 223: Triangoli quasi rettangoli I'
|
||||
challengeType: 5
|
||||
forumTopicId: 301866
|
||||
dashedName: problem-223-almost-right-angled-triangles-i
|
||||
@ -8,16 +8,16 @@ dashedName: problem-223-almost-right-angled-triangles-i
|
||||
|
||||
# --description--
|
||||
|
||||
Let us call an integer sided triangle with sides a ≤ b ≤ c barely acute if the sides satisfy a2 + b2 = c2 + 1.
|
||||
Chiamiamo un triangolo con lati interi $a ≤ b ≤ c$ appena acuto se i lati soddisfano $a^2 + b^2 = c^2 + 1$.
|
||||
|
||||
How many barely acute triangles are there with perimeter ≤ 25,000,000?
|
||||
Quanti triangoli appena acuti ci sono con perimetro $≤ 25\\,000\\,000$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler223()` should return 61614848.
|
||||
`almostRightAngledTrianglesOne()` dovrebbe restituire `61614848`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler223(), 61614848);
|
||||
assert.strictEqual(almostRightAngledTrianglesOne(), 61614848);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +25,12 @@ assert.strictEqual(euler223(), 61614848);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler223() {
|
||||
function almostRightAngledTrianglesOne() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler223();
|
||||
almostRightAngledTrianglesOne();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f44e1000cf542c50ff5f
|
||||
title: 'Problem 224: Almost right-angled triangles II'
|
||||
title: 'Problema 224: Triangoli quasi rettangoli II'
|
||||
challengeType: 5
|
||||
forumTopicId: 301867
|
||||
dashedName: problem-224-almost-right-angled-triangles-ii
|
||||
@ -8,16 +8,16 @@ dashedName: problem-224-almost-right-angled-triangles-ii
|
||||
|
||||
# --description--
|
||||
|
||||
Let us call an integer sided triangle with sides a ≤ b ≤ c barely obtuse if the sides satisfy a2 + b2 = c2 - 1.
|
||||
Chiamiamo un triangolo con lati interi $a ≤ b ≤ c$ a malapena ottuso se i lati soddisfano $a^2 + b^2 = c^2 - 1$.
|
||||
|
||||
How many barely obtuse triangles are there with perimeter ≤ 75,000,000?
|
||||
Quanti triangoli appena ottusi ci sono con perimetro $≤ 75\\,000\\,000$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler224()` should return 4137330.
|
||||
`almostRightAngledTrianglesTwo()` dovrebbe restituire `4137330`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler224(), 4137330);
|
||||
assert.strictEqual(almostRightAngledTrianglesTwo(), 4137330);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +25,12 @@ assert.strictEqual(euler224(), 4137330);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler224() {
|
||||
function almostRightAngledTrianglesTwo() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler224();
|
||||
almostRightAngledTrianglesTwo();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f44e1000cf542c50ff60
|
||||
title: 'Problem 225: Tribonacci non-divisors'
|
||||
title: 'Problema 225: Tribonacci non divisori'
|
||||
challengeType: 5
|
||||
forumTopicId: 301868
|
||||
dashedName: problem-225-tribonacci-non-divisors
|
||||
@ -8,20 +8,20 @@ dashedName: problem-225-tribonacci-non-divisors
|
||||
|
||||
# --description--
|
||||
|
||||
The sequence 1, 1, 1, 3, 5, 9, 17, 31, 57, 105, 193, 355, 653, 1201 ...
|
||||
La sequenza 1, 1, 1, 3, 5, 9, 17, 31, 57, 105, 193, 355, 653, 1201 ...
|
||||
|
||||
is defined by T1 = T2 = T3 = 1 and Tn = Tn-1 + Tn-2 + Tn-3.
|
||||
è definita da $T_1 = T_2 = T_3 = 1$ e $T_n = T_{n - 1} + T_{n - 2} + T_{n - 3}$.
|
||||
|
||||
It can be shown that 27 does not divide any terms of this sequence.In fact, 27 is the first odd number with this property.
|
||||
Si può dimostrare che 27 non divide alcun termine di questa sequenza. In effetti, 27 è il primo numero dispari con questa proprietà.
|
||||
|
||||
Find the 124th odd number that does not divide any terms of the above sequence.
|
||||
Trova il ${124}^{\text{mo}}$ numero dispari che non divide alcun termine della sequenza precedente.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler225()` should return 2009.
|
||||
`tribonacciNonDivisors()` dovrebbe restituire `2009`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler225(), 2009);
|
||||
assert.strictEqual(tribonacciNonDivisors(), 2009);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler225(), 2009);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler225() {
|
||||
function tribonacciNonDivisors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler225();
|
||||
tribonacciNonDivisors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4511000cf542c50ff62
|
||||
title: 'Problem 226: A Scoop of Blancmange'
|
||||
title: 'Problema 226: una pallina di Blancmange'
|
||||
challengeType: 5
|
||||
forumTopicId: 301869
|
||||
dashedName: problem-226-a-scoop-of-blancmange
|
||||
@ -8,20 +8,22 @@ dashedName: problem-226-a-scoop-of-blancmange
|
||||
|
||||
# --description--
|
||||
|
||||
The blancmange curve is the set of points (x,y) such that 0 ≤ x ≤ 1 and ,where s(x) = the distance from x to the nearest integer.
|
||||
La curva di blancmange è l' insieme di punti ($x$,$y$) tale che $0 ≤ x ≤ 1$ e $\displaystyle y = \sum_{n = 0}^{\infty} \frac{s(2^nx)}{2^n}$, dove $s(x)$ è la distanza da $x$ al numero intero più vicino.
|
||||
|
||||
The area under the blancmange curve is equal to ½, shown in pink in the diagram below.
|
||||
L'area sotto la curva blancmange è uguale a $\frac{1}{2}$, mostrato in rosa nel diagramma sottostante.
|
||||
|
||||
Let C be the circle with centre (¼,½) and radius ¼, shown in black in the diagram.
|
||||
<img class="img-responsive center-block" alt="diagramma della curva di blancmange, con il cerchio C mostrato sul diagramma" src="https://cdn.freecodecamp.org/curriculum/project-euler/a-scoop-of-blancmange.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
What area under the blancmange curve is enclosed by C?Give your answer rounded to eight decimal places in the form 0.abcdefgh
|
||||
Sia $C$ il cerchio con centro ($\frac{1}{4}$, \frac{1}{2}$) e raggio $\frac{1}{4}$, mostrato in nero nel diagramma.
|
||||
|
||||
Quale area sotto la curva di blancmange è racchiusa da $C$? Dai la tua risposta arrotondata a otto decimali nel formato 0.abcdefgh
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler226()` should return 0.11316017.
|
||||
`scoopOfBlancmange()` should return `0.11316017`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler226(), 0.11316017);
|
||||
assert.strictEqual(scoopOfBlancmange(), 0.11316017);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +31,12 @@ assert.strictEqual(euler226(), 0.11316017);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler226() {
|
||||
function scoopOfBlancmange() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler226();
|
||||
scoopOfBlancmange();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f44f1000cf542c50ff61
|
||||
title: 'Problem 227: The Chase'
|
||||
title: 'Problema 227: L''Inseguimento'
|
||||
challengeType: 5
|
||||
forumTopicId: 301870
|
||||
dashedName: problem-227-the-chase
|
||||
@ -8,18 +8,26 @@ dashedName: problem-227-the-chase
|
||||
|
||||
# --description--
|
||||
|
||||
"The Chase" is a game played with two dice and an even number of players.
|
||||
"L'inseguimento" è un gioco giocato con due dadi e un numero pari di giocatori.
|
||||
|
||||
The players sit around a table; the game begins with two opposite players having one die each. On each turn, the two players with a die roll it. If a player rolls a 1, he passes the die to his neighbour on the left; if he rolls a 6, he passes the die to his neighbour on the right; otherwise, he keeps the die for the next turn. The game ends when one player has both dice after they have been rolled and passed; that player has then lost.
|
||||
I giocatori si siedono intorno a un tavolo; il gioco inizia con due giocatori opposti che hanno un dado ciascuno. Ad ogni turno, i due giocatori con un dado lo lanciano.
|
||||
|
||||
In a game with 100 players, what is the expected number of turns the game lasts? Give your answer rounded to ten significant digits.
|
||||
Se il giocatore lancia un 1, passa il dado al suo vicino a sinistra.
|
||||
|
||||
Se il giocatore lancia un 6, passa il dado al suo vicino sulla destra.
|
||||
|
||||
Altrimenti, mantiene il dado per il prossimo turno.
|
||||
|
||||
Il gioco termina quando un giocatore ha entrambi i dadi dopo che sono stati rotolati e passati; quel giocatore ha perso.
|
||||
|
||||
In una partita con 100 giocatori, qual è il numero previsto di turni del gioco? Dai la tua risposta arrotondata a dieci cifre significative.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler227()` should return 3780.618622.
|
||||
`theChase()` dovrebbe restituire `3780.618622`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler227(), 3780.618622);
|
||||
assert.strictEqual(theChase(), 3780.618622);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +35,12 @@ assert.strictEqual(euler227(), 3780.618622);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler227() {
|
||||
function theChase() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler227();
|
||||
theChase();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4511000cf542c50ff63
|
||||
title: 'Problem 228: Minkowski Sums'
|
||||
title: 'Problem 228: Somme di Minkowski'
|
||||
challengeType: 5
|
||||
forumTopicId: 301871
|
||||
dashedName: problem-228-minkowski-sums
|
||||
@ -8,34 +8,26 @@ dashedName: problem-228-minkowski-sums
|
||||
|
||||
# --description--
|
||||
|
||||
<!-- TODO Use MathJax and re-write from projecteuler.net -->
|
||||
Sia $S_n$ il poligono regolare a $n$ lati i cui vertici $v_k (k = 1, 2, \ldots, n)$ hanno coordinate:
|
||||
|
||||
Let Sn be the regular n-sided polygon – or shape – whose vertices
|
||||
$$\begin{align} & x_k = cos(\frac{2k - 1}{n} × 180°) \\\\ & y_k = sin(\frac{2k - 1}{n} × 180°) \end{align}$$
|
||||
|
||||
vk (k = 1,2,…,n) have coordinates:
|
||||
Ogni $S_n$ è da considerarsi come una forma riempita consistente di tutti i punti sia del perimetro che dell'interno.
|
||||
|
||||
xk = cos( 2k-1/n ×180° )
|
||||
La somma di Minkowski, $S + T$, di due figure $S$ e $T$ è il risultato di sommare ogni punto in $S$ con ogni punto in $T$ dove l'addizione dei punti è fatta sulla base delle coordinate: $(u, v) + (x, y) = (u + x, v + y)$.
|
||||
|
||||
yk = sin( 2k-1/n ×180° )
|
||||
Per esempio, la somma di $S_3$ e $S_4$ è la forma a 6 lati mostrata in rosa qui sotto:
|
||||
|
||||
Each Sn is to be interpreted as a filled shape consisting of all points on the perimeter and in the interior.
|
||||
<img class="img-responsive center-block" alt="immagine che mostra S_3, S_4 e S_3 + S_4" src="https://cdn.freecodecamp.org/curriculum/project-euler/minkowski-sums.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
The Minkowski sum, S+T, of two shapes S and T is the result of
|
||||
|
||||
adding every point in S to every point in T, where point addition is performed coordinate-wise:
|
||||
|
||||
(u, v) + (x, y) = (u+x, v+y).
|
||||
|
||||
For example, the sum of S3 and S4 is the six-sided shape shown in pink below:
|
||||
|
||||
How many sides does S1864 + S1865 + … + S1909 have?
|
||||
Quanti lati ha $S_{1864} + S_{1865} + \ldots + S_{1909}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler228()` should return 86226.
|
||||
`minkowskiSums()` dovrebbe restituire `86226`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler228(), 86226);
|
||||
assert.strictEqual(minkowskiSums(), 86226);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -43,12 +35,12 @@ assert.strictEqual(euler228(), 86226);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler228() {
|
||||
function minkowskiSums() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler228();
|
||||
minkowskiSums();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4521000cf542c50ff64
|
||||
title: 'Problem 229: Four Representations using Squares'
|
||||
title: 'Problema 229: quattro rappresentazioni usando quadrati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301872
|
||||
dashedName: problem-229-four-representations-using-squares
|
||||
@ -8,28 +8,28 @@ dashedName: problem-229-four-representations-using-squares
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the number 3600. It is very special, because
|
||||
Considera il numero 3600. È molto speciale, perché
|
||||
|
||||
3600 = 482 + 362 3600 = 202 + 2×402 3600 = 302 + 3×302 3600 = 452 + 7×152
|
||||
$$\begin{align} & 3600 = {48}^2 + {36}^2 \\\\ & 3600 = {20}^2 + {2×40}^2 \\\\ & 3600 = {30}^2 + {3×30}^2 \\\\ & 3600 = {45}^2 + {7×15}^2 \\\\ \end{align}$$
|
||||
|
||||
Similarly, we find that 88201 = 992 + 2802 = 2872 + 2×542 = 2832 + 3×522 = 1972 + 7×842.
|
||||
In maniera simile troviamo che $88201 = {99}^2 + {280}^2 = {287}^2 + 2 × {54}^2 = {283}^2 + 3 × {52}^2 = {197}^2 + 7 × {84}^2$.
|
||||
|
||||
In 1747, Euler proved which numbers are representable as a sum of two squares. We are interested in the numbers n which admit representations of all of the following four types:
|
||||
Nel 1747, Eulero ha provato quali numeri sono rappresentabili come somma di due quadrati. Siamo interessati nel numero $n$ che ammette le rappresentazioni di tutti i seguenti quattro tipi:
|
||||
|
||||
n = a12 + b12n = a22 + 2 b22n = a32 + 3 b32n = a72 + 7 b72,
|
||||
$$\begin{align} & n = {a_1}^2 + {b_1}^2 \\\\ & n = {a_2}^2 + 2{b_2}^2 \\\\ & n = {a_3}^2 + 3{b_3}^2 \\\\ & n = {a_7}^2 + 7{b_7}^2 \\\\ \end{align}$$
|
||||
|
||||
where the ak and bk are positive integers.
|
||||
dove i numeri $a_k$ e $b_k$ sono numeri interi positivi.
|
||||
|
||||
There are 75373 such numbers that do not exceed 107.
|
||||
Ci sono 75373 di questi numeri che non eccedono ${10}^7$.
|
||||
|
||||
How many such numbers are there that do not exceed 2×109?
|
||||
Quanti di questi numeri ci sono che non eccedono $2 × {10}^9$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler229()` should return 11325263.
|
||||
`representationsUsingSquares()` dovrebbe restituire `11325263`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler229(), 11325263);
|
||||
assert.strictEqual(representationsUsingSquares(), 11325263);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -37,12 +37,12 @@ assert.strictEqual(euler229(), 11325263);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler229() {
|
||||
function representationsUsingSquares() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler229();
|
||||
representationsUsingSquares();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4531000cf542c50ff65
|
||||
title: 'Problem 230: Fibonacci Words'
|
||||
title: 'Problema 230: Parole di Fibonacci'
|
||||
challengeType: 5
|
||||
forumTopicId: 301874
|
||||
dashedName: problem-230-fibonacci-words
|
||||
@ -8,32 +8,36 @@ dashedName: problem-230-fibonacci-words
|
||||
|
||||
# --description--
|
||||
|
||||
For any two strings of digits, A and B, we define FA,B to be the sequence (A,B,AB,BAB,ABBAB,...) in which each term is the concatenation of the previous two.
|
||||
Per due stringhe di cifre, $A$ e $B$, definiamo $F_{A,B}$ come la sequenza ($A, B, AB, BAB, ABBAB, \ldots$) in cui ogni termine è la concatenazione dei due precedenti.
|
||||
|
||||
Further, we define DA,B(n) to be the nth digit in the first term of FA,B that contains at least n digits.
|
||||
Inoltre, definiamo $D_{A,B}(n)$ come la $n$-sima cifra nel primo termine di $F_{A,B}$ che contiene almeno $n$ cifre.
|
||||
|
||||
Example:
|
||||
Esempio:
|
||||
|
||||
Let A=1415926535, B=8979323846. We wish to find DA,B(35), say.
|
||||
Sia $A = 1\\,415\\,926\\,535$, $B = 8\\,979\\,323\\,846$. Vogliamo trovare, diciamo, $D_{A,B}(35)$.
|
||||
|
||||
The first few terms of FA,B are: 1415926535 8979323846 14159265358979323846 897932384614159265358979323846 14159265358979323846897932384614159265358979323846
|
||||
I primi termini di $F_{A,B}$ sono:
|
||||
|
||||
Then DA,B(35) is the 35th digit in the fifth term, which is 9.
|
||||
$$\begin{align} & 1\\,415\\,926\\,535 \\\\ & 8\\,979\\,323\\,846 \\\\ & 14\\,159\\,265\\,358\\,979\\,323\\,846 \\\\ & 897\\,932\\,384\\,614\\,159\\,265\\,358\\,979\\,323\\,846 \\\\ & 14\\,159\\,265\\,358\\,979\\,323\\,846\\,897\\,932\\,384\\,614\\,15\color{red}{9}\\,265\\,358\\,979\\,323\\,846 \end{align}$$
|
||||
|
||||
Now we use for A the first 100 digits of π behind the decimal point: 14159265358979323846264338327950288419716939937510 58209749445923078164062862089986280348253421170679
|
||||
Allora $D_{A,B}(35)$ è la ${35}$-sima cifra nel qunto termine, che è 9.
|
||||
|
||||
and for B the next hundred digits:
|
||||
Ora utilizziamo per $A$ le prime 100 cifre di $π$ dietro il punto decimale:
|
||||
|
||||
82148086513282306647093844609550582231725359408128 48111745028410270193852110555964462294895493038196 .
|
||||
$$\begin{align} & 14\\,159\\,265\\,358\\,979\\,323\\,846\\,264\\,338\\,327\\,950\\,288\\,419\\,716\\,939\\,937\\,510 \\\\ & 58\\,209\\,749\\,445\\,923\\,078\\,164\\,062\\,862\\,089\\,986\\,280\\,348\\,253\\,421\\,170\\,679 \end{align}$$
|
||||
|
||||
Find ∑n = 0,1,...,17 10n× DA,B((127+19n)×7n) .
|
||||
e per $B$ le prossime cento cifre:
|
||||
|
||||
$$\begin{align} & 82\\,148\\,086\\,513\\,282\\,306\\,647\\,093\\,844\\,609\\,550\\,582\\,231\\,725\\,359\\,408\\,128 \\\\ & 48\\,111\\,745\\,028\\,410\\,270\\,193\\,852\\,110\\,555\\,964\\,462\\,294\\,895\\,493\\,038\\,196 \end{align}$$
|
||||
|
||||
Trova $\sum_{n = 0, 1, \ldots, 17} {10}^n × D_{A,B}((127 + 19n) × 7^n)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler230()` should return 850481152593119200.
|
||||
`fibonacciWords()` dovrebbe restituire `850481152593119200`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler230(), 850481152593119200);
|
||||
assert.strictEqual(fibonacciWords(), 850481152593119200);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -41,12 +45,12 @@ assert.strictEqual(euler230(), 850481152593119200);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler230() {
|
||||
function fibonacciWords() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler230();
|
||||
fibonacciWords();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4531000cf542c50ff66
|
||||
title: 'Problem 231: The prime factorisation of binomial coefficients'
|
||||
title: 'Problema 231: La fattorizzazione prima dei coefficienti binomiali'
|
||||
challengeType: 5
|
||||
forumTopicId: 301875
|
||||
dashedName: problem-231-the-prime-factorisation-of-binomial-coefficients
|
||||
@ -8,20 +8,20 @@ dashedName: problem-231-the-prime-factorisation-of-binomial-coefficients
|
||||
|
||||
# --description--
|
||||
|
||||
The binomial coefficient 10C3 = 120.
|
||||
Il coefficiente binomiale $\displaystyle\binom{10}{3} = 120$.
|
||||
|
||||
120 = 23 × 3 × 5 = 2 × 2 × 2 × 3 × 5, and 2 + 2 + 2 + 3 + 5 = 14.
|
||||
$120 = 2^3 × 3 × 5 = 2 × 2 × 2 × 3 × 5$, e $2 + 2 + 2 + 3 + 5 = 14$.
|
||||
|
||||
So the sum of the terms in the prime factorisation of 10C3 is 14.
|
||||
Quindi la somma dei termini nella fattorizzazione prima di $\displaystyle\binom{10}{3}$ è $14$.
|
||||
|
||||
Find the sum of the terms in the prime factorisation of 20000000C15000000.
|
||||
Trova la somma dei termini nella fattorizzazione prima di $\binom{20\\,000\\,000}{15\\,000\\,000}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler231()` should return 7526965179680.
|
||||
`primeFactorisation()` dovrebbe restituire `7526965179680`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler231(), 7526965179680);
|
||||
assert.strictEqual(primeFactorisation(), 7526965179680);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler231(), 7526965179680);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler231() {
|
||||
function primeFactorisation() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler231();
|
||||
primeFactorisation();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4551000cf542c50ff67
|
||||
title: 'Problem 232: The Race'
|
||||
title: 'Problema 232: La Gara'
|
||||
challengeType: 5
|
||||
forumTopicId: 301876
|
||||
dashedName: problem-232-the-race
|
||||
@ -8,20 +8,26 @@ dashedName: problem-232-the-race
|
||||
|
||||
# --description--
|
||||
|
||||
Two players share an unbiased coin and take it in turns to play "The Race". On Player 1's turn, he tosses the coin once: if it comes up Heads, he scores one point; if it comes up Tails, he scores nothing. On Player 2's turn, she chooses a positive integer T and tosses the coin T times: if it comes up all Heads, she scores 2T-1 points; otherwise, she scores nothing. Player 1 goes first. The winner is the first to 100 or more points.
|
||||
Due giocatori condividono una moneta imparziale e la prendono a turno per giocare "La Gara".
|
||||
|
||||
On each turn Player 2 selects the number, T, of coin tosses that maximises the probability of her winning.
|
||||
Nel turno del giocatore 1, egli lancia la moneta una volta: se esce testa, guadagna un punto; se esce croce non guadagna nulla.
|
||||
|
||||
What is the probability that Player 2 wins?
|
||||
Il giocatore 2 nel suo turno sceglie un numero intero $T$ e lancia la moneta $T$ volte: se vengono tutte teste, guadagna $2^{T - 1}$ punti, altrimenti non guadagna nulla.
|
||||
|
||||
Give your answer rounded to eight decimal places in the form 0.abcdefgh .
|
||||
Il giocatore 1 va per primo. Il vincitore è chi guadagna per primo 100 o più punti.
|
||||
|
||||
A ogni turno il Giocatore 2 seleziona il numero, $T$, di lanci di moneta che massimizza la probabilità della sua vincita.
|
||||
|
||||
Qual è la probabilità che il giocatore 2 vinca?
|
||||
|
||||
Dai la tua risposta arrotondata a otto decimali nel formato 0.abcdefgh .
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler232()` should return 0.83648556.
|
||||
`theRace()` dovrebbe restituire `0.83648556`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler232(), 0.83648556);
|
||||
assert.strictEqual(theRace(), 0.83648556);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +35,12 @@ assert.strictEqual(euler232(), 0.83648556);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler232() {
|
||||
function theRace() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler232();
|
||||
theRace();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4551000cf542c50ff68
|
||||
title: 'Problem 233: Lattice points on a circle'
|
||||
title: 'Problema 233: I punti di reticolo su un cerchio'
|
||||
challengeType: 5
|
||||
forumTopicId: 301877
|
||||
dashedName: problem-233-lattice-points-on-a-circle
|
||||
@ -8,18 +8,18 @@ dashedName: problem-233-lattice-points-on-a-circle
|
||||
|
||||
# --description--
|
||||
|
||||
Let f(N) be the number of points with integer coordinates that are on a circle passing through (0,0), (N,0),(0,N), and (N,N).
|
||||
Sia $f(N)$ il numero di punti con coordinate intere che sono su un cerchio che passa attraverso $(0,0)$, $(N,0)$,$(0,N)$, e $(N,N)$.
|
||||
|
||||
It can be shown that f(10000) = 36.
|
||||
Si può dimostrare che $f(10000) = 36$.
|
||||
|
||||
What is the sum of all positive integers N ≤ 1011 such that f(N) = 420 ?
|
||||
Qual è la somma di tutti gli interi positivi $N ≤ {10}^{11}$ tali che che $f(N) = 420$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler233()` should return 271204031455541300.
|
||||
`latticePointsOnACircle()` dovrebbe restituire `271204031455541300`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler233(), 271204031455541300);
|
||||
assert.strictEqual(latticePointsOnACircle(), 271204031455541300);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler233(), 271204031455541300);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler233() {
|
||||
function latticePointsOnACircle() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler233();
|
||||
latticePointsOnACircle();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4571000cf542c50ff69
|
||||
title: 'Problem 234: Semidivisible numbers'
|
||||
title: 'Problema 234: Numeri semidivisibili'
|
||||
challengeType: 5
|
||||
forumTopicId: 301878
|
||||
dashedName: problem-234-semidivisible-numbers
|
||||
@ -8,22 +8,22 @@ dashedName: problem-234-semidivisible-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
For an integer n ≥ 4, we define the lower prime square root of n, denoted by lps(n), as the largest prime ≤ √n and the upper prime square root of n, ups(n), as the smallest prime ≥ √n.
|
||||
Per un intero $n ≥ 4$, definiamo la radice quadrata prima inferiore di $n$, indicata da $lps(n)$, come il $\text{maggiore numero primo} ≤ \sqrt{n}$ e la radice quadrata prima superiore di $n$, $ups(n)$, come $\text{il più piccolo numero primo} ≥ \sqrt{n}$.
|
||||
|
||||
So, for example, lps(4) = 2 = ups(4), lps(1000) = 31, ups(1000) = 37.
|
||||
Così, per esempio, $lps(4) = 2 = su(4)$, $lps(1000) = 31$, $ups(1000) = 37$.
|
||||
|
||||
Let us call an integer n ≥ 4 semidivisible, if one of lps(n) and ups(n) divides n, but not both.
|
||||
Chiamiamo un intero $n ≥ 4$ semidivisible, se $lps(n)$ o $ups(n)$ divide $n$, ma non entrambi.
|
||||
|
||||
The sum of the semidivisible numbers not exceeding 15 is 30, the numbers are 8, 10 and 12. 15 is not semidivisible because it is a multiple of both lps(15) = 3 and ups(15) = 5. As a further example, the sum of the 92 semidivisible numbers up to 1000 is 34825.
|
||||
La somma dei numeri semidivisibili non superiori a 15 è di 30, i numeri sono 8, 10 e 12. 15 non è semidivisibile perché è un multiplo sia di $lps(15) = 3$ che di $ups(15) = 5$. Come ulteriore esempio, la somma dei 92 numeri semidivisibili fino a 1000 è di 34825.
|
||||
|
||||
What is the sum of all semidivisible numbers not exceeding 999966663333 ?
|
||||
Qual è la somma di tutti i numeri semidivisibili non superiori a 999966663333?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler234()` should return 1259187438574927000.
|
||||
`semidivisibleNumbers()` dovrebbe restituire `1259187438574927000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler234(), 1259187438574927000);
|
||||
assert.strictEqual(semidivisibleNumbers(), 1259187438574927000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler234(), 1259187438574927000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler234() {
|
||||
function semidivisibleNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler234();
|
||||
semidivisibleNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4571000cf542c50ff6a
|
||||
title: 'Problem 235: An Arithmetic Geometric sequence'
|
||||
title: 'Problema 235: Sequenza geometrica aritmetica'
|
||||
challengeType: 5
|
||||
forumTopicId: 301879
|
||||
dashedName: problem-235-an-arithmetic-geometric-sequence
|
||||
@ -8,20 +8,20 @@ dashedName: problem-235-an-arithmetic-geometric-sequence
|
||||
|
||||
# --description--
|
||||
|
||||
Given is the arithmetic-geometric sequence u(k) = (900-3k)rk-1.
|
||||
Data la sequenza aritmetico-geometrica $u(k) = (900 - 3k)r^{k - 1}$.
|
||||
|
||||
Let s(n) = Σk=1...nu(k).
|
||||
Sia $s(n) = \sum_{k=1 \ldots n} u(k)$.
|
||||
|
||||
Find the value of r for which s(5000) = -600,000,000,000.
|
||||
Trova il valore di $r$ per il quale $s(5000) = -600\\,000\\,000\\,000$.
|
||||
|
||||
Give your answer rounded to 12 places behind the decimal point.
|
||||
Dai la tua risposta arrotondata a 12 cifre dopo il punto decimale.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler235()` should return 1.002322108633.
|
||||
`arithmeticGeometricSequence()` dovrebbe restituire `1.002322108633`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler235(), 1.002322108633);
|
||||
assert.strictEqual(arithmeticGeometricSequence(), 1.002322108633);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler235(), 1.002322108633);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler235() {
|
||||
function arithmeticGeometricSequence() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler235();
|
||||
arithmeticGeometricSequence();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4591000cf542c50ff6b
|
||||
title: 'Problem 236: Luxury Hampers'
|
||||
title: 'Problema 236: Cesti Di Lusso'
|
||||
challengeType: 5
|
||||
forumTopicId: 301881
|
||||
dashedName: problem-236-luxury-hampers
|
||||
@ -8,24 +8,41 @@ dashedName: problem-236-luxury-hampers
|
||||
|
||||
# --description--
|
||||
|
||||
Suppliers 'A' and 'B' provided the following numbers of products for the luxury hamper market:
|
||||
I fornitori 'A' e 'B' hanno fornito il seguente numero di prodotti per il mercato di lusso:
|
||||
|
||||
Product'A''B'Beluga Caviar5248640Christmas Cake13121888Gammon Joint26243776Vintage Port57603776Champagne Truffles39365664
|
||||
| Prodotto | 'A' | 'B' |
|
||||
| ---------------------- | ---- | ---- |
|
||||
| Caviale di Beluga | 5248 | 640 |
|
||||
| Torta Natalizia | 1312 | 1888 |
|
||||
| Gammon Joint | 2624 | 3776 |
|
||||
| Porto Vintage | 5760 | 3776 |
|
||||
| Tartufi allo Champagne | 3936 | 5664 |
|
||||
|
||||
Although the suppliers try very hard to ship their goods in perfect condition, there is inevitably some spoilage - i.e. products gone bad.
|
||||
Anche se i fornitori si impegnano molto a spedire i loro prodotti in perfette condizioni, vi è inevitabilmente un certo deterioramento - cioè prodotti andati male.
|
||||
|
||||
The suppliers compare their performance using two types of statistic:The five per-product spoilage rates for each supplier are equal to the number of products gone bad divided by the number of products supplied, for each of the five products in turn. The overall spoilage rate for each supplier is equal to the total number of products gone bad divided by the total number of products provided by that supplier.To their surprise, the suppliers found that each of the five per-product spoilage rates was worse (higher) for 'B' than for 'A' by the same factor (ratio of spoilage rates), m>1; and yet, paradoxically, the overall spoilage rate was worse for 'A' than for 'B', also by a factor of m.
|
||||
I fornitori confrontano le loro prestazioni utilizzando due tipi di statistiche:
|
||||
|
||||
There are thirty-five m>1 for which this surprising result could have occurred, the smallest of which is 1476/1475.
|
||||
- I cinque tassi di deterioramento per prodotto per ogni fornitore sono pari al numero di prodotti andati a male diviso per il numero di prodotti forniti, per ciascuno dei cinque prodotti a turno.
|
||||
- Il tasso di deterioramento complessivo per ciascun fornitore è pari al numero totale di prodotti andati male diviso per il numero totale di prodotti forniti da tale fornitore.
|
||||
|
||||
What's the largest possible value of m? Give your answer as a fraction reduced to its lowest terms, in the form u/v.
|
||||
Con loro sorpresa, i fornitori hanno rilevato che ciascuno dei cinque tassi di deterioramento per prodotto era peggiore (più alto) per 'B' rispetto a 'A' dello stesso fattore (rapporto tra i tassi di deterioramento), $m > 1$; eppure, paradossalmente, il tasso complessivo di deterioramento è stato peggiore per 'A' che per 'B', anche per un fattore di $m$.
|
||||
|
||||
Ci sono trentacinque $m > 1$ per i quali questo sorprendente risultato avrebbe potuto verificarsi, il più piccolo dei quali è $\frac{1476}{1475}$.
|
||||
|
||||
Qual è il valore più grande possibile di $m$? Dai la tua risposta come una stringa con frazione ridotta ai suoi termini più bassi, nella forma `u/v`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler236()` should return 123 / 59.
|
||||
`luxuryHampers()` dovrebbe restituire una stringa.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler236(), 123 / 59);
|
||||
assert(typeof luxuryHampers() === 'string');
|
||||
```
|
||||
|
||||
`luxuryHampers()` dovrebbe restituire la stringa `123/59`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(luxuryHampers(), '123/59');
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +50,12 @@ assert.strictEqual(euler236(), 123 / 59);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler236() {
|
||||
function luxuryHampers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler236();
|
||||
luxuryHampers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4591000cf542c50ff6c
|
||||
title: 'Problem 237: Tours on a 4 x n playing board'
|
||||
title: 'Problema 237: Percorsi su una tavola da gioco 4 x n'
|
||||
challengeType: 5
|
||||
forumTopicId: 301882
|
||||
dashedName: problem-237-tours-on-a-4-x-n-playing-board
|
||||
@ -8,26 +8,25 @@ dashedName: problem-237-tours-on-a-4-x-n-playing-board
|
||||
|
||||
# --description--
|
||||
|
||||
Let T(n) be the number of tours over a 4 × n playing board such that:
|
||||
Sia $T(n)$ il numero di percorsi su un tabellone da gioco 4 × $n$ tale che:
|
||||
|
||||
The tour starts in the top left corner.
|
||||
- Il percorso inizia nell'angolo in alto a sinistra.
|
||||
- Il percorso consiste in mosse in alto, in giù, a sinistra o a destra di un quadrato.
|
||||
- Il percorso visita ogni quadrato esattamente una volta.
|
||||
- Il percorso termina nell'angolo in basso a sinistra.
|
||||
|
||||
The tour consists of moves that are up, down, left, or right one square.
|
||||
Il diagramma mostra un percorso su una tavola 4 × 10:
|
||||
|
||||
The tour visits each square exactly once.
|
||||
<img class="img-responsive center-block" alt="un percorso su una tavola 4 x 10" src="https://cdn.freecodecamp.org/curriculum/project-euler/tours-on-a-4-x-n-playing-board.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
The tour ends in the bottom left corner.
|
||||
|
||||
The diagram shows one tour over a 4 × 10 board:
|
||||
|
||||
T(10) is 2329. What is T(1012) modulo 108?
|
||||
$T(10)$ è 2329. Cos'è $T({10}^{12})$ modulo ${10}^8$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler237()` should return 15836928.
|
||||
`toursOnPlayingBoard()` dovrebbe restituire `15836928`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler237(), 15836928);
|
||||
assert.strictEqual(toursOnPlayingBoard(), 15836928);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +34,12 @@ assert.strictEqual(euler237(), 15836928);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler237() {
|
||||
function toursOnPlayingBoard() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler237();
|
||||
toursOnPlayingBoard();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45b1000cf542c50ff6d
|
||||
title: 'Problem 238: Infinite string tour'
|
||||
title: 'Problema 238: viaggio della stringa infinita'
|
||||
challengeType: 5
|
||||
forumTopicId: 301883
|
||||
dashedName: problem-238-infinite-string-tour
|
||||
@ -8,34 +8,34 @@ dashedName: problem-238-infinite-string-tour
|
||||
|
||||
# --description--
|
||||
|
||||
Create a sequence of numbers using the "Blum Blum Shub" pseudo-random number generator:
|
||||
Crea una sequenza di numeri usando il generatore pseudo-casuale di numero "Blum Blum Shub":
|
||||
|
||||
s0 = 14025256 sn+1 = sn2 mod 20300713
|
||||
$$ s_0 = 14025256 \\\\ s_{n + 1} = {s_n}^2 \\; mod \\; 20\\,300\\,713 $$
|
||||
|
||||
Concatenate these numbers s0s1s2… to create a string w of infinite length. Then, w = 14025256741014958470038053646…
|
||||
Concatena questi numeri $s_0s_1s_2\ldots$ per creare una stringa $w$ di lunghezza infinita. Quindi, $w = 14025256741014958470038053646\ldots$
|
||||
|
||||
For a positive integer k, if no substring of w exists with a sum of digits equal to k, p(k) is defined to be zero. If at least one substring of w exists with a sum of digits equal to k, we define p(k) = z, where z is the starting position of the earliest such substring.
|
||||
Per un numero intero positivo, $k$, se nessuna sottostringa di $w$ esiste con la somma delle cifre uguale a $k$, allora $p(k)$ è definito come zero. Se almeno una sottostringa di $w$ esiste la cui somma delle cifre è uguale a $k$, definiamo $p(k) = z$ dove $z$ è la posizione iniziale della prima sottostringa con questa proprietà.
|
||||
|
||||
For instance:
|
||||
Per esempio:
|
||||
|
||||
The substrings 1, 14, 1402, … with respective sums of digits equal to 1, 5, 7, … start at position 1, hence p(1) = p(5) = p(7) = … = 1.
|
||||
Le sottostringhe 1, 14, 1402, … con le rispettive somme delle sifre 1, 5, 7, … iniziano alla posizione uno, quindi $p(1) = p(5) = p(7) = \ldots = 1$.
|
||||
|
||||
The substrings 4, 402, 4025, … with respective sums of digits equal to 4, 6, 11, … start at position 2, hence p(4) = p(6) = p(11) = … = 2.
|
||||
Le sottostringhe 4, 402, 4026, … con le rispettive somme delle cifre 4, 6, 24, … iniziano alla posizione 2, quindi $p(4) = p(6) = p(11) = \ldots = 2$.
|
||||
|
||||
The substrings 02, 0252, … with respective sums of digits equal to 2, 9, … start at position 3, hence p(2) = p(9) = … = 3.
|
||||
Le sottostringhe 02, 0252, … con le rispettive somme delle cifre, 2, 9, … iniziano alla posizione 3, quindi $p(2) = p(9) = \ldots = 3$.
|
||||
|
||||
Note that substring 025 starting at position 3, has a sum of digits equal to 7, but there was an earlier substring (starting at position 1) with a sum of digits equal to 7, so p(7) = 1, not 3.
|
||||
Nota che la sottostringa 025 che inizia alla posizione 3, ha una somma delle cifre uguale a 7, ma c'era una sottostringa precedente (iniziante alla posizione 1), con una somma delle cifre uguale a 7, quindi $p(7) = 1$, non 3.
|
||||
|
||||
We can verify that, for 0 < k ≤ 103, ∑ p(k) = 4742.
|
||||
Possiamo verificare che, per $0 < k ≤ {10}^3$, $\sum p(k) = 4742$.
|
||||
|
||||
Find ∑ p(k), for 0 < k ≤ 2·1015.
|
||||
Trova $\sum p(k)$, per $0 < k ≤ 2 \times {10}^{15}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler238()` should return 9922545104535660.
|
||||
`infiniteStringTour()` dovrebbe restituire `9922545104535660`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler238(), 9922545104535660);
|
||||
assert.strictEqual(infiniteStringTour(), 9922545104535660);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -43,12 +43,12 @@ assert.strictEqual(euler238(), 9922545104535660);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler238() {
|
||||
function infiniteStringTour() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler238();
|
||||
infiniteStringTour();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45c1000cf542c50ff6e
|
||||
title: 'Problem 239: Twenty-two Foolish Primes'
|
||||
title: 'Problema 239: Ventidue primi stolti'
|
||||
challengeType: 5
|
||||
forumTopicId: 301884
|
||||
dashedName: problem-239-twenty-two-foolish-primes
|
||||
@ -8,18 +8,18 @@ dashedName: problem-239-twenty-two-foolish-primes
|
||||
|
||||
# --description--
|
||||
|
||||
A set of disks numbered 1 through 100 are placed in a line in random order.
|
||||
Un insieme di dischi numerati da 1 a 100 è posizionato in una riga in ordine casuale.
|
||||
|
||||
What is the probability that we have a partial derangement such that exactly 22 prime number discs are found away from their natural positions? (Any number of non-prime disks may also be found in or out of their natural positions.)
|
||||
Qual è la probabilità che abbiamo uno squilibrio parziale tale che esattamente 22 dischi di numeri primi si trovano lontano dalle loro posizioni naturali? (Qualsiasi numero di dischi non primi può anche essere trovato dentro o fuori dalle loro posizioni naturali.)
|
||||
|
||||
Give your answer rounded to 12 places behind the decimal point in the form 0.abcdefghijkl.
|
||||
Dai la tua risposta arrotondata a 12 cifre dopo la virgola forma 0.abcdefghijkl.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler239()` should return 0.001887854841.
|
||||
`twentyTwoFoolishPrimes()` dovrebbe restituire `0.001887854841`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler239(), 0.001887854841);
|
||||
assert.strictEqual(twentyTwoFoolishPrimes(), 0.001887854841);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler239(), 0.001887854841);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler239() {
|
||||
function twentyTwoFoolishPrimes() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler239();
|
||||
twentyTwoFoolishPrimes();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45d1000cf542c50ff6f
|
||||
title: 'Problem 240: Top Dice'
|
||||
title: 'Problema 240: I dadi migliori'
|
||||
challengeType: 5
|
||||
forumTopicId: 301887
|
||||
dashedName: problem-240-top-dice
|
||||
@ -8,24 +8,18 @@ dashedName: problem-240-top-dice
|
||||
|
||||
# --description--
|
||||
|
||||
There are 1111 ways in which five 6-sided dice (sides numbered 1 to 6) can be rolled so that the top three sum to 15. Some examples are:
|
||||
Ci sono 1111 modi in cui cinque dadi a 6 facce (le facce numerate da 1 a 6) possono essere lanciati in modo che i tre più grandi sommino a 15. Alcuni esempi sono:
|
||||
|
||||
D1,D2,D3,D4,D5 = 4,3,6,3,5
|
||||
$$\begin{align} & D_1,D_2,D_3,D_4,D_5 = 4,3,6,3,5 \\\\ & D_1,D_2,D_3,D_4,D_5 = 4,3,3,5,6 \\\\ & D_1,D_2,D_3,D_4,D_5 = 3,3,3,6,6 \\\\ & D_1,D_2,D_3,D_4,D_5 = 6,6,3,3,3 \end{align}$$
|
||||
|
||||
D1,D2,D3,D4,D5 = 4,3,3,5,6
|
||||
|
||||
D1,D2,D3,D4,D5 = 3,3,3,6,6
|
||||
|
||||
D1,D2,D3,D4,D5 = 6,6,3,3,3
|
||||
|
||||
In how many ways can twenty 12-sided dice (sides numbered 1 to 12) be rolled so that the top ten sum to 70?
|
||||
In quanti modi si possono lanciare venti dadi a 12 facce (facce numerate da 1 a 12) in modo che la somma dei dieci maggiori a 70?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler240()` should return 7448717393364182000.
|
||||
`topDice()` dovrebbe restituire `7448717393364182000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler240(), 7448717393364182000);
|
||||
assert.strictEqual(topDice(), 7448717393364182000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +27,12 @@ assert.strictEqual(euler240(), 7448717393364182000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler240() {
|
||||
function topDice() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler240();
|
||||
topDice();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45d1000cf542c50ff70
|
||||
title: 'Problem 241: Perfection Quotients'
|
||||
title: 'Problema 241: Perfezione dei quozienti'
|
||||
challengeType: 5
|
||||
forumTopicId: 301888
|
||||
dashedName: problem-241-perfection-quotients
|
||||
@ -8,18 +8,20 @@ dashedName: problem-241-perfection-quotients
|
||||
|
||||
# --description--
|
||||
|
||||
For a positive integer n, let σ(n) be the sum of all divisors of n, so e.g. σ(6) = 1 + 2 + 3 + 6 = 12.
|
||||
Per un numero intero positivo $n$, sia $σ(n)$ la somma di tutti i divisori di $n$, per esempio $σ(6) = 1 + 2 + 3 + 6 = 12$.
|
||||
|
||||
A perfect number, as you probably know, is a number with σ(n) = 2n.
|
||||
Un numero perfetto, come forse già sai, è un numero per cui $σ(n) = 2n$.
|
||||
|
||||
Let us define the perfection quotient of a positive integer asp(n)= σ(n)n . Find the sum of all positive integers n ≤ 1018 for which p(n) has the form k + 1⁄2, where k is an integer.
|
||||
Definiamo il quoziente perfetto di iun numero intero positivo come $p(n) = \frac{σ(n)}{n}$.
|
||||
|
||||
Trova la somma di tutti i numeri interi positivi $n ≤ {10}^{18}$ per cui $p(n)$ ha la forma $k + \frac{1}{2}$, dove $k$ è un numero intero.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler241()` should return 482316491800641150.
|
||||
`perfectionQuotients()` dovrebbe restituire `482316491800641150`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler241(), 482316491800641150);
|
||||
assert.strictEqual(perfectionQuotients(), 482316491800641150);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +29,12 @@ assert.strictEqual(euler241(), 482316491800641150);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler241() {
|
||||
function perfectionQuotients() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler241();
|
||||
perfectionQuotients();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45f1000cf542c50ff71
|
||||
title: 'Problem 242: Odd Triplets'
|
||||
title: 'Problema 242: Triplette Dispari'
|
||||
challengeType: 5
|
||||
forumTopicId: 301889
|
||||
dashedName: problem-242-odd-triplets
|
||||
@ -8,20 +8,20 @@ dashedName: problem-242-odd-triplets
|
||||
|
||||
# --description--
|
||||
|
||||
Given the set {1,2,...,n}, we define f(n,k) as the number of its k-element subsets with an odd sum of elements. For example, f(5,3) = 4, since the set {1,2,3,4,5} has four 3-element subsets having an odd sum of elements, i.e.: {1,2,4}, {1,3,5}, {2,3,4} and {2,4,5}.
|
||||
Dato il set {1,2,..., $n$}, definiamo $f(n, k)$ come il numero dei suoi sottoinsiemi di elementi $k$ con una somma dispari di elementi. Per esempio, $f(5,3) = 4$, dal momento che il set {1,2,3,4,5} ha quattro sottoinsiemi di 3 elementi con una somma dispari di elementi, cioè: {1,2,4}, {1,3,5}, {2,3,4} e {2,4,5}.
|
||||
|
||||
When all three values n, k and f(n,k) are odd, we say that they make an odd-triplet \[n,k,f(n,k)].
|
||||
Quando tutti e tre i valori $n$, $k$ e $f(n, k)$ sono dispari, diciamo che essi formano una tripletta dispari $[n, k, f(n, k)]$.
|
||||
|
||||
There are exactly five odd-triplets with n ≤ 10, namely: \[1,1,f(1,1) = 1], \[5,1,f(5,1) = 3], \[5,5,f(5,5) = 1], \[9,1,f(9,1) = 5] and \[9,9,f(9,9) = 1].
|
||||
Ci sono esattamente cinque triplette dispari con $n ≤ 10$, cioè: $[1, 1, f(1, 1) = 1]$, $[5, 1, f(5, 1) = 3]$, $ [5, 5, f(5, 5) = 1]$, $[9, 1, f(9, 1) = 5]$ e $[9, 9, f(9, 9) = 1]$.
|
||||
|
||||
How many odd-triplets are there with n ≤ 1012 ?
|
||||
Quante triplette dispari ci sono con $n ≤ {10}^{12}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler242()` should return 997104142249036700.
|
||||
`oddTriplets()` dovrebbe restituire `997104142249036700`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler242(), 997104142249036700);
|
||||
assert.strictEqual(oddTriplets(), 997104142249036700);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler242(), 997104142249036700);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler242() {
|
||||
function oddTriplets() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler242();
|
||||
oddTriplets();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4601000cf542c50ff73
|
||||
title: 'Problem 243: Resilience'
|
||||
title: 'Problema 243: Resilienza'
|
||||
challengeType: 5
|
||||
forumTopicId: 301890
|
||||
dashedName: problem-243-resilience
|
||||
@ -8,20 +8,26 @@ dashedName: problem-243-resilience
|
||||
|
||||
# --description--
|
||||
|
||||
A positive fraction whose numerator is less than its denominator is called a proper fraction.
|
||||
Una frazione positiva il cui numeratore è inferiore al suo denominatore è chiamata una frazione propria.
|
||||
|
||||
For any denominator, d, there will be d−1 proper fractions; for example, with d = 12:1/12 , 2/12 , 3/12 , 4/12 , 5/12 , 6/12 , 7/12 , 8/12 , 9/12 , 10/12 , 11/12 .
|
||||
Per qualsiasi denominatore, $d$, ci saranno $d−1$ frazioni proprie; per esempio, con $d = 12$:
|
||||
|
||||
We shall call a fraction that cannot be cancelled down a resilient fraction. Furthermore we shall define the resilience of a denominator, R(d), to be the ratio of its proper fractions that are resilient; for example, R(12) = 4/11 . In fact, d = 12 is the smallest denominator having a resilience R(d) < 4/10 .
|
||||
$$\frac{1}{12}, \frac{2}{12}, \frac{3}{12}, \frac{4}{12}, \frac{5}{12}, \frac{6}{12}, \frac{7}{12}, \frac{8}{12}, \frac{9}{12}, \frac{10}{12}, \frac{11}{12}$$
|
||||
|
||||
Find the smallest denominator d, having a resilience R(d) < 15499/94744 .
|
||||
Chiameremo una frazione che non può essere semplificata una frazione resiliente.
|
||||
|
||||
Inoltre definiremo la resilienza di un denominatore, $R(d)$, come il rapporto delle sue frazioni proprie che sono resilienti; per esempio, $R(12) = \frac{4}{11}$.
|
||||
|
||||
Infatti, $d = 12$ è il più piccolo denominatore con una resilienza $R(d) < \frac{4}{10}$.
|
||||
|
||||
Trova il più piccolo denominatore $d$, avente una resilienza $R(d) < \frac{15\\,499}{94\\,744}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler243()` should return 892371480.
|
||||
`resilience()` dovrebbe restituire `892371480`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler243(), 892371480);
|
||||
assert.strictEqual(resilience(), 892371480);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +35,12 @@ assert.strictEqual(euler243(), 892371480);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler243() {
|
||||
function resilience() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler243();
|
||||
resilience();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4601000cf542c50ff72
|
||||
title: 'Problem 244: Sliders'
|
||||
title: 'Problema 244: Sliders'
|
||||
challengeType: 5
|
||||
forumTopicId: 301891
|
||||
dashedName: problem-244-sliders
|
||||
@ -8,30 +8,32 @@ dashedName: problem-244-sliders
|
||||
|
||||
# --description--
|
||||
|
||||
You probably know the game Fifteen Puzzle. Here, instead of numbered tiles, we have seven red tiles and eight blue tiles.
|
||||
Probabilmente conosci il gioco Fifteen Puzzle. Qui, invece di piastrelle numerate, abbiamo sette piastrelle rosse e otto piastrelle blu.
|
||||
|
||||
A move is denoted by the uppercase initial of the direction (Left, Right, Up, Down) in which the tile is slid, e.g. starting from configuration (S), by the sequence LULUR we reach the configuration (E):
|
||||
Una mossa è indicata dall'iniziale maiuscolo della direzione (sinistra, destra, alto, giù) in cui la piastrella è fatta scorrere, ad esempio partendo dalla configurazione ($S$), dalla sequenza $LULUR$ raggiungiamo la configurazione ($E$):
|
||||
|
||||
(S), (E)
|
||||
($S$) <img class="img-responsive" alt="configuration S" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-1.gif" style="display: inline-block; background-color: white; padding: 10px;" />, ($E$) <img class="img-responsive" alt="configurazione E" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-2.gif" style="display: inline-block; background-color: white; padding: 10px;" />
|
||||
|
||||
For each path, its checksum is calculated by (pseudocode):
|
||||
Per ogni percorso, il suo checksum è calcolato con (pseudocodice):
|
||||
|
||||
checksum = 0 checksum = (checksum × 243 + m1) mod 100 000 007 checksum = (checksum × 243 + m2) mod 100 000 007 … checksum = (checksum × 243 + mn) mod 100 000 007 where mk is the ASCII value of the kth letter in the move sequence and the ASCII values for the moves are:
|
||||
$$\begin{align} & \text{checksum} = 0 \\\\ & \text{checksum} = (\text{checksum} × 243 + m_1) \\; \text{mod} \\; 100\\,000\\,007 \\\\ & \text{checksum} = (\text{checksum} × 243 + m_2) \\; \text{mod} \\; 100\\,000\\,007 \\\\ & \ldots \\\\ & \text{checksum} = (\text{checksum} × 243 + m_n) \\; \text{mod} \\; 100\\,000\\,007 \end{align}$$
|
||||
|
||||
L76R82U85D68
|
||||
dove $m_k$ è il valore ASCII della $k^{\text{th}}$-ma lettera nella sequenza di movimento e i valori ASCII per le mosse sono:
|
||||
|
||||
For the sequence LULUR given above, the checksum would be 19761398. Now, starting from configuration (S), find all shortest ways to reach configuration (T).
|
||||
$$\begin{array}{|c|c|} \hline L & 76 \\\\ \hline R & 82 \\\\ \hline U & 85 \\\\ \hline D & 68 \\\\ \hline \end{array}$$
|
||||
|
||||
(S), (T)
|
||||
Per la sequenza $LULUR$ riportata sopra, il checksum sarebbe 19761398. Ora, partendo dalla configurazione ($S$), trova tutti i modi più brevi per raggiungere la configurazione ($T$).
|
||||
|
||||
What is the sum of all checksums for the paths having the minimal length?
|
||||
($S$) <img class="img-responsive center-block" alt="configuration S" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-3.gif" style="display: inline-block; background-color: white; padding: 10px;" />, ($T$) <img class="img-responsive center-block" alt="configurazione T" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-4.gif" style="display: inline-block; background-color: white; padding: 10px;" />
|
||||
|
||||
Qual è la somma di tutti i checksum per i percorsi che hanno la lunghezza minima?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler244()` should return 96356848.
|
||||
`sliders()` dovrebbe restituire `96356848`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler244(), 96356848);
|
||||
assert.strictEqual(sliders(), 96356848);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +41,12 @@ assert.strictEqual(euler244(), 96356848);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler244() {
|
||||
function sliders() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler244();
|
||||
sliders();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4621000cf542c50ff74
|
||||
title: 'Problem 245: Coresilience'
|
||||
title: 'Problema 245: Coresilienza'
|
||||
challengeType: 5
|
||||
forumTopicId: 301892
|
||||
dashedName: problem-245-coresilience
|
||||
@ -8,16 +8,24 @@ dashedName: problem-245-coresilience
|
||||
|
||||
# --description--
|
||||
|
||||
We shall call a fraction that cannot be cancelled down a resilient fraction. Furthermore we shall define the resilience of a denominator, R(d), to be the ratio of its proper fractions that are resilient; for example, R(12) = 4⁄11.
|
||||
Chiameremo una frazione che non può essere semplificata una frazione resiliente.
|
||||
|
||||
The resilience of a number d > 1 is then φ(d)d − 1 , where φ is Euler's totient function. We further define the coresilience of a number n > 1 as C(n)= n − φ(n)n − 1. The coresilience of a prime p is C(p) = 1p − 1. Find the sum of all composite integers 1 < n ≤ 2×1011, for which C(n) is a unit fraction.
|
||||
Inoltre definiremo la resilienza di un denominatore, $R(d)$, come il rapporto delle sue frazioni proprie che sono resilienti; per esempio, $R(12) = \frac{4}{11}$.
|
||||
|
||||
La resilienza di un numero $d > 1$ è allora $\frac{φ(d)}{d − 1}$ , dove $φ$ è la funzione toziente di Eulero.
|
||||
|
||||
Definiamo inoltre la coresilienza di un numero $n > 1$ come $C(n) = \frac{n − φ(n)}{n − 1}$.
|
||||
|
||||
La coresilienza di un primo $p$ è $C(p) = \frac{1}{p − 1}$.
|
||||
|
||||
Trova la somma di tutti i numeri interi $1 < n ≤ 2 × {10}^{11}$, per cui $C(n)$ è una frazione unitaria.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler245()` should return 288084712410001.
|
||||
`coresilience()` dovrebbe restituire `288084712410001`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler245(), 288084712410001);
|
||||
assert.strictEqual(coresilience(), 288084712410001);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +33,12 @@ assert.strictEqual(euler245(), 288084712410001);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler245() {
|
||||
function coresilience() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler245();
|
||||
coresilience();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4641000cf542c50ff76
|
||||
title: 'Problem 247: Squares under a hyperbola'
|
||||
title: 'Problema 247: Quadrati sotto un''iperbole'
|
||||
challengeType: 5
|
||||
forumTopicId: 301894
|
||||
dashedName: problem-247-squares-under-a-hyperbola
|
||||
@ -8,20 +8,32 @@ dashedName: problem-247-squares-under-a-hyperbola
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the region constrained by 1 ≤ x and 0 ≤ y ≤ 1/x.
|
||||
Considera la regione delimitata da $1 ≤ x$ e $0 ≤ y ≤ \frac{1}{x}$.
|
||||
|
||||
Let S1 be the largest square that can fit under the curve. Let S2 be the largest square that fits in the remaining area, and so on. Let the index of Sn be the pair (left, below) indicating the number of squares to the left of Sn and the number of squares below Sn.
|
||||
Sia $S_1$ il quadrato più grande che può stare sotto la curva.
|
||||
|
||||
The diagram shows some such squares labelled by number. S2 has one square to its left and none below, so the index of S2 is (1,0). It can be seen that the index of S32 is (1,1) as is the index of S50. 50 is the largest n for which the index of Sn is (1,1).
|
||||
Sia $S_2$ il quadrato più grande che si adatta all'area rimanente, e così via.
|
||||
|
||||
What is the largest n for which the index of Sn is (3,3)?
|
||||
Sia l'indice di $S_n$ la coppia (sinistra, sotto) indicante il numero di quadrati a sinistra di $S_n$ e il numero di quadrati sotto $S_n$.
|
||||
|
||||
<img class="img-responsive center-block" alt="diagramma con quadrati sotto l'iperbole" src="https://cdn.freecodecamp.org/curriculum/project-euler/squares-under-a-hyperbola.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Il diagramma mostra alcuni di questi quadrati etichettati per numero.
|
||||
|
||||
$S_2$ ha un quadrato alla sua sinistra e nessuno sotto, quindi l'indice di $S_2$ è (1, 0).
|
||||
|
||||
Si può vedere che l'indice di $S_{32}$ è (1,1) perché è l'indice di $S_{50}$.
|
||||
|
||||
50 è il più grande $n$ per il quale l'indice di $S_n$ è (1, 1).
|
||||
|
||||
Qual è il più grande $n$ per il quale l'indice di $S_n$ è (3, 3)?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler247()` should return 782252.
|
||||
`squaresUnderAHyperbola()` dovrebbe restituire `782252`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler247(), 782252);
|
||||
assert.strictEqual(squaresUnderAHyperbola(), 782252);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +41,12 @@ assert.strictEqual(euler247(), 782252);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler247() {
|
||||
function squaresUnderAHyperbola() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler247();
|
||||
squaresUnderAHyperbola();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4651000cf542c50ff77
|
||||
title: 'Problem 248: Numbers for which Euler’s totient function equals 13!'
|
||||
title: 'Problema 248: Numeri per i quali la funzione toziente di Eulero è uguale a 13!'
|
||||
challengeType: 5
|
||||
forumTopicId: 301895
|
||||
dashedName: problem-248-numbers-for-which-eulers-totient-function-equals-13
|
||||
@ -8,16 +8,16 @@ dashedName: problem-248-numbers-for-which-eulers-totient-function-equals-13
|
||||
|
||||
# --description--
|
||||
|
||||
The first number n for which φ(n)=13! is 6227180929.
|
||||
Il primo numero $n$ per il quale $φ(n) = 13!$ è $6\\,227\\,180\\,929$.
|
||||
|
||||
Find the 150,000th such number.
|
||||
Trova il ${150\\,000}^{\text{mo}}$ di questi numeri.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler248()` should return 23507044290.
|
||||
`eulersTotientFunctionEquals()` dovrebbe restituire `23507044290`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler248(), 23507044290);
|
||||
assert.strictEqual(eulersTotientFunctionEquals(), 23507044290);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +25,12 @@ assert.strictEqual(euler248(), 23507044290);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler248() {
|
||||
function eulersTotientFunctionEquals() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler248();
|
||||
eulersTotientFunctionEquals();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4671000cf542c50ff79
|
||||
title: 'Problem 249: Prime Subset Sums'
|
||||
title: 'Problema 249: Somme di sottoinsiemi di primi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301896
|
||||
dashedName: problem-249-prime-subset-sums
|
||||
@ -8,18 +8,18 @@ dashedName: problem-249-prime-subset-sums
|
||||
|
||||
# --description--
|
||||
|
||||
Let S = {2, 3, 5, ..., 4999} be the set of prime numbers less than 5000.
|
||||
Siano $S = \\{2, 3, 5, \ldots, 4999\\}$ l'insieme di numeri primi minori di 5000.
|
||||
|
||||
Find the number of subsets of S, the sum of whose elements is a prime number.
|
||||
Trova il numero di sottoinsiemi di $S$, la somma dei cui elementi è un numero primo.
|
||||
|
||||
Enter the rightmost 16 digits as your answer.
|
||||
Inserisci le 16 cifre più a destra come risposta.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler249()` should return 9275262564250418.
|
||||
`primeSubsetSums()` dovrebbe restituire `9275262564250418`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler249(), 9275262564250418);
|
||||
assert.strictEqual(primeSubsetSums(), 9275262564250418);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler249(), 9275262564250418);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler249() {
|
||||
function primeSubsetSums() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler249();
|
||||
primeSubsetSums();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4661000cf542c50ff78
|
||||
title: 'Problem 250: 250250'
|
||||
title: 'Problema 250: 250250'
|
||||
challengeType: 5
|
||||
forumTopicId: 301898
|
||||
dashedName: problem-250-250250
|
||||
@ -8,14 +8,14 @@ dashedName: problem-250-250250
|
||||
|
||||
# --description--
|
||||
|
||||
Find the number of non-empty subsets of {11, 22, 33,..., 250250250250}, the sum of whose elements is divisible by 250. Enter the rightmost 16 digits as your answer.
|
||||
Trova il numero di sottoinsiemi non vuoti di $\\{{1}^{1}, {2}^{2}, {3}^{3}, \ldots, {250250}^{250250}\\}$, la somma dei cui elementi è divisibile per 250. Inserisci le 16 cifre più a destra come risposta.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler250()` should return 1425480602091519.
|
||||
`twoHundredFifty()` dovrebbe restituire `1425480602091519`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler250(), 1425480602091519);
|
||||
assert.strictEqual(twoHundredFifty(), 1425480602091519);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -23,12 +23,12 @@ assert.strictEqual(euler250(), 1425480602091519);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler250() {
|
||||
function twoHundredFifty() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler250();
|
||||
twoHundredFifty();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4671000cf542c50ff7a
|
||||
title: 'Problem 251: Cardano Triplets'
|
||||
title: 'Problema 251: Triplette di Cardano'
|
||||
challengeType: 5
|
||||
forumTopicId: 301899
|
||||
dashedName: problem-251-cardano-triplets
|
||||
@ -8,20 +8,22 @@ dashedName: problem-251-cardano-triplets
|
||||
|
||||
# --description--
|
||||
|
||||
A triplet of positive integers (a,b,c) is called a Cardano Triplet if it satisfies the condition:
|
||||
Una tripletta di numeri interi positivi ($a$,$b$,$c$) è chiamata una tripletta di Cardano se soddisfa la condizione:
|
||||
|
||||
For example, (2,1,5) is a Cardano Triplet.
|
||||
$$\sqrt[3]{a + b \sqrt{c}} + \sqrt[3]{a - b \sqrt{c}} = 1$$
|
||||
|
||||
There exist 149 Cardano Triplets for which a+b+c ≤ 1000.
|
||||
Per esempio, (2,1,5) è una tripletta di Cardano.
|
||||
|
||||
Find how many Cardano Triplets exist such that a+b+c ≤ 110,000,000.
|
||||
Esistono 149 triplette di Cardano per le quali $a + b + c ≤ 1000$.
|
||||
|
||||
Trova quante Triplette di Cardano esistono in modo tale che $a + b + c ≤ 110\\,000\\,000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler251()` should return 18946051.
|
||||
`cardanoTriplets()` dovrebbe restituire `18946051`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler251(), 18946051);
|
||||
assert.strictEqual(cardanoTriplets(), 18946051);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +31,12 @@ assert.strictEqual(euler251(), 18946051);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler251() {
|
||||
function cardanoTriplets() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler251();
|
||||
cardanoTriplets();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4691000cf542c50ff7b
|
||||
title: 'Problem 252: Convex Holes'
|
||||
title: 'Problema 252: Fori convessi'
|
||||
challengeType: 5
|
||||
forumTopicId: 301900
|
||||
dashedName: problem-252-convex-holes
|
||||
@ -8,24 +8,26 @@ dashedName: problem-252-convex-holes
|
||||
|
||||
# --description--
|
||||
|
||||
Given a set of points on a plane, we define a convex hole to be a convex polygon having as vertices any of the given points and not containing any of the given points in its interior (in addition to the vertices, other given points may lie on the perimeter of the polygon).
|
||||
Dato un insieme di punti su un piano, definiamo un foro convesso come un poligono convesso avente come vertici uno dei punti indicati e non contenente nessuno dei punti indicati al suo interno (oltre ai vertici, altri punti indicati possono trovarsi sul perimetro del poligono).
|
||||
|
||||
As an example, the image below shows a set of twenty points and a few such convex holes. The convex hole shown as a red heptagon has an area equal to 1049694.5 square units, which is the highest possible area for a convex hole on the given set of points.
|
||||
Ad esempio, l'immagine sottostante mostra una serie di venti punti e alcuni di questi fori convessi. Il foro convesso mostrato come un ettagono rosso ha una superficie pari a 1049694.5 unità quadrate, che è la maggiore area possibile per un foro convesso sull'insieme di punti dato.
|
||||
|
||||
For our example, we used the first 20 points (T2k−1, T2k), for k = 1,2,…,20, produced with the pseudo-random number generator:
|
||||
<img class="img-responsive center-block" alt="insieme di venti punti e fori convessi sul piano" src="https://cdn.freecodecamp.org/curriculum/project-euler/convex-holes.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
S0 = 290797 Sn+1 = Sn2 mod 50515093 Tn = ( Sn mod 2000 ) − 1000
|
||||
Per il nostro esempio, abbiamo usato i primi 20 punti ($T_{2k − 1}$, $T_{2k}$), per $k = 1, 2, \ldots, 20$, prodotto con il generatore di numeri pseudo-casuali:
|
||||
|
||||
i.e. (527, 144), (−488, 732), (−454, −947), …
|
||||
$$\begin{align} S_0 & = 290\\,797 \\\\ S_{n+1} & = {S_n}^2 \\; \text{mod} \\; 50\\,515\\,093 \\\\ T_n & = (S_n \\; \text{mod} \\; 2000) − 1000 \end{align}$$
|
||||
|
||||
What is the maximum area for a convex hole on the set containing the first 500 points in the pseudo-random sequence? Specify your answer including one digit after the decimal point.
|
||||
cioè (527, 144), (−488, 732), (−454, −947), …
|
||||
|
||||
Qual è l'area massima per un foro convesso sul set contenente i primi 500 punti nella sequenza pseudo-casuale? Specifica la tua risposta includendo una cifra dopo il punto decimale.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler252()` should return 104924.
|
||||
`convexHoles()` dovrebbe restituire `104924`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler252(), 104924);
|
||||
assert.strictEqual(convexHoles(), 104924);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +35,12 @@ assert.strictEqual(euler252(), 104924);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler252() {
|
||||
function convexHoles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler252();
|
||||
convexHoles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4691000cf542c50ff7c
|
||||
title: 'Problem 253: Tidying up'
|
||||
title: 'Problema 253: Mettere in ordine'
|
||||
challengeType: 5
|
||||
forumTopicId: 301901
|
||||
dashedName: problem-253-tidying-up
|
||||
@ -8,28 +8,45 @@ dashedName: problem-253-tidying-up
|
||||
|
||||
# --description--
|
||||
|
||||
A small child has a “number caterpillar” consisting of forty jigsaw pieces, each with one number on it, which, when connected together in a line, reveal the numbers 1 to 40 in order.
|
||||
Un bambino piccolo ha un "bruco numeroso" composto da quaranta pezzi, ciascuno con un numero su di esso, che, quando collegati insieme in una linea, rivelano i numeri da 1 a 40 in ordine.
|
||||
|
||||
Every night, the child's father has to pick up the pieces of the caterpillar that have been scattered across the play room. He picks up the pieces at random and places them in the correct order. As the caterpillar is built up in this way, it forms distinct segments that gradually merge together. The number of segments starts at zero (no pieces placed), generally increases up to about eleven or twelve, then tends to drop again before finishing at a single segment (all pieces placed).
|
||||
Ogni notte, il padre del bambino deve raccogliere i pezzi del bruco che sono stati sparsi attraverso la stanza dei giochi. Raccoglie i pezzi a caso e li posiziona nell'ordine corretto.
|
||||
|
||||
For example:
|
||||
Mentre il bruco viene costruito in questo modo, si formano segmenti distinti che gradualmente si fondono insieme. Il numero di segmenti inizia con zero (nessun pezzo posizionato), generalmente aumenta fino a circa undici o dodici, poi tende a scendere di nuovo prima di finire in un singolo segmento (tutti i pezzi posizionati).
|
||||
|
||||
Piece Placed Segments So Far121422936434554354……
|
||||
Per esempio:
|
||||
|
||||
Let M be the maximum number of segments encountered during a random tidy-up of the caterpillar. For a caterpillar of ten pieces, the number of possibilities for each M is
|
||||
| Pezzo Posizionato | Segmenti Fino ad Ora |
|
||||
| ----------------- | -------------------- |
|
||||
| 12 | 1 |
|
||||
| 4 | 2 |
|
||||
| 29 | 3 |
|
||||
| 6 | 4 |
|
||||
| 34 | 5 |
|
||||
| 5 | 4 |
|
||||
| 35 | 4 |
|
||||
| … | … |
|
||||
|
||||
M Possibilities1512 2250912 31815264 41418112 5144000
|
||||
Sia $M$ il numero massimo di segmenti incontrati durante un riordino casuale del bruco. Per un bruco di dieci pezzi, il numero di possibilità per ogni $M$ è
|
||||
|
||||
so the most likely value of M is 3 and the average value is 385643⁄113400 = 3.400732, rounded to six decimal places.
|
||||
| M | Possibilità |
|
||||
| - | ----------- |
|
||||
| 1 | 512 |
|
||||
| 2 | 250912 |
|
||||
| 3 | 1815264 |
|
||||
| 4 | 1418112 |
|
||||
| 5 | 144000 |
|
||||
|
||||
The most likely value of M for a forty-piece caterpillar is 11; but what is the average value of M? Give your answer rounded to six decimal places.
|
||||
quindi il valore più probabile di $M$ è 3 e il valore medio è $\frac{385\\,643}{113\\,400} = 3.400732$, arrotondato a sei decimali.
|
||||
|
||||
Il valore più probabile di $M$ per un bruco a quaranta pezzi è 11; ma qual è il valore medio di $M$? Dai la risposta arrotondata a sei decimali.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler253()` should return 11.492847.
|
||||
`tidyingUp()` dovrebbe restituire `11.492847`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler253(), 11.492847);
|
||||
assert.strictEqual(tidyingUp(), 11.492847);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -37,12 +54,12 @@ assert.strictEqual(euler253(), 11.492847);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler253() {
|
||||
function tidyingUp() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler253();
|
||||
tidyingUp();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46b1000cf542c50ff7d
|
||||
title: 'Problem 254: Sums of Digit Factorials'
|
||||
title: 'Problema 254: Somme dei fattoriali delle cifre'
|
||||
challengeType: 5
|
||||
forumTopicId: 301902
|
||||
dashedName: problem-254-sums-of-digit-factorials
|
||||
@ -8,24 +8,24 @@ dashedName: problem-254-sums-of-digit-factorials
|
||||
|
||||
# --description--
|
||||
|
||||
Define f(n) as the sum of the factorials of the digits of n. For example, f(342) = 3! + 4! + 2! = 32.
|
||||
Sia $f(n)$ la somma dei fattoriali delle cifre di $n$. Per esempio, $f(342) = 3! + 4! + 2! = 32$.
|
||||
|
||||
Define sf(n) as the sum of the digits of f(n). So sf(342) = 3 + 2 = 5.
|
||||
Definisci $sf(n)$ come la somma delle cifre di $f(n)$. Quindi $sf(342) = 3 + 2 = 5$.
|
||||
|
||||
Define g(i) to be the smallest positive integer n such that sf(n) = i. Though sf(342) is 5, sf(25) is also 5, and it can be verified that g(5) is 25.
|
||||
Definisci $g(i)$ in modo che sia il più piccolo numero intero positivo $n$ tale che $sf(n) = i$. Anche se $sf(342)$ è 5, $sf(25)$ è anch'esso 5, e si può verificare che $g(5)$ è 25.
|
||||
|
||||
Define sg(i) as the sum of the digits of g(i). So sg(5) = 2 + 5 = 7.
|
||||
Definisci $sg(i)$ come la somma delle cifre di $g(i)$. Quindi $sg(5) = 2 + 5 = 7$.
|
||||
|
||||
Further, it can be verified that g(20) is 267 and ∑ sg(i) for 1 ≤ i ≤ 20 is 156.
|
||||
Inoltre, può essere verificato che $g(20)$ è 267 e $\sum sg(i)$ per $1 ≤ i ≤ 20$ è 156.
|
||||
|
||||
What is ∑ sg(i) for 1 ≤ i ≤ 150?
|
||||
Che cosa è $\sum sg(i)$ per $1 ≤ i ≤ 150$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler254()` should return 8184523820510.
|
||||
`sumsOfDigitFactorials()` dovrebbe restituire `8184523820510`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler254(), 8184523820510);
|
||||
assert.strictEqual(sumsOfDigitFactorials(), 8184523820510);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler254(), 8184523820510);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler254() {
|
||||
function sumsOfDigitFactorials() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler254();
|
||||
sumsOfDigitFactorials();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46d1000cf542c50ff7f
|
||||
title: 'Problem 255: Rounded Square Roots'
|
||||
title: 'Problema 255: Radici Quadrate Arrotondate'
|
||||
challengeType: 5
|
||||
forumTopicId: 301903
|
||||
dashedName: problem-255-rounded-square-roots
|
||||
@ -8,26 +8,42 @@ dashedName: problem-255-rounded-square-roots
|
||||
|
||||
# --description--
|
||||
|
||||
We define the rounded-square-root of a positive integer n as the square root of n rounded to the nearest integer.
|
||||
Definiamo la radice-quadrata-arrotondata di un intero positivo $n$ come la radice quadrata di $n$ arrotondata al numero intero più vicino.
|
||||
|
||||
The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of n: Let d be the number of digits of the number n. If d is odd, set x0 = 2×10(d-1)⁄2. If d is even, set x0 = 7×10(d-2)⁄2. Repeat:
|
||||
La seguente procedura (essenzialmente il metodo di Heron adattato a interi aritmetici) trova la radice-quadrata-arrotondata di $n$:
|
||||
|
||||
until xk+1 = xk.
|
||||
Sia $d$ il numero di cifre del numero $n$.
|
||||
|
||||
As an example, let us find the rounded-square-root of n = 4321.n has 4 digits, so x0 = 7×10(4-2)⁄2 = 70. Since x2 = x1, we stop here. So, after just two iterations, we have found that the rounded-square-root of 4321 is 66 (the actual square root is 65.7343137…).
|
||||
Se $d$ è dispari, imposta $x_0 = 2 × {10}^{\frac{d - 1}{2}}$.
|
||||
|
||||
The number of iterations required when using this method is surprisingly low. For example, we can find the rounded-square-root of a 5-digit integer (10,000 ≤ n ≤ 99,999) with an average of 3.2102888889 iterations (the average value was rounded to 10 decimal places).
|
||||
Se $d$ è pari, imposta $x_0 = 7 × {10}^{\frac{d - 2}{2}}$.
|
||||
|
||||
Using the procedure described above, what is the average number of iterations required to find the rounded-square-root of a 14-digit number (1013 ≤ n < 1014)? Give your answer rounded to 10 decimal places.
|
||||
Ripeti:
|
||||
|
||||
Note: The symbols ⌊x⌋ and ⌈x⌉ represent the floor function and ceiling function respectively.
|
||||
$$x_{k + 1} = \left\lfloor\frac{x_k + \left\lceil\frac{n}{x_k}\right\rceil}{2}\right\rfloor$$
|
||||
|
||||
fino a $x_{k + 1} = x_k$.
|
||||
|
||||
Ad esempio, cerchiamo di trovare la radice-quadrata-arrotondata di $n = 4321$.
|
||||
|
||||
$n$ ha 4 cifre, quindi $x_0 = 7 × {10}^{\frac{4-2}{2}} = 70$.
|
||||
|
||||
$$x_1 = \left\lfloor\frac{70 + \left\lceil\frac{4321}{70}\right\rceil}{2}\right\rfloor = 66 \\\\ x_2 = \left\lfloor\frac{66 + \left\lceil\frac{4321}{66}\right\rceil}{2}\right\rfloor = 66$$
|
||||
|
||||
Dal momento che $x_2 = x_1$, ci fermiamo qui. Così, dopo solo due iterazioni, abbiamo scoperto che la radice-quadrata-arrotondata di 4321 è 66 (la vera radice quadrata è 65.7343137…).
|
||||
|
||||
Il numero d'iterazioni richieste quando si utilizza questo metodo è sorprendentemente basso. Ad esempio, possiamo trovare la radice-quadrata-arrotondato di un intero a 5 cifre ($10\\,000 ≤ n ≤ 99\\,999$) con una media di 3.2102888889 iterazioni (il valore medio è stato arrotondato al decimo decimale).
|
||||
|
||||
In base alla procedura sopra descritta, qual è il numero medio di iterazioni richieste per trovare la radice-quadrata-arrotondata di un numero a 14 cifre (${10}^{13} ≤ n < {10}^{14}$)? Dai la risposta arrotondata a 10 decimali.
|
||||
|
||||
**Nota:** I simboli $⌊x⌋$ e $⌈x⌉$ rappresentano rispettivamente la funzione arrotonda verso il basso e arrotonda verso l'alto.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler255()` should return 4.447401118.
|
||||
`roundedSquareRoots()` dovrebbe restituire `4.447401118`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler255(), 4.447401118);
|
||||
assert.strictEqual(roundedSquareRoots(), 4.447401118);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +51,12 @@ assert.strictEqual(euler255(), 4.447401118);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler255() {
|
||||
function roundedSquareRoots() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler255();
|
||||
roundedSquareRoots();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46c1000cf542c50ff7e
|
||||
title: 'Problem 256: Tatami-Free Rooms'
|
||||
title: 'Problema 256: Stanze senza tatami'
|
||||
challengeType: 5
|
||||
forumTopicId: 301904
|
||||
dashedName: problem-256-tatami-free-rooms
|
||||
@ -8,30 +8,32 @@ dashedName: problem-256-tatami-free-rooms
|
||||
|
||||
# --description--
|
||||
|
||||
Tatami are rectangular mats, used to completely cover the floor of a room, without overlap.
|
||||
I Tatami sono stuoie rettangolari, utilizzate per coprire completamente il pavimento di una stanza, senza sovrapposizioni.
|
||||
|
||||
Assuming that the only type of available tatami has dimensions 1×2, there are obviously some limitations for the shape and size of the rooms that can be covered.
|
||||
Supponendo che l'unico tipo di tatami disponibile abbia dimensioni 1×2, ci sono ovviamente alcune limitazioni per la forma e le dimensioni delle camere che possono essere coperte.
|
||||
|
||||
For this problem, we consider only rectangular rooms with integer dimensions a, b and even size s = a·b. We use the term 'size' to denote the floor surface area of the room, and — without loss of generality — we add the condition a ≤ b.
|
||||
Per questo problema, consideriamo solo le stanze rettangolari con dimensioni intere $a$, $b$ e anche la dimensione $s = a \times b$. Usiamo il termine 'dimensione' per indicare la superficie del pavimento della stanza, e — senza perdita di generalità — aggiungiamo la condizione $a ≤ b$.
|
||||
|
||||
There is one rule to follow when laying out tatami: there must be no points where corners of four different mats meet. For example, consider the two arrangements below for a 4×4 room:
|
||||
C'è una regola da seguire quando si posa il tatami: non ci devono essere punti in cui gli angoli di quattro tappeti diversi si incontrano. Per esempio, considerare le due disposizioni qui sotto per una stanza di dimensioni 4×4:
|
||||
|
||||
The arrangement on the left is acceptable, whereas the one on the right is not: a red "X" in the middle, marks the point where four tatami meet.
|
||||
<img class="img-responsive center-block" alt="due disposizioni di tatami in una stanza 4x4" src="https://cdn.freecodecamp.org/curriculum/project-euler/tatami-free-rooms.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Because of this rule, certain even-sized rooms cannot be covered with tatami: we call them tatami-free rooms. Further, we define T(s) as the number of tatami-free rooms of size s.
|
||||
La disposizione a sinistra è accettabile, mentre quello a destra non lo è: una "<strong><span style="color: red;">X</span></strong>" rossa nel mezzo segna il punto in cui si incontrano quattro tatami.
|
||||
|
||||
The smallest tatami-free room has size s = 70 and dimensions 7×10. All the other rooms of size s = 70 can be covered with tatami; they are: 1×70, 2×35 and 5×14. Hence, T(70) = 1.
|
||||
A causa di questa regola, certe stanze di dimensioni pari non possono essere coperte con tatami: li chiamiamo stanze senza tatami. Inoltre, definiamo $T(s)$ come il numero di stanze senza tatami di dimensione $s$.
|
||||
|
||||
Similarly, we can verify that T(1320) = 5 because there are exactly 5 tatami-free rooms of size s = 1320: 20×66, 22×60, 24×55, 30×44 and 33×40. In fact, s = 1320 is the smallest room-size s for which T(s) = 5.
|
||||
La più piccola camera senza tatami ha dimensioni $s = 70$ e dimensioni 7×10. Tutte le altre stanze della dimensione $s = 70$ possono essere coperte con tatami; sono: 1×70, 2×35 e 5×14. Quindi, $T(70) = 1$.
|
||||
|
||||
Find the smallest room-size s for which T(s) = 200.
|
||||
Allo stesso modo, possiamo verificare che $T(1320) = 5$ perché ci sono esattamente 5 stanze senza tatami di dimensioni $s = 1320$: 20×66, 22×60, 24×55, 30×44 e 33×40. Infatti, $s = 1320$ è la dimensione della stanza più piccola $s$ per cui $T(s) = 5$.
|
||||
|
||||
Trova la dimensione della stanza più piccola $s$ per cui $T(s) = 200$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler256()` should return 85765680.
|
||||
`tatamiFreeRooms()` dovrebbe restituire `85765680`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler256(), 85765680);
|
||||
assert.strictEqual(tatamiFreeRooms(), 85765680);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +41,12 @@ assert.strictEqual(euler256(), 85765680);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler256() {
|
||||
function tatamiFreeRooms() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler256();
|
||||
tatamiFreeRooms();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46e1000cf542c50ff80
|
||||
title: 'Problem 257: Angular Bisectors'
|
||||
title: 'Problema 257: Bisettrici angolari'
|
||||
challengeType: 5
|
||||
forumTopicId: 301905
|
||||
dashedName: problem-257-angular-bisectors
|
||||
@ -8,22 +8,22 @@ dashedName: problem-257-angular-bisectors
|
||||
|
||||
# --description--
|
||||
|
||||
Given is an integer sided triangle ABC with sides a ≤ b ≤ c.
|
||||
Dato un triangolo con lati interi $ABC$ con lati $a ≤ b ≤ c$. ($AB = c$, $BC = a$ and $AC = b$).
|
||||
|
||||
(AB = c, BC = a and AC = b).
|
||||
Le bisettrici angolari del triangolo intersecano i lati ai punti $E$, $F$ e $G$ (vedi la figura sotto).
|
||||
|
||||
The angular bisectors of the triangle intersect the sides at points E, F and G (see picture below).
|
||||
<img class="img-responsive center-block" alt="triangolo ABC, con bisettrici angolari intersecanti i lati ai punti E, F e G" src="https://cdn.freecodecamp.org/curriculum/project-euler/angular-bisectors.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
The segments EF, EG and FG partition the triangle ABC into four smaller triangles: AEG, BFE, CGF and EFG. It can be proven that for each of these four triangles the ratio area(ABC)/area(subtriangle) is rational. However, there exist triangles for which some or all of these ratios are integral.
|
||||
I segmenti $EF$, $EG$, e $FG$, sezionano il triangolo $ABC$ in quattro triangoli più piccoli: $AEG$, $BFE$, $CGF$ e $EFG$. Si può provare che per ognuno di questi quattro triangoli il rapporto $\frac{\text{area}(ABC)}{\text{area}(\text{sottotriangolo})}$ è razionale. Eppure, ci sono alcuni triangoli per cui alcuni o tutti di questi rapporti sono numeri interi.
|
||||
|
||||
How many triangles ABC with perimeter≤100,000,000 exist so that the ratio area(ABC)/area(AEG) is integral?
|
||||
Quanti triangoli $ABC$ con perimetro $≤ 100\\,000\\,000$ esistono in modo tale che il rapporto $\frac{\text{area}(ABC)}{\text{area}(AEG)}$ sia un numero intero?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler257()` should return 139012411.
|
||||
`angularBisectors()` dovrebbe restituire `139012411`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler257(), 139012411);
|
||||
assert.strictEqual(angularBisectors(), 139012411);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler257(), 139012411);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler257() {
|
||||
function angularBisectors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler257();
|
||||
angularBisectors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46e1000cf542c50ff81
|
||||
title: 'Problem 258: A lagged Fibonacci sequence'
|
||||
title: 'Problema 258: Una sequenza di Fibonacci ritardata'
|
||||
challengeType: 5
|
||||
forumTopicId: 301906
|
||||
dashedName: problem-258-a-lagged-fibonacci-sequence
|
||||
@ -8,16 +8,19 @@ dashedName: problem-258-a-lagged-fibonacci-sequence
|
||||
|
||||
# --description--
|
||||
|
||||
A sequence is defined as:
|
||||
Una sequenza è definita come:
|
||||
|
||||
gk = 1, for 0 ≤ k ≤ 1999 gk = gk-2000 + gk-1999, for k ≥ 2000. Find gk mod 20092010 for k = 1018.
|
||||
- $g_k = 1$, per $0 ≤ k ≤ 1999$
|
||||
- $g_k = g_{k - 2000} + g_{k - 1999}$, per $k ≥ 2000$.
|
||||
|
||||
Trova $g_k$ mod 20092010 per $k = {10}^{18}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler258()` should return 12747994.
|
||||
`laggedFibonacciSequence()` dovrebbe restituire `12747994`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler258(), 12747994);
|
||||
assert.strictEqual(laggedFibonacciSequence(), 12747994);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +28,12 @@ assert.strictEqual(euler258(), 12747994);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler258() {
|
||||
function laggedFibonacciSequence() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler258();
|
||||
laggedFibonacciSequence();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4701000cf542c50ff82
|
||||
title: 'Problem 259: Reachable Numbers'
|
||||
title: 'Problema 259: Numeri Raggiungibili'
|
||||
challengeType: 5
|
||||
forumTopicId: 301907
|
||||
dashedName: problem-259-reachable-numbers
|
||||
@ -8,18 +8,25 @@ dashedName: problem-259-reachable-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A positive integer will be called reachable if it can result from an arithmetic expression obeying the following rules:
|
||||
Un intero positivo sarà chiamato raggiungibile se può derivare da un'espressione aritmetica che obbedisce alle seguenti regole:
|
||||
|
||||
Uses the digits 1 through 9, in that order and exactly once each. Any successive digits can be concatenated (for example, using the digits 2, 3 and 4 we obtain the number 234). Only the four usual binary arithmetic operations (addition, subtraction, multiplication and division) are allowed. Each operation can be used any number of times, or not at all. Unary minus is not allowed. Any number of (possibly nested) parentheses may be used to define the order of operations. For example, 42 is reachable, since (1/23) *((4*5)-6) \* (78-9) = 42.
|
||||
- Usa le cifre da 1 a 9, in quest'ordine ed esattamente una volta ciascuna.
|
||||
- Eventuali cifre successive possono essere concatenate (ad esempio, utilizzando le cifre 2, 3 e 4 otteniamo il numero 234).
|
||||
- Sono ammesse solo le quattro normali operazioni aritmetiche binarie (somma, sottrazione, moltiplicazione e divisione).
|
||||
- Ogni operazione può essere utilizzata qualsiasi numero di volte, o non essere usata affatto.
|
||||
- Il meno unario non è permesso.
|
||||
- Qualsiasi numero di parentesi (eventualmente annidate) può essere utilizzato per definire l'ordine delle operazioni.
|
||||
|
||||
What is the sum of all positive reachable integers?
|
||||
Ad esempio, 42 è raggiungibile, poiché $\frac{1}{23} \times ((4 \times 5) - 6) \times (78 - 9) = 42$.
|
||||
|
||||
Qual è la somma di tutti gli interi raggiungibili positivi?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler259()` should return 20101196798.
|
||||
`reachableNumbers()` dovrebbe restituire `20101196798`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler259(), 20101196798);
|
||||
assert.strictEqual(reachableNumbers(), 20101196798);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +34,12 @@ assert.strictEqual(euler259(), 20101196798);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler259() {
|
||||
function reachableNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler259();
|
||||
reachableNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4701000cf542c50ff83
|
||||
title: 'Problem 260: Stone Game'
|
||||
title: 'Problema 260: Gioco delle pietre'
|
||||
challengeType: 5
|
||||
forumTopicId: 301909
|
||||
dashedName: problem-260-stone-game
|
||||
@ -8,26 +8,36 @@ dashedName: problem-260-stone-game
|
||||
|
||||
# --description--
|
||||
|
||||
A game is played with three piles of stones and two players.
|
||||
Un gioco si gioca con tre mucchi di pietre e due giocatori.
|
||||
|
||||
At her turn, a player removes one or more stones from the piles. However, if she takes stones from more than one pile, she must remove the same number of stones from each of the selected piles.
|
||||
Al turno di ogni giocatore, il giocatore rimuove una o più pietre dai mucchi. Tuttavia, se il giocatore preleva pietre da più di una pila, lo stesso numero di pietre deve essere rimosso da ciascuna delle pile selezionate.
|
||||
|
||||
In other words, the player chooses some N>0 and removes: N stones from any single pile; or N stones from each of any two piles (2N total); or N stones from each of the three piles (3N total). The player taking the last stone(s) wins the game.
|
||||
In altre parole, il giocatore sceglie alcuni $N > 0$ e rimuove:
|
||||
|
||||
A winning configuration is one where the first player can force a win. For example, (0,0,13), (0,11,11) and (5,5,5) are winning configurations because the first player can immediately remove all stones.
|
||||
- $N$ pietre da una singola pila qualsiasi; o
|
||||
- $N$ pietre da due pile qualsiasi ($2N$ totale); o
|
||||
- $N$ pietre da ciascuna delle tre pile ($3N$ totale).
|
||||
|
||||
A losing configuration is one where the second player can force a win, no matter what the first player does. For example, (0,1,2) and (1,3,3) are losing configurations: any legal move leaves a winning configuration for the second player.
|
||||
Il giocatore che prende l'ultima pietra vince la partita.
|
||||
|
||||
Consider all losing configurations (xi,yi,zi) where xi ≤ yi ≤ zi ≤ 100. We can verify that Σ(xi+yi+zi) = 173895 for these.
|
||||
Una configurazione vincente è quella in cui il primo giocatore può forzare una vittoria.
|
||||
|
||||
Find Σ(xi+yi+zi) where (xi,yi,zi) ranges over the losing configurations with xi ≤ yi ≤ zi ≤ 1000.
|
||||
Ad esempio, (0,0,13), (0,11,11) e (5,5,5) sono configurazioni vincenti perché il primo giocatore può immediatamente rimuovere tutte le pietre.
|
||||
|
||||
Una configurazione perdente è quella in cui il secondo giocatore può forzare una vittoria, indipendentemente da ciò che fa il primo giocatore.
|
||||
|
||||
Ad esempio, (0,1,2) e (1,3,3) sono configurazioni perdenti: qualsiasi mossa lecita lascia una configurazione vincente per il secondo giocatore.
|
||||
|
||||
Considera tutte le configurazioni perdenti ($x_i$,$y_i$,$z_i$) dove $x_i ≤ y_i ≤ z_i ≤ 100$. Possiamo verificare che $\sum (x_i + y_i + z_i) = 173\\,895$ per queste.
|
||||
|
||||
Trova $\sum (x_i + y_i + z_i)$ dove ($x_i$,$y_i$,$z_i$) varia sulle configurazioni perdenti con $x_i ≤ y_i ≤ z_i ≤ 1000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler260()` should return 167542057.
|
||||
`stoneGame()` dovrebbe restituire `167542057`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler260(), 167542057);
|
||||
assert.strictEqual(stoneGame(), 167542057);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +45,12 @@ assert.strictEqual(euler260(), 167542057);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler260() {
|
||||
function stoneGame() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler260();
|
||||
stoneGame();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4711000cf542c50ff84
|
||||
title: 'Problem 261: Pivotal Square Sums'
|
||||
title: 'Problem 261: Somme di quadrati principali'
|
||||
challengeType: 5
|
||||
forumTopicId: 301910
|
||||
dashedName: problem-261-pivotal-square-sums
|
||||
@ -8,18 +8,22 @@ dashedName: problem-261-pivotal-square-sums
|
||||
|
||||
# --description--
|
||||
|
||||
Let us call a positive integer k a square-pivot, if there is a pair of integers m > 0 and n ≥ k, such that the sum of the (m+1) consecutive squares up to k equals the sum of the m consecutive squares from (n+1) on:
|
||||
Sia $k$ un numero intero positivo detto square-pivot se c'è una coppia di numeri interi $m > 0$ e $n ≥ k$, cossìcché la somma dei ($m + 1$) quadrati consecutivi fino a $k$ sia guale alla somma dei $m$ quadrati consecutivi a partire da ($n + 1$):
|
||||
|
||||
(k-m)2 + ... + k2 = (n+1)2 + ... + (n+m)2.
|
||||
$${(k - m)}^2 + \ldots + k^2 = {(n + 1)}^2 + \ldots + {(n + m)}^2$$
|
||||
|
||||
Some small square-pivots are 4: 32 + 42 = 52 21: 202 + 212 = 292 24: 212 + 222 + 232 + 242 = 252 + 262 + 272 110: 1082 + 1092 + 1102 = 1332 + 1342Find the sum of all distinct square-pivots ≤ 1010.
|
||||
Alcuni piccoli square-pivot sono
|
||||
|
||||
$$\begin{align} & \mathbf{4}: 3^2 + \mathbf{4}^2 = 5^2 \\\\ & \mathbf{21}: {20}^2 + \mathbf{21}^2 = {29}^2 \\\\ & \mathbf{24}: {21}^2 + {22}^2 + {23}^2 + \mathbf{24}^2 = {25}^2 + {26}^2 + {27}^2 \\\\ & \mathbf{110}: {108}^2 + {109}^2 + \mathbf{110}^2 = {133}^2 + {134}^2 \\\\ \end{align}$$
|
||||
|
||||
Trova la somma dei square pivot distinti $≤ {10}^{10}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler261()` should return 238890850232021.
|
||||
`pivotalSquareSums()` dovrebbe restituire `238890850232021`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler261(), 238890850232021);
|
||||
assert.strictEqual(pivotalSquareSums(), 238890850232021);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +31,12 @@ assert.strictEqual(euler261(), 238890850232021);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler261() {
|
||||
function pivotalSquareSums() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler261();
|
||||
pivotalSquareSums();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4731000cf542c50ff85
|
||||
title: 'Problem 262: Mountain Range'
|
||||
title: 'Problema 262: Catena montuosa'
|
||||
challengeType: 5
|
||||
forumTopicId: 301911
|
||||
dashedName: problem-262-mountain-range
|
||||
@ -8,24 +8,26 @@ dashedName: problem-262-mountain-range
|
||||
|
||||
# --description--
|
||||
|
||||
The following equation represents the continuous topography of a mountainous region, giving the elevation h at any point (x,y):
|
||||
La seguente equazione rappresenta la topografia continua di una regione montuosa, dando l'elevazione $h$ in qualsiasi punto ($x$,$y$):
|
||||
|
||||
A mosquito intends to fly from A(200,200) to B(1400,1400), without leaving the area given by 0 ≤ x, y ≤ 1600.
|
||||
$$h = \left(5000 - \frac{x^2 + y^2 + xy}{200} + \frac{25(x + y)}{2}\right) \times e^{-\left|\frac{x^2 + y^2}{1\\,000\\,000} - \frac{3(x + y)}{2000} + \frac{7}{10}\right|}$$
|
||||
|
||||
Because of the intervening mountains, it first rises straight up to a point A', having elevation f. Then, while remaining at the same elevation f, it flies around any obstacles until it arrives at a point B' directly above B.
|
||||
Una zanzara intende volare da A(200,200) a B(1400,1400), senza lasciare l'area data da $0 ≤ x$, $y ≤ 1600$.
|
||||
|
||||
First, determine fmin which is the minimum constant elevation allowing such a trip from A to B, while remaining in the specified area. Then, find the length of the shortest path between A' and B', while flying at that constant elevation fmin.
|
||||
A causa delle montagne, si alza prima fino a un punto A', con elevazione $f$. Poi, rimanendo alla stessa elevazione $f$, vola intorno a qualsiasi ostacolo fino a quando non arriva a un punto B' direttamente sopra B.
|
||||
|
||||
Give that length as your answer, rounded to three decimal places.
|
||||
Per prima cosa, determina $f_{min}$ che è l'elevazione costante minima che consente un tale viaggio da A a B, rimanendo nell'area specificata. Quindi, trova la lunghezza del percorso più breve tra A' e B', volando a quell'elevazione costante $f_{min}$.
|
||||
|
||||
Note: For convenience, the elevation function shown above is repeated below, in a form suitable for most programming languages: h=( 5000-0.005*(x*x+y*y+x*y)+12.5*(x+y) )* exp( -abs(0.000001*(x*x+y*y)-0.0015*(x+y)+0.7) )
|
||||
Dare quella lunghezza come risposta, arrotondata al terzo decimale.
|
||||
|
||||
**Nota:** Per comodità, la funzione di elevazione mostrata sopra viene ripetuta qui sotto, in una forma adatta alla maggior parte dei linguaggi di programmazione: `h=( 5000-0.005*(x*x+y*y+x*y)+12.5*(x+y) )* exp( -abs(0.000001*(x*x+y*y)-0.0015*(x+y)+0.7) )`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler262()` should return 2531.205.
|
||||
`mountainRange()` dovrebbe restituire `2531.205`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler262(), 2531.205);
|
||||
assert.strictEqual(mountainRange(), 2531.205);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +35,12 @@ assert.strictEqual(euler262(), 2531.205);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler262() {
|
||||
function mountainRange() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler262();
|
||||
mountainRange();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4741000cf542c50ff86
|
||||
title: 'Problem 263: An engineers'' dream come true'
|
||||
title: 'Problema 263: Un sogno degli ingegneri diventa realtà'
|
||||
challengeType: 5
|
||||
forumTopicId: 301912
|
||||
dashedName: problem-263-an-engineers-dream-come-true
|
||||
@ -8,30 +8,33 @@ dashedName: problem-263-an-engineers-dream-come-true
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the number 6. The divisors of 6 are: 1,2,3 and 6.
|
||||
Considera il numero 6. I divisori di 6 sono: 1,2,3 e 6.
|
||||
|
||||
Every number from 1 up to and including 6 can be written as a sum of distinct divisors of 6:
|
||||
Ogni numero da 1 fino a 6 può essere scritto come una somma di divisori distinti di 6:
|
||||
|
||||
1=1, 2=2, 3=1+2, 4=1+3, 5=2+3, 6=6.
|
||||
$1 = 1$, $2 = 2$, $3 = 1 + 2$, $4 = 1 + 3$, $5 = 2 + 3$, $6 = 6$.
|
||||
|
||||
A number n is called a practical number if every number from 1 up to and including n can be expressed as a sum of distinct divisors of n.
|
||||
Un numero $n$ è chiamato un numero pratico se ogni numero da 1 a $n$ può essere espresso come una somma di divisori distinti di $n$.
|
||||
|
||||
A pair of consecutive prime numbers with a difference of six is called a sexy pair (since "sex" is the Latin word for "six"). The first sexy pair is (23, 29).
|
||||
Un paio di numeri primi consecutivi con una differenza di sei è chiamato una coppia sexy (dal momento che "sex" è la parola latina per "sei"). La prima coppia sexy è (23, 29).
|
||||
|
||||
We may occasionally find a triple-pair, which means three consecutive sexy prime pairs, such that the second member of each pair is the first member of the next pair.
|
||||
Potremmo occasionalmente trovare una tripla-coppia, che significa tre coppie sexy consecutive, tale che il secondo membro di ogni coppia sia il primo membro della coppia successiva.
|
||||
|
||||
We shall call a number n such that : (n-9, n-3), (n-3,n+3), (n+3, n+9) form a triple-pair, and the numbers n-8, n-4, n, n+4 and n+8 are all practical,
|
||||
Sia $n$ un numero che:
|
||||
|
||||
an engineers’ paradise.
|
||||
- ($n - 9$, $n - 3$), ($n - 3$, $n + 3$), ($n + 3$, $n + 9$) formano una coppia tripla, e
|
||||
- i numeri $n - 8$, $n - 4$, $n$, $n + 4$ e $n + 8$ sono tutti pratici,
|
||||
|
||||
Find the sum of the first four engineers’ paradises.
|
||||
un paradiso degli ingegneri.
|
||||
|
||||
Trova la somma dei primi quattro paradisi degli ingegneri.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler263()` should return 2039506520.
|
||||
`engineersDreamComeTrue()` dovrebbe restituire `2039506520`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler263(), 2039506520);
|
||||
assert.strictEqual(engineersDreamComeTrue(), 2039506520);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +42,12 @@ assert.strictEqual(euler263(), 2039506520);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler263() {
|
||||
function engineersDreamComeTrue() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler263();
|
||||
engineersDreamComeTrue();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4751000cf542c50ff87
|
||||
title: 'Problem 264: Triangle Centres'
|
||||
title: 'Problema 264: Centri dei Triangoli'
|
||||
challengeType: 5
|
||||
forumTopicId: 301913
|
||||
dashedName: problem-264-triangle-centres
|
||||
@ -8,30 +8,47 @@ dashedName: problem-264-triangle-centres
|
||||
|
||||
# --description--
|
||||
|
||||
Consider all the triangles having:
|
||||
Considera tutti i triangoli che hanno:
|
||||
|
||||
All their vertices on lattice points.
|
||||
- Tutti i vertici su punti del reticolo.
|
||||
- Circocentro all'origine O.
|
||||
- Ortocentro al punto H(5, 0).
|
||||
|
||||
Circumcentre at the origin O.
|
||||
Ci sono nove di questi triangoli che hanno un $\text{perimetro} ≤ 50$.
|
||||
|
||||
Orthocentre at the point H(5, 0).
|
||||
Elencati e mostrati in ordine crescente del loro perimetro, questi sono:
|
||||
|
||||
There are nine such triangles having a perimeter ≤ 50.
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
A(-4, 3), B(5, 0), C(4, -3)<br>
|
||||
A(4, 3), B(5, 0), C(-4, -3)<br>
|
||||
A(-3, 4), B(5, 0), C(3, -4)<br>
|
||||
<br><br>
|
||||
A(3, 4), B(5, 0), C(-3, -4)<br>
|
||||
A(0, 5), B(5, 0), C(0, -5)<br>
|
||||
A(1, 8), B(8, -1), C(-4, -7)<br>
|
||||
<br><br>
|
||||
A(8, 1), B(1, -8), C(-4, 7)<br>
|
||||
A(2, 9), B(9, -2), C(-6, -7)<br>
|
||||
A(9, 2), B(2, -9), C(-6, 7)<br>
|
||||
</td>
|
||||
<td><img class="img-responsive center-block" alt="nove triangoli ABC con perimetro ≤ 50" src="https://cdn.freecodecamp.org/curriculum/project-euler/triangle-centres.gif" style="background-color: white; padding: 10px;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Listed and shown in ascending order of their perimeter, they are:
|
||||
La somma dei loro perimetri, arrotondata al quarto decimale, è di 291.0089.
|
||||
|
||||
A(-4, 3), B(5, 0), C(4, -3) A(4, 3), B(5, 0), C(-4, -3) A(-3, 4), B(5, 0), C(3, -4) A(3, 4), B(5, 0), C(-3, -4) A(0, 5), B(5, 0), C(0, -5) A(1, 8), B(8, -1), C(-4, -7) A(8, 1), B(1, -8), C(-4, 7) A(2, 9), B(9, -2), C(-6, -7) A(9, 2), B(2, -9), C(-6, 7)
|
||||
|
||||
The sum of their perimeters, rounded to four decimal places, is 291.0089.
|
||||
|
||||
Find all such triangles with a perimeter ≤ 105. Enter as your answer the sum of their perimeters rounded to four decimal places.
|
||||
Trova tutti questi triangoli con un $\text{perimeter} ≤ {10}^5$. Inserisci come risposta la somma dei loro perimetri arrotondata a quattro decimali.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler264()` should return 2816417.1055.
|
||||
`triangleCentres()` dovrebbe restituire `2816417.1055`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler264(), 2816417.1055);
|
||||
assert.strictEqual(triangleCentres(), 2816417.1055);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +56,12 @@ assert.strictEqual(euler264(), 2816417.1055);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler264() {
|
||||
function triangleCentres() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler264();
|
||||
triangleCentres();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4761000cf542c50ff88
|
||||
title: 'Problem 265: Binary Circles'
|
||||
title: 'Problema 265: Cerchi binari'
|
||||
challengeType: 5
|
||||
forumTopicId: 301914
|
||||
dashedName: problem-265-binary-circles
|
||||
@ -8,24 +8,29 @@ dashedName: problem-265-binary-circles
|
||||
|
||||
# --description--
|
||||
|
||||
2N binary digits can be placed in a circle so that all the N-digit clockwise subsequences are distinct.
|
||||
$2^N$ cifre binarie possono essere posizionate in un cerchio in modo che tutte le sequenze di $N$ cifre in senso orario siano distinte.
|
||||
|
||||
For N=3, two such circular arrangements are possible, ignoring rotations:
|
||||
Per $N = 3$, due di queste disposizioni circolari sono possibili, ignorando le rotazioni:
|
||||
|
||||
For the first arrangement, the 3-digit subsequences, in clockwise order, are: 000, 001, 010, 101, 011, 111, 110 and 100.
|
||||
<img class="img-responsive center-block" alt="due disposizioni circolari per N = 3" src="https://cdn.freecodecamp.org/curriculum/project-euler/binary-circles.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for N=3 are thus represented as 23 and 29: 00010111 2 = 23 00011101 2 = 29
|
||||
Per la prima disposizione, le successioni a tre cifre, in ordine orario, sono: 000, 001, 010, 101, 011, 111, 110 e 100.
|
||||
|
||||
Calling S(N) the sum of the unique numeric representations, we can see that S(3) = 23 + 29 = 52.
|
||||
Ogni disposizione circolare può essere codificata come numero concatenando le cifre binarie a partire dalla successione di tutti gli zeri come bit più significativi e procedendo in senso orario. Le due disposizioni per $N = 3$ sono quindi rappresentate come 23 e 29:
|
||||
|
||||
Find S(5).
|
||||
$${00010111}_2 = 23\\\\
|
||||
{00011101}_2 = 29$$
|
||||
|
||||
Chiamando $S(N)$ la somma delle disposizioni numeriche uniche, possiamo vedere che $S(3) = 23 + 29 = 52$.
|
||||
|
||||
Trova $S(5)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler265()` should return 209110240768.
|
||||
`binaryCircles()` dovrebbe restituire `209110240768`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler265(), 209110240768);
|
||||
assert.strictEqual(binaryCircles(), 209110240768);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +38,12 @@ assert.strictEqual(euler265(), 209110240768);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler265() {
|
||||
function binaryCircles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler265();
|
||||
binaryCircles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4771000cf542c50ff89
|
||||
title: 'Problem 266: Pseudo Square Root'
|
||||
title: 'Problema 266: Pseudo radice quadrata'
|
||||
challengeType: 5
|
||||
forumTopicId: 301915
|
||||
dashedName: problem-266-pseudo-square-root
|
||||
@ -8,22 +8,22 @@ dashedName: problem-266-pseudo-square-root
|
||||
|
||||
# --description--
|
||||
|
||||
The divisors of 12 are: 1,2,3,4,6 and 12.
|
||||
I divisori di 12 sono: 1,2,3,4,6 e 12.
|
||||
|
||||
The largest divisor of 12 that does not exceed the square root of 12 is 3.
|
||||
Il massimo divisore di 12 che non supera la radice quadrata di 12 è 3.
|
||||
|
||||
We shall call the largest divisor of an integer n that does not exceed the square root of n the pseudo square root (PSR) of n.
|
||||
Chiameremo il massimo divisore di un intero $n$ che non supera la radice quadrata di $n$ la pseudo radice quadrata ($PSR$) di $n$.
|
||||
|
||||
It can be seen that PSR(3102)=47.
|
||||
Si può vedere che $PSR(3102) = 47$.
|
||||
|
||||
Let p be the product of the primes below 190. Find PSR(p) mod 1016.
|
||||
Sia $p$ il prodotto dei primi sotto 190. Trova $PSR(p)\bmod {10}^{16}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler266()` should return 1096883702440585.
|
||||
`pseudoSquareRoot()` dovrebbe restituire `1096883702440585`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler266(), 1096883702440585);
|
||||
assert.strictEqual(pseudoSquareRoot(), 1096883702440585);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler266(), 1096883702440585);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler266() {
|
||||
function pseudoSquareRoot() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler266();
|
||||
pseudoSquareRoot();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4771000cf542c50ff8a
|
||||
title: 'Problem 267: Billionaire'
|
||||
title: 'Problema 267: Miliardario'
|
||||
challengeType: 5
|
||||
forumTopicId: 301916
|
||||
dashedName: problem-267-billionaire
|
||||
@ -8,24 +8,24 @@ dashedName: problem-267-billionaire
|
||||
|
||||
# --description--
|
||||
|
||||
You are given a unique investment opportunity.
|
||||
Ti viene data un'opportunità di investimento unica.
|
||||
|
||||
Starting with £1 of capital, you can choose a fixed proportion, f, of your capital to bet on a fair coin toss repeatedly for 1000 tosses.
|
||||
A partire da 1£ di capitale, è possibile scegliere una proporzione fissa, $f$, del tuo capitale da scommettere su una moneta lanciata ripetutamente per 1000 volte.
|
||||
|
||||
Your return is double your bet for heads and you lose your bet for tails.
|
||||
Il tuo ritorno è il doppio della tua puntata per le teste e perdi la tua puntata per le croci.
|
||||
|
||||
For example, if f = 1/4, for the first toss you bet £0.25, and if heads comes up you win £0.5 and so then have £1.5. You then bet £0.375 and if the second toss is tails, you have £1.125.
|
||||
Ad esempio, se $f = \frac{1}{4}$, per il primo lancio hai scommesso £0.25, e se le teste vengono in su vinci £ 0.5 e quindi abbiamo £ 1.5. Quindi scommetti £ 0.375 e se il secondo lancio è croce, hai £ 1.125.
|
||||
|
||||
Choosing f to maximize your chances of having at least £1,000,000,000 after 1,000 flips, what is the chance that you become a billionaire?
|
||||
Scegliendo $f$ per massimizzare le tue probabilità di avere almeno £1.000.000.000 dopo 1.000 lanci, qual è la probabilità che diventi un miliardario?
|
||||
|
||||
All computations are assumed to be exact (no rounding), but give your answer rounded to 12 digits behind the decimal point in the form 0.abcdefghijkl.
|
||||
Tutti i calcoli sono considerati esatti (senza arrotondamento), ma dai la tua risposta arrotondata a 12 cifre dopo il punto decimale nel formato 0.abcdefghijkl.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler267()` should return 0.999992836187.
|
||||
`billionaire()` dovrebbe restituire `0.999992836187`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler267(), 0.999992836187);
|
||||
assert.strictEqual(billionaire(), 0.999992836187);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler267(), 0.999992836187);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler267() {
|
||||
function billionaire() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler267();
|
||||
billionaire();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
id: 5900f4791000cf542c50ff8b
|
||||
title: >-
|
||||
Problem 268: Counting numbers with at least four distinct prime factors less than 100
|
||||
Problema 268: Contare i numeri con almeno quattro fattori primi distinti inferiori a 100
|
||||
challengeType: 5
|
||||
forumTopicId: 301917
|
||||
dashedName: >-
|
||||
@ -10,16 +10,16 @@ dashedName: >-
|
||||
|
||||
# --description--
|
||||
|
||||
It can be verified that there are 23 positive integers less than 1000 that are divisible by at least four distinct primes less than 100.
|
||||
Si può verificare che ci sono 23 interi positivi inferiori a 1000 che sono divisibili per almeno quattro primi distinti inferiori a 100.
|
||||
|
||||
Find how many positive integers less than 1016 are divisible by at least four distinct primes less than 100.
|
||||
Trova quanti interi positivi minori di ${10}^{16}$ sono divisibili per almeno quattro primi distinti minori di 100.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler268()` should return 785478606870985.
|
||||
`fourDistinctPrimeFactors()` dovrebbe restituire `785478606870985`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler268(), 785478606870985);
|
||||
assert.strictEqual(fourDistinctPrimeFactors(), 785478606870985);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler268(), 785478606870985);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler268() {
|
||||
function fourDistinctPrimeFactors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler268();
|
||||
fourDistinctPrimeFactors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4791000cf542c50ff8c
|
||||
title: 'Problem 269: Polynomials with at least one integer root'
|
||||
title: 'Problema 269: Polinomi con almeno una radice intera'
|
||||
challengeType: 5
|
||||
forumTopicId: 301918
|
||||
dashedName: problem-269-polynomials-with-at-least-one-integer-root
|
||||
@ -8,24 +8,30 @@ dashedName: problem-269-polynomials-with-at-least-one-integer-root
|
||||
|
||||
# --description--
|
||||
|
||||
A root or zero of a polynomial P(x) is a solution to the equation P(x) = 0.
|
||||
Una radice o zero di un polinomio $P(x)$ è una soluzione per l'equazione $P(x) = 0$.
|
||||
|
||||
Define Pn as the polynomial whose coefficients are the digits of n.
|
||||
Definisci $P_n$ come un polinomio i cui coefficienti sono le cifre di $n$.
|
||||
|
||||
For example, P5703(x) = 5x3 + 7x2 + 3.
|
||||
Per esempio, $P_{5703}(x) = 5x^3 + 7x^2 + 3$.
|
||||
|
||||
We can see that:Pn(0) is the last digit of n, Pn(1) is the sum of the digits of n, Pn(10) is n itself.Define Z(k) as the number of positive integers, n, not exceeding k for which the polynomial Pn has at least one integer root.
|
||||
Possiamo vedere che:
|
||||
|
||||
It can be verified that Z(100 000) is 14696.
|
||||
- $P_n(0)$ è l'ultima cifra di $n$,
|
||||
- $P_n(1)$ è la somma delle cifre di $n$,
|
||||
- $Pn(10)$ è $n$ stesso.
|
||||
|
||||
What is Z(1016)?
|
||||
Sia $Z(k)$ il numero di numeri interi positivi, $n$, che non eccedono $k$ per cui il polinomio $P_n$ ha almeno una radice intera.
|
||||
|
||||
Si può verifficare che $Z(100\\,000)$ è 14696.
|
||||
|
||||
Qual è il valore di $Z({10}^{16})$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler269()` should return 1311109198529286.
|
||||
`polynomialsWithOneIntegerRoot()` dovrebbe restituire `1311109198529286`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler269(), 1311109198529286);
|
||||
assert.strictEqual(polynomialsWithOneIntegerRoot(), 1311109198529286);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +39,12 @@ assert.strictEqual(euler269(), 1311109198529286);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler269() {
|
||||
function polynomialsWithOneIntegerRoot() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler269();
|
||||
polynomialsWithOneIntegerRoot();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f47c1000cf542c50ff8e
|
||||
title: 'Problem 270: Cutting Squares'
|
||||
title: 'Problema 270: Taglio dei quadrati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301920
|
||||
dashedName: problem-270-cutting-squares
|
||||
@ -8,24 +8,24 @@ dashedName: problem-270-cutting-squares
|
||||
|
||||
# --description--
|
||||
|
||||
A square piece of paper with integer dimensions N×N is placed with a corner at the origin and two of its sides along the x- and y-axes. Then, we cut it up respecting the following rules:
|
||||
Un pezzo quadrato di carta con dimensioni intere $N×N$ è posizionato con un angolo all'origine e due dei suoi lati lungo gli assi $x$ e $y$. Quindi lo tagliamo rispettando le seguenti regole:
|
||||
|
||||
We only make straight cuts between two points lying on different sides of the square, and having integer coordinates.
|
||||
- Facciamo solo tagli dritti tra due punti situati su lati diversi del quadrato e aventi coordinate intere.
|
||||
- Due tagli non possono incrociarsi, ma diversi tagli possono incontrarsi sullo stesso punto di confine.
|
||||
- Procedere fino a quando non sarà possibile effettuare ulteriori tagli ammissibili.
|
||||
|
||||
Two cuts cannot cross, but several cuts can meet at the same border point.
|
||||
Contando qualsiasi riflessione o rotazione come distinta, chiamiamo $C(N)$ il numero di modi di tagliare un quadrato $N×N$. Per esempio, $C(1) = 2$ e $C(2) = 30$ (mostrato di seguito).
|
||||
|
||||
Proceed until no more legal cuts can be made.
|
||||
<img class="img-responsive center-block" alt="modi di tagliare un quadrato 2x2, contando riflessioni e rotazioni come distinta" src="https://cdn.freecodecamp.org/curriculum/project-euler/cutting-squares.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Counting any reflections or rotations as distinct, we call C(N) the number of ways to cut an N×N square. For example, C(1) = 2 and C(2) = 30 (shown below).
|
||||
|
||||
What is C(30) mod 108 ?
|
||||
Quanto vale $C(30)\bmod {10}^8$ ?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler270()` should return 82282080.
|
||||
`cuttingSquares()` dovrebbe restituire `82282080`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler270(), 82282080);
|
||||
assert.strictEqual(cuttingSquares(), 82282080);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler270(), 82282080);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler270() {
|
||||
function cuttingSquares() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler270();
|
||||
cuttingSquares();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f47b1000cf542c50ff8d
|
||||
title: 'Problem 271: Modular Cubes, part 1'
|
||||
title: 'Problema 271: Cubi modulari, parte 1'
|
||||
challengeType: 5
|
||||
forumTopicId: 301921
|
||||
dashedName: problem-271-modular-cubes-part-1
|
||||
@ -8,18 +8,18 @@ dashedName: problem-271-modular-cubes-part-1
|
||||
|
||||
# --description--
|
||||
|
||||
For a positive number n, define S(n) as the sum of the integers x, for which 1
|
||||
Per un numero positivo $n$, definisci $S(n)$ come la somma degli interi $x$, per cui $1 < x < n$ e $x^3 \equiv 1\bmod n$.
|
||||
|
||||
When n=91, there are 8 possible values for x, namely : 9, 16, 22, 29, 53, 74, 79, 81. Thus, S(91)=9+16+22+29+53+74+79+81=363.
|
||||
Quando $n = 91$, ci sono 8 valori possibili per $x$, cioè: 9, 16, 22, 29, 53, 74, 79, 81. Così, $S(91) = 9 + 16 + 22 + 29 + 53 + 74 + 79 + 81 = 363 $.
|
||||
|
||||
Find S(13082761331670030).
|
||||
Trova $S(13\\,082\\,761\\,331\\,670\\,030)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler271()` should return 4617456485273130000.
|
||||
`modularCubesOne()` dovrebbe restituire `4617456485273130000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler271(), 4617456485273130000);
|
||||
assert.strictEqual(modularCubesOne(), 4617456485273130000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler271(), 4617456485273130000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler271() {
|
||||
function modularCubesOne() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler271();
|
||||
modularCubesOne();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f47d1000cf542c50ff8f
|
||||
title: 'Problem 272: Modular Cubes, part 2'
|
||||
title: 'Problema 272: Cubi modulari, parte 2'
|
||||
challengeType: 5
|
||||
forumTopicId: 301922
|
||||
dashedName: problem-272-modular-cubes-part-2
|
||||
@ -8,18 +8,18 @@ dashedName: problem-272-modular-cubes-part-2
|
||||
|
||||
# --description--
|
||||
|
||||
For a positive number n, define C(n) as the number of the integers x, for which 1
|
||||
Per un numero positivo $n$, definisci $C(n)$ come il numero degli interi $x$, per cui $1 < x < n$ e $x^3 \equiv 1\bmod n$.
|
||||
|
||||
When n=91, there are 8 possible values for x, namely : 9, 16, 22, 29, 53, 74, 79, 81. Thus, C(91)=8.
|
||||
Quando $n = 91$, ci sono 8 valori possibili per $x$, cioè: 9, 16, 22, 29, 53, 74, 79, 81. Così, $C(91) = 8$.
|
||||
|
||||
Find the sum of the positive numbers n≤1011 for which C(n)=242.
|
||||
Trova la somma dei numeri positivi $n ≤ {10}^{11}$ per i quali $C(n)=242$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler272()` should return 8495585919506151000.
|
||||
`modularCubesTwo()` dovrebbe restituire `8495585919506151000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler272(), 8495585919506151000);
|
||||
assert.strictEqual(modularCubesTwo(), 8495585919506151000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler272(), 8495585919506151000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler272() {
|
||||
function modularCubesTwo() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler272();
|
||||
modularCubesTwo();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f47e1000cf542c50ff90
|
||||
title: 'Problem 273: Sum of Squares'
|
||||
title: 'Problema 273: Somma di quadrati'
|
||||
challengeType: 5
|
||||
forumTopicId: 301923
|
||||
dashedName: problem-273-sum-of-squares
|
||||
@ -8,16 +8,24 @@ dashedName: problem-273-sum-of-squares
|
||||
|
||||
# --description--
|
||||
|
||||
Consider equations of the form: a2 + b2 = N, 0 ≤ a ≤ b, a, b and N integer.
|
||||
Considera le equazioni nella forma: $a^2 + b^2 = N$, $0 ≤ a ≤ b$, $a$, $b$ e $N$ interi.
|
||||
|
||||
For N=65 there are two solutions: a=1, b=8 and a=4, b=7. We call S(N) the sum of the values of a of all solutions of a2 + b2 = N, 0 ≤ a ≤ b, a, b and N integer. Thus S(65) = 1 + 4 = 5. Find ∑S(N), for all squarefree N only divisible by primes of the form 4k+1 with 4k+1 < 150.
|
||||
Per $N = 65$ ci sono due soluzioni:
|
||||
|
||||
$a = 1, b = 8$ e $a = 4, b = 7$.
|
||||
|
||||
Chiamiamo $S(N)$ la somma dei valori di $a$ di tutte le soluzioni di $a^2 + b^2 = N$, $0 ≤ a ≤ b$, $a$, $b$ e $N$ interi.
|
||||
|
||||
Quindi $S(65) = 1 + 4 = 5$.
|
||||
|
||||
Trova $\sum S(N)$, per tutti i numeri privi di quadrati $N$ divisibili solo per i numeri primi di tipo $4k + 1$ con $4k + 1 < 150$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler273()` should return 2032447591196869000.
|
||||
`sumOfSquares()` dovrebbe restituire `2032447591196869000`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler273(), 2032447591196869000);
|
||||
assert.strictEqual(sumOfSquares(), 2032447591196869000);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +33,12 @@ assert.strictEqual(euler273(), 2032447591196869000);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler273() {
|
||||
function sumOfSquares() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler273();
|
||||
sumOfSquares();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -8,7 +8,7 @@ dashedName: cumulative-standard-deviation
|
||||
|
||||
# --description--
|
||||
|
||||
Scrivi una funzione che prende un array di numeri come parametro e restituisce la [deviazione standard](https://en.wikipedia.org/wiki/Standard Deviation) della serie.
|
||||
Scrivi una funzione che prende un array di numeri come parametro e restituisce la [deviazione standard](https://it.wikipedia.org/wiki/Scarto_quadratico_medio) della serie.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
@ -80,6 +80,11 @@ assert.deepEqual(binarySearch(_testArray, 11), [13, 5, 10, 11])
|
||||
assert.deepEqual(binarySearch(_testArray, 13), [13]);
|
||||
```
|
||||
|
||||
`binarySearch(testArray, 70)` should return `[13, 19, 22, 49, 70]`.
|
||||
|
||||
```js
|
||||
assert.deepEqual(binarySearch(_testArray, 70), [13, 19, 22, 49, 70]);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
||||
|
@ -20,10 +20,10 @@ dashedName: problem-184-triangles-containing-the-origin
|
||||
|
||||
# --hints--
|
||||
|
||||
`trianglesConttainingOrigin()` は `1725323624056` を返す必要があります。
|
||||
`trianglesContainingOrigin()` should return `1725323624056`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(trianglesConttainingOrigin(), 1725323624056);
|
||||
assert.strictEqual(trianglesContainingOrigin(), 1725323624056);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
|
Reference in New Issue
Block a user