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

This commit is contained in:
camperbot
2022-03-01 21:39:26 +05:30
committed by GitHub
parent c6ec2512ad
commit d62fec495b
61 changed files with 752 additions and 606 deletions

View File

@ -80,6 +80,11 @@ assert.deepEqual(binarySearch(_testArray, 11), [13, 5, 10, 11])
assert.deepEqual(binarySearch(_testArray, 13), [13]);
```
`binarySearch(testArray, 70)` dovrebbe restituire `[13, 19, 22, 49, 70]`.
```js
assert.deepEqual(binarySearch(_testArray, 70), [13, 19, 22, 49, 70]);
```
# --seed--

View File

@ -23,7 +23,7 @@ Quanti triangoli contengono l'origine all'interno e hanno tutti e tre i vertici
`trianglesContainingOrigin()` dovrebbe restituire `1725323624056`.
```js
assert.strictEqual(trianglesConttainingOrigin(), 1725323624056);
assert.strictEqual(trianglesContainingOrigin(), 1725323624056);
```
# --seed--

View File

@ -1,6 +1,6 @@
---
id: 5900f4621000cf542c50ff75
title: 'Problem 246: Tangents to an ellipse'
title: 'Problema 246: Tangenti a un ellisse'
challengeType: 5
forumTopicId: 301893
dashedName: problem-246-tangents-to-an-ellipse
@ -8,22 +8,34 @@ dashedName: problem-246-tangents-to-an-ellipse
# --description--
A definition for an ellipse is:
Una definizione di un'ellisse è:
Given a circle c with centre M and radius r and a point G such that d(G,M)
Dato un cerchio $c$ con centro $M$ e raggio $r$ e un punto $G$ affinché $d(G, m) < r$, il luogo dei punti che sono equidistanti da $c$ e $G$ forma una ellisse.
The construction of the points of the ellipse is shown below.
La costruzione dei punti dell'ellisse è mostrato qua sotto.
Given are the points M(-2000,1500) and G(8000,1500). Given is also the circle c with centre M and radius 15000. The locus of the points that are equidistant from G and c form an ellipse e. From a point P outside e the two tangents t1 and t2 to the ellipse are drawn. Let the points where t1 and t2 touch the ellipse be R and S.
<img class="img-responsive center-block" alt="animazione della costruzione di un'ellisse" src="https://cdn.freecodecamp.org/curriculum/project-euler/tangents-to-an-ellipse-1.gif" style="background-color: white; padding: 10px;" />
For how many lattice points P is angle RPS greater than 45 degrees?
Dati i punti $M(-2000, 1500)$ e $G(800, 1500)$.
Dato il cerchio $c$ con centro $M$ e raggio $15\\,000$.
Il luogo dei punti che sono equidistanti da $G$ e $c$ formano un'ellisse $e$.
Da un punto $P$ al di fuori di $e$ le due tangenti $$t_1$ e $t_2$ all'ellisse sono disegnate.
Siano $R$ e $S$ i punti dove $t_1$ e $t_2$ toccano sull'ellisse.
<img class="img-responsive center-block" alt="cerchio c con centro M, raggio 15000 e punto P al di fuori dell'ellisse e; dal punto P due tangenti t_1 e t_2 sono disegnate all'ellisse, con i punti che toccano l'ellisse R e S" src="https://cdn.freecodecamp.org/curriculum/project-euler/tangents-to-an-ellipse-2.gif" style="background-color: white; padding: 10px;" />
Per quanti punti $P$ del reticolo l'angolo $RPS$ è maggiore di 45°?
# --hints--
`euler246()` should return 810834388.
`tangentsToAnEllipse()` dovrebbe restituire `810834388`.
```js
assert.strictEqual(euler246(), 810834388);
assert.strictEqual(tangentsToAnEllipse(), 810834388);
```
# --seed--
@ -31,12 +43,12 @@ assert.strictEqual(euler246(), 810834388);
## --seed-contents--
```js
function euler246() {
function tangentsToAnEllipse() {
return true;
}
euler246();
tangentsToAnEllipse();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f47f1000cf542c50ff91
title: 'Problem 274: Divisibility Multipliers'
title: 'Problema 274: Moltiplicatori di divisibilità'
challengeType: 5
forumTopicId: 301924
dashedName: problem-274-divisibility-multipliers
@ -8,26 +8,28 @@ dashedName: problem-274-divisibility-multipliers
# --description--
For each integer p > 1 coprime to 10 there is a positive divisibility multiplier m &lt; p which preserves divisibility by p for the following function on any positive integer, n:
Per ogni intero $p > 1$ coprimo a 10 c'è un moltiplicatore di divisibilità positivo $m &lt; p$ che preserva la divisibilità per $p$ per la seguente funzione su qualsiasi intero positivo, $n$:
f(n) = (all but the last digit of n) + (the last digit of n) \* m
$f(n) = (\text{all but the last digit of} \\; n) + (\text{the last digit of} \\; n) \times m$
That is, if m is the divisibility multiplier for p, then f(n) is divisible by p if and only if n is divisible by p.
Cioè, se $m$ è il moltiplicatore di divisibilità per $p$, poi $f(n)$ è divisibile per $p$ se e solo se $n$ è divisibile per $p$.
(When n is much larger than p, f(n) will be less than n and repeated application of f provides a multiplicative divisibility test for p.)
(Quando $n$ è molto più grande di $p$, $f(n)$ sarà inferiore a $n$ e l'applicazione ripetuta di $f$ fornisce un test di divisibilità moltiplicativa per $p$.)
For example, the divisibility multiplier for 113 is 34.
Ad esempio, il moltiplicatore di divisibilità per 113 è 34.
f(76275) = 7627 + 5 *34 = 7797 : 76275 and 7797 are both divisible by 113f(12345) = 1234 + 5* 34 = 1404 : 12345 and 1404 are both not divisible by 113
$f(76275) = 7627 + 5 \times 34 = 7797$: 76275 e 7797 sono entrambi divisibili per 113
The sum of the divisibility multipliers for the primes that are coprime to 10 and less than 1000 is 39517. What is the sum of the divisibility multipliers for the primes that are coprime to 10 and less than 107?
$f(12345) = 1234 + 5 \times 34 = 1404$: 12345 e 1404 non sono entrambi divisibili per 113
La somma dei moltiplicatori di divisibilità per i primi che sono coprimi a 10 e minori di 1000 è 39517. Qual è la somma dei moltiplicatori di divisibilità per i primi che sono coprimi a 10 e minori di ${10}^7$?
# --hints--
`euler274()` should return 1601912348822.
`divisibilityMultipliers()` dovrebbe restituire `1601912348822`.
```js
assert.strictEqual(euler274(), 1601912348822);
assert.strictEqual(divisibilityMultipliers(), 1601912348822);
```
# --seed--
@ -35,12 +37,12 @@ assert.strictEqual(euler274(), 1601912348822);
## --seed-contents--
```js
function euler274() {
function divisibilityMultipliers() {
return true;
}
euler274();
divisibilityMultipliers();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4801000cf542c50ff92
title: 'Problem 275: Balanced Sculptures'
title: 'Problema 275: Sculture Bilanciate'
challengeType: 5
forumTopicId: 301925
dashedName: problem-275-balanced-sculptures
@ -8,26 +8,27 @@ dashedName: problem-275-balanced-sculptures
# --description--
Let us define a balanced sculpture of order n as follows:
Definiamo una scultura bilanciata di ordine $n$ come segue:
A polyomino made up of n+1 tiles known as the blocks (n tiles) and the plinth (remaining tile);
- Un poliomino fatto di $n + 1$ mattonelle noti come i blocchi ($n$ mattonelle) e il plinto (la mattonella rimanente);
- il plinto ha il suo centro in posizione ($x = 0$, $y = 0$);
- i blocchi hanno coordinate $y$ maggiori di zero (quindi il plinto è l'unica piastrella più in basso);
- il centro di massa di tutti i blocchi, combinati, ha una coordinata di $x$ pari a zero.
the plinth has its centre at position (x = 0, y = 0);
Quando si contano le strutture, qualsiasi arrangiamento che è una semplice riflessione lungo l'asse $y$, <u>non</u> viene contato come distinto. Per esempio, le 18 sculture bilanciate di ordine 6 sono mostrate di seguito; nota che ogni coppia d'immagini specchiate (intorno all'asse $y$) è contata come una sola scultura:
the blocks have y-coordinates greater than zero (so the plinth is the unique lowest tile);
<img class="img-responsive center-block" alt="18 sculture bilanciate di ordine 6" src="https://cdn.freecodecamp.org/curriculum/project-euler/balanced-sculptures.gif" style="background-color: white; padding: 10px;" />
the centre of mass of all the blocks, combined, has x-coordinate equal to zero.
Ci sono 964 sculture bilanciate di ordine 10 e 360505 di ordine 15.
When counting the sculptures, any arrangements which are simply reflections about the y-axis, are not counted as distinct. For example, the 18 balanced sculptures of order 6 are shown below; note that each pair of mirror images (about the y-axis) is counted as one sculpture:
There are 964 balanced sculptures of order 10 and 360505 of order 15.How many balanced sculptures are there of order 18?
Quante sculture bilanciate di ordine 18 ci sono?
# --hints--
`euler275()` should return 15030564.
`balancedSculptures()` dovrebbe restituire `15030564`.
```js
assert.strictEqual(euler275(), 15030564);
assert.strictEqual(balancedSculptures(), 15030564);
```
# --seed--
@ -35,12 +36,12 @@ assert.strictEqual(euler275(), 15030564);
## --seed-contents--
```js
function euler275() {
function balancedSculptures() {
return true;
}
euler275();
balancedSculptures();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4801000cf542c50ff93
title: 'Problem 276: Primitive Triangles'
title: 'Problema 276: Triangoli Primitivi'
challengeType: 5
forumTopicId: 301926
dashedName: problem-276-primitive-triangles
@ -8,18 +8,18 @@ dashedName: problem-276-primitive-triangles
# --description--
Consider the triangles with integer sides a, b and c with a ≤ b ≤ c.
Considera i triangoli con lati interi $a$, $b$ e $c$ con $a ≤ b ≤ c$.
An integer sided triangle (a,b,c) is called primitive if gcd(a,b,c)=1.
Un lato intero del triangolo $(a,b,c)$ è chiamato primitivo se $gcd(a,b,c) = 1$.
How many primitive integer sided triangles exist with a perimeter not exceeding 10 000 000?
Quanti triangoli di lato intero primitivi esistono con un perimetro non superiore a $10\\,000\\,000$?
# --hints--
`euler276()` should return 5777137137739633000.
`primitiveTriangles()` dovrebbe restituire `5777137137739633000`.
```js
assert.strictEqual(euler276(), 5777137137739633000);
assert.strictEqual(primitiveTriangles(), 5777137137739633000);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler276(), 5777137137739633000);
## --seed-contents--
```js
function euler276() {
function primitiveTriangles() {
return true;
}
euler276();
primitiveTriangles();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4811000cf542c50ff94
title: 'Problem 277: A Modified Collatz sequence'
title: 'Problema 277: Una sequenza di Collatz modificata'
challengeType: 5
forumTopicId: 301927
dashedName: problem-277-a-modified-collatz-sequence
@ -8,28 +8,32 @@ dashedName: problem-277-a-modified-collatz-sequence
# --description--
A modified Collatz sequence of integers is obtained from a starting value a1 in the following way:
Una sequenza di numeri interi modificata è ottenuta da un valore iniziale $a_1$ nel seguente modo:
an+1 = an/3 if an is divisible by 3. We shall denote this as a large downward step, "D".
$a_{n + 1} = \frac{a_n}{3}$ se $a_n$ è divisibile per 3. Lo indicheremo come un passo grande verso il basso, "D".
an+1 = (4an + 2)/3 if an divided by 3 gives a remainder of 1. We shall denote this as an upward step, "U".
$a_{n + 1} = \frac{4a_n + 2}{3}$ se $a_n$ diviso per 3 dà un resto di 1. Lo indicheremo come un passo verso l'alto, "U".
an+1 = (2an - 1)/3 if an divided by 3 gives a remainder of 2. We shall denote this as a small downward step, "d".
$a_{n + 1} = \frac{2a_n - 1}{3}$ se $a_n$ diviso per 3 dà un resto di 2. Lo indicheremo come un piccolo passo verso il basso, "d".
The sequence terminates when some an = 1.
La sequenza termina quando qualche $a_n = 1$.
Given any integer, we can list out the sequence of steps. For instance if a1=231, then the sequence {an}={231,77,51,17,11,7,10,14,9,3,1} corresponds to the steps "DdDddUUdDD".
Dato qualsiasi numero intero, possiamo elencare la sequenza dei passaggi. Per esempio se $a_1 = 231$, allora la sequenza \\{a_n\\} = \\{231, 77, 51, 17, 11, 7, 10, 14, 9, 3, 1\\}$ corrisponde ai passi "DdDddUUdDD".
Of course, there are other sequences that begin with that same sequence "DdDddUUdDD....". For instance, if a1=1004064, then the sequence is DdDddUUdDDDdUDUUUdDdUUDDDUdDD. In fact, 1004064 is the smallest possible a1 > 106 that begins with the sequence DdDddUUdDD.
Naturalmente, ci sono altre sequenze che iniziano con quella stessa sequenza "DdDddUUdDD...".
What is the smallest a1 > 1015 that begins with the sequence "UDDDUdddDDUDDddDdDddDDUDDdUUDd"?
Per esempio, se $a_1 = 1004064$, allora la sequenza è DdDddUUdDDDdUDUUUdDdUUDDDUdDD.
Infatti, 1004064 è il più piccolo possibile $a_1 > {10}^6$ che inizia con la sequenza DdDddUUdDD.
Qual è il più piccolo $a_1 > {10}^{15}$ che inizia con la sequenza "UDDDUdddDDUDDddDdDddDDUDDdUUDd"?
# --hints--
`euler277()` should return 1125977393124310.
`modifiedCollatzSequence()` dovrebbe restituire `1125977393124310`.
```js
assert.strictEqual(euler277(), 1125977393124310);
assert.strictEqual(modifiedCollatzSequence(), 1125977393124310);
```
# --seed--
@ -37,12 +41,12 @@ assert.strictEqual(euler277(), 1125977393124310);
## --seed-contents--
```js
function euler277() {
function modifiedCollatzSequence() {
return true;
}
euler277();
modifiedCollatzSequence();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4831000cf542c50ff95
title: 'Problem 278: Linear Combinations of Semiprimes'
title: 'Problema 278: Combinazioni lineari di semiprimi'
challengeType: 5
forumTopicId: 301928
dashedName: problem-278-linear-combinations-of-semiprimes
@ -8,20 +8,20 @@ dashedName: problem-278-linear-combinations-of-semiprimes
# --description--
Given the values of integers 1 &lt; a1 &lt; a2 &lt;... &lt; an, consider the linear combination q1a1 + q2a2 + ... + qnan = b, using only integer values qk ≥ 0.
Dati i valori di numeri interi $1 &lt; a_1 &lt; a_2 &lt; \ldots &lt; a_n$, considera la combinazione lineare $q_1a_1 + q_2a_2 + \ldots + q_na_n = b$, utilizzando solo valori interi $q_k ≥ 0$.
Note that for a given set of ak, it may be that not all values of b are possible. For instance, if a1 = 5 and a2 = 7, there are no q1 ≥ 0 and q2 ≥ 0 such that b could be 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18 or 23.
Nota che per un dato set di $a_k$ potrebbe essere che non tutti i valori di $b$ siano possibili. Per esempio, se $a_1 = 5$ e $a_2 = 7$, non ci sono $q_1 ≥ 0$ e $q_2 ≥ 0$ tali che $b$ possa essere 1, 2, 3, 4, 6, 8, 9, 11, 13, 16, 18 o 23.
In fact, 23 is the largest impossible value of b for a1 = 5 and a2 = 7. We therefore call f(5, 7) = 23. Similarly, it can be shown that f(6, 10, 15)=29 and f(14, 22, 77) = 195.
Infatti 23 è il più grande valore impossibile di $b$ per $a_1 = 5$ e $a_2 = 7$. Chiamiamo quindi $f(5, 7) = 23$. Allo stesso modo, si può dimostrare che $f(6, 10, 15)=29$ e $f(14, 22, 77) = 195$.
Find ∑ f(p*q,p*r,q\*r), where p, q and r are prime numbers and p &lt; q &lt; r &lt; 5000.
Trova $\sum f(pq,pr,qr)$, dove $p$, $q$ e $r$ sono numeri primi e $p &lt; q &lt; r &lt; 5000$.
# --hints--
`euler278()` should return 1228215747273908500.
`linearCombinationOfSemiprimes()` dovrebbe restituire `1228215747273908500`.
```js
assert.strictEqual(euler278(), 1228215747273908500);
assert.strictEqual(linearCombinationOfSemiprimes(), 1228215747273908500);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler278(), 1228215747273908500);
## --seed-contents--
```js
function euler278() {
function linearCombinationOfSemiprimes() {
return true;
}
euler278();
linearCombinationOfSemiprimes();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4841000cf542c50ff96
title: 'Problem 279: Triangles with integral sides and an integral angle'
title: 'Problema 279: Triangoli con lati interi e angolo intero'
challengeType: 5
forumTopicId: 301929
dashedName: problem-279-triangles-with-integral-sides-and-an-integral-angle
@ -8,14 +8,14 @@ dashedName: problem-279-triangles-with-integral-sides-and-an-integral-angle
# --description--
How many triangles are there with integral sides, at least one integral angle (measured in degrees), and a perimeter that does not exceed 108?
Quanti triangoli ci sono con i lati interi, almeno un angolo intero (misurato in gradi) e un perimetro che non supera ${10}^8$?
# --hints--
`euler279()` should return 416577688.
`trianglesWithIntegralSidesAndAngle()` dovrebbe restituire `416577688`.
```js
assert.strictEqual(euler279(), 416577688);
assert.strictEqual(trianglesWithIntegralSidesAndAngle(), 416577688);
```
# --seed--
@ -23,12 +23,12 @@ assert.strictEqual(euler279(), 416577688);
## --seed-contents--
```js
function euler279() {
function trianglesWithIntegralSidesAndAngle() {
return true;
}
euler279();
trianglesWithIntegralSidesAndAngle();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4841000cf542c50ff97
title: 'Problem 280: Ant and seeds'
title: 'Problema 280: formica e semi'
challengeType: 5
forumTopicId: 301931
dashedName: problem-280-ant-and-seeds
@ -8,18 +8,18 @@ dashedName: problem-280-ant-and-seeds
# --description--
A laborious ant walks randomly on a 5x5 grid. The walk starts from the central square. At each step, the ant moves to an adjacent square at random, without leaving the grid; thus there are 2, 3 or 4 possible moves at each step depending on the ant's position.
Una formica laboriosa cammina casualmente su una griglia 5x5. La passeggiata parte dal quadrato centrale. A ogni passo, la formica si sposta in un quadrato adiacente a caso, senza lasciare la griglia; così ci sono due, tre o quattro possibili mosse A ogni passo a seconda della posizione della formica.
At the start of the walk, a seed is placed on each square of the lower row. When the ant isn't carrying a seed and reaches a square of the lower row containing a seed, it will start to carry the seed. The ant will drop the seed on the first empty square of the upper row it eventually reaches.
All'inizio della passeggiata, un seme viene posto su ogni quadrato della fila inferiore. Quando la formica non porta un seme e raggiunge un quadrato della fila inferiore contenente un seme, inizierà a portare il seme. La formica lascerà cadere il seme sul primo quadrato vuoto della riga superiore che raggiunge.
What's the expected number of steps until all seeds have been dropped in the top row? Give your answer rounded to 6 decimal places.
Qual è il numero previsto di passaggi perché tutti i semi siano lasciati cadere nella riga superiore? Dare la risposta arrotondata a 6 decimali.
# --hints--
`euler280()` should return 430.088247.
`antAndSeeds()` dovrebbe restituire `430.088247`.
```js
assert.strictEqual(euler280(), 430.088247);
assert.strictEqual(antAndSeeds(), 430.088247);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler280(), 430.088247);
## --seed-contents--
```js
function euler280() {
function antAndSeeds() {
return true;
}
euler280();
antAndSeeds();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4861000cf542c50ff98
title: 'Problem 281: Pizza Toppings'
title: 'Problema 281: Topping per Pizza'
challengeType: 5
forumTopicId: 301932
dashedName: problem-281-pizza-toppings
@ -8,20 +8,22 @@ dashedName: problem-281-pizza-toppings
# --description--
You are given a pizza (perfect circle) that has been cut into m·n equal pieces and you want to have exactly one topping on each slice.
Ti viene data una pizza (cerchio perfetto) che è stata tagliata in $m·n$ pezzi uguali e si desidera avere esattamente un condimento su ogni fetta.
Let f(m,n) denote the number of ways you can have toppings on the pizza with m different toppings (m ≥ 2), using each topping on exactly n slices (n ≥ 1). Reflections are considered distinct, rotations are not.
Sia $f(m, n)$ il numero di modi in cui puoi avere condimenti sulla pizza con $m$ condimenti diversi ($m ≥ 2$), usando ogni topping su esattamente $n$ fette ($n ≥ 1$). Le riflessioni sono considerate distinte, le rotazioni non lo sono.
Thus, for instance, f(2,1) = 1, f(2,2) = f(3,1) = 2 and f(3,2) = 16. f(3,2) is shown below:
Così, per esempio, $f(2,1) = 1$, $f(2,2) = f(3,1) = 2$ e $f(3,2) = 16$. $f(3,2)$ è mostrato sotto:
Find the sum of all f(m,n) such that f(m,n) ≤ 1015.
<img class="img-responsive center-block" alt="animazione con 16 modi per avere 3 condimenti diversi su 2 fette ciascuno" src="https://cdn.freecodecamp.org/curriculum/project-euler/pizza-toppings.gif" style="background-color: white; padding: 10px;" />
Trova la somma di tutte le $f(m,n)$ in modo tale che $f(m,n) ≤ {10}^{15}$.
# --hints--
`euler281()` should return 1485776387445623.
`pizzaToppings()` dovrebbe restituire `1485776387445623`.
```js
assert.strictEqual(euler281(), 1485776387445623);
assert.strictEqual(pizzaToppings(), 1485776387445623);
```
# --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler281(), 1485776387445623);
## --seed-contents--
```js
function euler281() {
function pizzaToppings() {
return true;
}
euler281();
pizzaToppings();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4861000cf542c50ff99
title: 'Problem 282: The Ackermann function'
title: 'Problema 282: La funzione Ackermann'
challengeType: 5
forumTopicId: 301933
dashedName: problem-282-the-ackermann-function
@ -8,18 +8,20 @@ dashedName: problem-282-the-ackermann-function
# --description--
For non-negative integers m, n, the Ackermann function A(m, n) is defined as follows:
Per gli interi non negativi $m$, $n$, la funzione Ackermann $A(m, n)$ è definita come segue:
For example A(1, 0) = 2, A(2, 2) = 7 and A(3, 4) = 125.
$$A(m, n) = \begin{cases} n + 1 & \text{if $m = 0$} \\\\ A(m - 1, 1) & \text{if $m > 0$ e $n = 0$} \\\\ A(m - 1, A(m, n - 1)) & \text{if $m > 0$ e $n > 0$} \end{cases}$$
Find A(n, n) and give your answer mod 148.
Per esempio $A(1, 0) = 2$, $A(2, 2) = 7$ e $A(3, 4) = 125$.
Trova $\displaystyle\sum_{n = 0}^6 A(n, n)$ e dai la tua risposta mod ${14}^8$.
# --hints--
`euler282()` should return 1098988351.
`ackermanFunction()` dovrebbe restituire `1098988351`.
```js
assert.strictEqual(euler282(), 1098988351);
assert.strictEqual(ackermanFunction(), 1098988351);
```
# --seed--
@ -27,12 +29,12 @@ assert.strictEqual(euler282(), 1098988351);
## --seed-contents--
```js
function euler282() {
function ackermanFunction() {
return true;
}
euler282();
ackermanFunction();
```
# --solutions--

View File

@ -1,7 +1,7 @@
---
id: 5900f4881000cf542c50ff9a
title: >-
Problem 283: Integer sided triangles for which the area * perimeter ratio is integral
Problema 283: Triangoli con lati interi per i quali il rapporto area / perimetro è intero
challengeType: 5
forumTopicId: 301934
dashedName: >-
@ -10,22 +10,22 @@ dashedName: >-
# --description--
Consider the triangle with sides 6, 8 and 10. It can be seen that the perimeter and the area are both equal to 24.
Considera il triangolo con i lati 6, 8 e 10. Si può vedere che il perimetro e l'area sono entrambi uguali a 24.
So the area/perimeter ratio is equal to 1.
Quindi il rapporto $\frac{\text{area}}{\text{perimeter}}$ è uguale a 1.
Consider also the triangle with sides 13, 14 and 15. The perimeter equals 42 while the area is equal to 84.
Considera anche il triangolo con i lati 13, 14 e 15. Il perimetro è uguale a 42 mentre l'area è pari a 84.
So for this triangle the area/perimeter ratio is equal to 2.
Quindi per questo triangolo il rapporto $\frac{\text{area}}{\text{perimeter}}$ è uguale a 2.
Find the sum of the perimeters of all integer sided triangles for which the area/perimeter ratios are equal to positive integers not exceeding 1000.
Trova la somma dei perimetri di tutti i triangoli con lati interi per i quali i rapporti area/perimetro sono uguali a interi positivi non superiori a 1000.
# --hints--
`euler283()` should return 28038042525570324.
`integralAreaPerimeterRatio()` dovrebbe restituire `28038042525570324`.
```js
assert.strictEqual(euler283(), 28038042525570324);
assert.strictEqual(integralAreaPerimeterRatio(), 28038042525570324);
```
# --seed--
@ -33,12 +33,12 @@ assert.strictEqual(euler283(), 28038042525570324);
## --seed-contents--
```js
function euler283() {
function integralAreaPerimeterRatio() {
return true;
}
euler283();
integralAreaPerimeterRatio();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4891000cf542c50ff9b
title: 'Problem 284: Steady Squares'
title: 'Problema 284: Quadrati stazionari'
challengeType: 5
forumTopicId: 301935
dashedName: problem-284-steady-squares
@ -8,20 +8,26 @@ dashedName: problem-284-steady-squares
# --description--
The 3-digit number 376 in the decimal numbering system is an example of numbers with the special property that its square ends with the same digits: 3762 = 141376. Let's call a number with this property a steady square.
Il numero 376 a 3 cifre nel sistema di numerazione decimale è un esempio di numeri con la proprietà speciale che il suo quadrato termina con le stesse cifre: ${376}^2 = 141376$. Chiamiamo un numero con questa proprietà un quadrato stazionario.
Steady squares can also be observed in other numbering systems. In the base 14 numbering system, the 3-digit number c37 is also a steady square: c372 = aa0c37, and the sum of its digits is c+3+7=18 in the same numbering system. The letters a, b, c and d are used for the 10, 11, 12 and 13 digits respectively, in a manner similar to the hexadecimal numbering system.
I quadrati stabili possono essere osservati anche in altri sistemi di numerazione. Nel sistema di numerazione base 14, il numero a 3 cifre $c37$ è anche un quadrato costante: $c37^2 = aa0c37$, e la somma delle sue cifre è $c+3+7=18$ nello stesso sistema di numerazione. Le lettere $a$, $b$, $c$ e $d$ sono usate rispettivamente per le cifre 10, 11, 12 e 13, in modo simile al sistema di numerazione esadecimale.
For 1 ≤ n ≤ 9, the sum of the digits of all the n-digit steady squares in the base 14 numbering system is 2d8 (582 decimal). Steady squares with leading 0's are not allowed.
Per $1 ≤ n ≤ 9$, la somma delle cifre di tutti i quadrati stazionari a cifra $n$ nel sistema di numerazione base 14 è $2d8$ (582 decimali). I quadrati stabili con 0 iniziali non sono permessi.
Find the sum of the digits of all the n-digit steady squares in the base 14 numbering system for 1 ≤ n ≤ 10000 (decimal) and give your answer in the base 14 system using lower case letters where necessary.
Trova la somma delle cifre di tutti i quadrati stazionari di $n$ nel sistema di numerazione della base 14 per $1 ≤ n ≤ 10000$ (decimale) e dai la tua risposta come una stringa nel sistema base 14 utilizzando lettere minuscole se necessario.
# --hints--
`euler284()` should return 5a411d7b.
`steadySquares()` dovrebbe restituire una stringa.
```js
assert.strictEqual(euler284(), '5a411d7b');
assert(typeof steadySquares() === 'string');
```
`steadySquares()` dovrebbe restituire la stringa `5a411d7b`.
```js
assert.strictEqual(steadySquares(), '5a411d7b');
```
# --seed--
@ -29,12 +35,12 @@ assert.strictEqual(euler284(), '5a411d7b');
## --seed-contents--
```js
function euler284() {
function steadySquares() {
return true;
}
euler284();
steadySquares();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48a1000cf542c50ff9c
title: 'Problem 285: Pythagorean odds'
title: 'Problema 285: disparità pitagoriche'
challengeType: 5
forumTopicId: 301936
dashedName: problem-285-pythagorean-odds
@ -8,22 +8,22 @@ dashedName: problem-285-pythagorean-odds
# --description--
Albert chooses a positive integer k, then two real numbers a, b are randomly chosen in the interval \[0,1] with uniform distribution.
Albert sceglie un numero intero positivo $k$, quindi due numeri reali $a$, $b$ sono scelti casualmente nell'intervallo [0,1] con distribuzione uniforme.
The square root of the sum (k·a+1)2 + (k·b+1)2 is then computed and rounded to the nearest integer. If the result is equal to k, he scores k points; otherwise he scores nothing.
La radice quadrata della somma ${(ka + 1)}^2 + {(kb + 1)}^2$ viene quindi calcolata e arrotondata alla cifra intera più vicina. Se il risultato è uguale a $k$, ottiene $k$ punti; altrimenti non ottiene nulla.
For example, if k = 6, a = 0.2 and b = 0.85, then (k·a+1)2 + (k·b+1)2 = 42.05. The square root of 42.05 is 6.484... and when rounded to the nearest integer, it becomes 6. This is equal to k, so he scores 6 points.
Per esempio, se $k = 6$, $a = 0.2$ e $b = 0.85$, poi ${(ka + 1)}^2 + {(kb + 1)}^2 = 42.05$. La radice quadrata di 42.05 è 6.484... che arrotondata al numero intero più vicino, diventa 6. Questo è uguale a $k$, quindi ottiene 6 punti.
It can be shown that if he plays 10 turns with k = 1, k = 2, ..., k = 10, the expected value of his total score, rounded to five decimal places, is 10.20914.
Si può dimostrare che se gioca 10 turni con $k = 1, k = 2, \ldots, k = 10$, il valore previsto del suo punteggio totale, arrotondato al quinto decimale, è 10.20914.
If he plays 105 turns with k = 1, k = 2, k = 3, ..., k = 105, what is the expected value of his total score, rounded to five decimal places?
Se gioca ${10}^5$ turni con $k = 1, k = 2, k = 3, \ldots, k = {10}^5$, qual è il valore previsto del suo punteggio totale, arrotondato al quinto decimale?
# --hints--
`euler285()` should return 157055.80999.
`pythagoreanOdds()` dovrebbe restituire `157055.80999`.
```js
assert.strictEqual(euler285(), 157055.80999);
assert.strictEqual(pythagoreanOdds(), 157055.80999);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler285(), 157055.80999);
## --seed-contents--
```js
function euler285() {
function pythagoreanOdds() {
return true;
}
euler285();
pythagoreanOdds();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48a1000cf542c50ff9d
title: 'Problem 286: Scoring probabilities'
title: 'Problema 286: Dare punteggi alle probabilità'
challengeType: 5
forumTopicId: 301937
dashedName: problem-286-scoring-probabilities
@ -8,18 +8,18 @@ dashedName: problem-286-scoring-probabilities
# --description--
Barbara is a mathematician and a basketball player. She has found that the probability of scoring a point when shooting from a distance x is exactly (1 - x/q), where q is a real constant greater than 50.
Barbara è una matematica e una giocatrice di basket. Ha trovato che la probabilità di segnare un punto quando lanciando da una distanza $x$ è esattamente ($1 - \frac{x}{q}$), dove $q$ è una costante reale maggiore di 50.
During each practice run, she takes shots from distances x = 1, x = 2, ..., x = 50 and, according to her records, she has precisely a 2 % chance to score a total of exactly 20 points.
Durante ogni giro di pratica, lancia la palla da distanze $x = 1, x = 2, \ldots, x = 50$ e, secondo le sue registrazioni, ha precisamente un 2 % di possibilità di segnare esattamente 20 punti.
Find q and give your answer rounded to 10 decimal places.
Trova $q$ e dai la tua risposta arrotondata a 10 cifre decimali.
# --hints--
`euler286()` should return 52.6494571953.
`scoringProbabilities()` dovrebbe restituire `52.6494571953`.
```js
assert.strictEqual(euler286(), 52.6494571953);
assert.strictEqual(scoringProbabilities(), 52.6494571953);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler286(), 52.6494571953);
## --seed-contents--
```js
function euler286() {
function scoringProbabilities() {
return true;
}
euler286();
scoringProbabilities();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48b1000cf542c50ff9e
title: 'Problem 287: Quadtree encoding (a simple compression algorithm)'
title: 'Problema 287: Codifica Quadtree (un semplice algoritmo di compressione)'
challengeType: 5
forumTopicId: 301938
dashedName: problem-287-quadtree-encoding-a-simple-compression-algorithm
@ -8,30 +8,35 @@ dashedName: problem-287-quadtree-encoding-a-simple-compression-algorithm
# --description--
The quadtree encoding allows us to describe a 2N×2N black and white image as a sequence of bits (0 and 1). Those sequences are to be read from left to right like this:
La codifica Quadtree ci permette di descrivere un'immagine $2^N×2^N$ in bianco e nero come sequenza di bit (0 e 1). Queste sequenze devono essere lette da sinistra a destra in questo modo:
the first bit deals with the complete 2N×2N region;
- il primo bit si occupa dell'intera regione $2^N×2^N$;
- "0" indica una suddivisione:
- la regione attuale $2^n×2^n$ è divisa in 4 sottoregioni di dimensione $2^{n - 1}×2^{n - 1}$,
- i bit successivi contengono la descrizione delle sottoregioni in alto a sinistra, in alto a destra, in basso a sinistra e in basso a destra - in quell'ordine;
- "10" indica che la regione corrente contiene solo pixel neri;
- "11" indica che la regione corrente contiene solo pixel bianchi.
"0" denotes a split:
Considera la seguente immagine 4×4 (i segni colorati indicano i luoghi in cui può verificarsi una divisione):
the current 2n×2n region is divided into 4 sub-regions of dimension 2n-1×2n-1,
<img class="img-responsive center-block" alt="Immagine 4x4 con segni colorati che indicano il luogo in cui può verificarsi la divisione" src="https://cdn.freecodecamp.org/curriculum/project-euler/quadtree-encoding-a-simple-compression-algorithm.gif" style="background-color: white; padding: 10px;" />
the next bits contains the description of the top left, top right, bottom left and bottom right sub-regions - in that order;
Questa immagine può essere descritta da diverse sequenze, ad esempio: "<strong><span style="color: red">0</span></strong><strong><span style="color: blue">0</span></strong>10101010<strong><span style="color: green">0</span></strong>1011111011<strong><span style="color: orange">0</span></strong>10101010", di lunghezza 30, o "<strong><span style="color: red">0</span></strong>10<strong><span style="color: green">0</span></strong>101111101110", di lunghezza 16, che è la sequenza minima per questa immagine.
"10" indicates that the current region contains only black pixels;
Per un numero intero positivo $N$, definisci $D_N$ come l'immagine $2^N×2^N$ con il seguente schema di colorazione:
"11" indicates that the current region contains only white pixels.Consider the following 4×4 image (colored marks denote places where a split can occur):
- il pixel con le coordinate $x = 0$, $y = 0$ corrisponde al pixel in basso a sinistra,
- se ${(x - 2^{N - 1})}^2 + {(y - 2^{N - 1})}^2 ≤ 2^{2N - 2}$ allora il pixel è nero,
- altrimenti il pixel è bianco.
This image can be described by several sequences, for example : "001010101001011111011010101010", of length 30, or "0100101111101110", of length 16, which is the minimal sequence for this image.
For a positive integer N, define DN as the 2N×2N image with the following coloring scheme: the pixel with coordinates x = 0, y = 0 corresponds to the bottom left pixel, if (x - 2N-1)2 + (y - 2N-1)2 ≤ 22N-2 then the pixel is black, otherwise the pixel is white.What is the length of the minimal sequence describing D24 ?
Qual è la lunghezza della sequenza minima che descrive $D_{24}$?
# --hints--
`euler287()` should return 313135496.
`quadtreeEncoding()` dovrebbe restituire `313135496`.
```js
assert.strictEqual(euler287(), 313135496);
assert.strictEqual(quadtreeEncoding(), 313135496);
```
# --seed--
@ -39,12 +44,12 @@ assert.strictEqual(euler287(), 313135496);
## --seed-contents--
```js
function euler287() {
function quadtreeEncoding() {
return true;
}
euler287();
quadtreeEncoding();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48d1000cf542c50ff9f
title: 'Problem 288: An enormous factorial'
title: 'Problema 288: Un fattoriale enorme'
challengeType: 5
forumTopicId: 301939
dashedName: problem-288-an-enormous-factorial
@ -8,24 +8,24 @@ dashedName: problem-288-an-enormous-factorial
# --description--
For any prime p the number N(p,q) is defined by
Per ogni numero primo $p$ il numero $N(p, q)$ è definito da $N(p,q) = \sum_{n=0}^q T_n \times p^n$ con $T_n$ generato dal seguente generatore casuale di numeri:
N(p,q) = ∑n=0 to q Tn\*pn with Tn generated by the following random number generator:
$$\begin{align} & S_0 = 290797 \\\\ & S_{n + 1} = {S_n}^2\bmod 50\\,515\\,093 \\\\ & T_n = S_n\bmod p \end{align}$$
S0 = 290797 Sn+1 = Sn2 mod 50515093 Tn = Sn mod p
Sia $Nfac(p,q)$ il fattoriale di $N(p,q)$.
Let Nfac(p,q) be the factorial of N(p,q). Let NF(p,q) be the number of factors p in Nfac(p,q).
Sia $NF(p,q)$ il numero di fattori $p$ in $Nfac(p,q)$.
You are given that NF(3,10000) mod 320=624955285.
Ti è dato che $NF(3,10000) \bmod 3^{20} = 624\\,955\\,285$.
Find NF(61,107) mod 6110
Trova $NF(61,{10}^7)\bmod {61}^{10}$.
# --hints--
`euler288()` should return 605857431263982000.
`enormousFactorial()` dovrebbe restituire `605857431263982000`.
```js
assert.strictEqual(euler288(), 605857431263982000);
assert.strictEqual(enormousFactorial(), 605857431263982000);
```
# --seed--
@ -33,12 +33,12 @@ assert.strictEqual(euler288(), 605857431263982000);
## --seed-contents--
```js
function euler288() {
function enormousFactorial() {
return true;
}
euler288();
enormousFactorial();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48d1000cf542c50ffa0
title: 'Problem 289: Eulerian Cycles'
title: 'Problema 289: Cicli Euleriani'
challengeType: 5
forumTopicId: 301940
dashedName: problem-289-eulerian-cycles
@ -8,24 +8,26 @@ dashedName: problem-289-eulerian-cycles
# --description--
Let C(x,y) be a circle passing through the points (x, y), (x, y+1), (x+1, y) and (x+1, y+1).
Sia $C(x,y)$ una circonferenza che passa attraverso i punti ($x$, $y$), ($x$, $y + 1$), ($x + 1$, $y$) e ($x + 1$, $y + 1$).
For positive integers m and n, let E(m,n) be a configuration which consists of the m·n circles: { C(x,y): 0 ≤ x &lt; m, 0 ≤ y &lt; n, x and y are integers }
Dati i numeri interi positivi $m$ e $n$, sia $E(m,n)$ una configurazione che consiste di $m·n$ circonferenze: { $C(x,y)$: $0 ≤ x &lt; m$, $0 ≤ y &lt; n$, con $x$ e $y$ interi }
An Eulerian cycle on E(m,n) is a closed path that passes through each arc exactly once. Many such paths are possible on E(m,n), but we are only interested in those which are not self-crossing: A non-crossing path just touches itself at lattice points, but it never crosses itself.
Un ciclo Euleriano su $E(m,n)$ è un percorso chiuso che passa attraverso ogni arco esattamente una volta. Molti di questi percorsi sono possibili su $E(m,n)$, ma siamo interessati solo a quelli che non sono auto-attraversanti: un sentiero non incrociato si tocca solo ai punti di reticolo, ma non si attraversa mai.
The image below shows E(3,3) and an example of an Eulerian non-crossing path.
L'immagine qui sotto mostra $E(3,3)$ e un esempio di un percorso Euleriano senza incroci.
Let L(m,n) be the number of Eulerian non-crossing paths on E(m,n). For example, L(1,2) = 2, L(2,2) = 37 and L(3,3) = 104290.
<img class="img-responsive center-block" alt="Ciclo Euleriano E(3, 3) e percorso Euleriano senza incroci" src="https://cdn.freecodecamp.org/curriculum/project-euler/eulerian-cycles.gif" style="background-color: white; padding: 10px;" />
Find L(6,10) mod 1010.
Sia $L(m,n)$ il numero di percorsi Euleriani senza incroci su $E(m,n)$. Per esempio, $L(1,2) = 2$, $L(2,2) = 37$ e $L(3,3) = 104290$.
Trova $L(6,10)\bmod {10}^{10}$.
# --hints--
`euler289()` should return 6567944538.
`eulerianCycles()` dovrebbe restituire `6567944538`.
```js
assert.strictEqual(euler289(), 6567944538);
assert.strictEqual(eulerianCycles(), 6567944538);
```
# --seed--
@ -33,12 +35,12 @@ assert.strictEqual(euler289(), 6567944538);
## --seed-contents--
```js
function euler289() {
function eulerianCycles() {
return true;
}
euler289();
eulerianCycles();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48f1000cf542c50ffa1
title: 'Problem 290: Digital Signature'
title: 'Problema 290: Firma Digitale'
challengeType: 5
forumTopicId: 301942
dashedName: problem-290-digital-signature
@ -8,14 +8,14 @@ dashedName: problem-290-digital-signature
# --description--
How many integers 0 ≤ n &lt; 1018 have the property that the sum of the digits of n equals the sum of digits of 137n?
Quanti interi $0 ≤ n &lt; {10}^{18}$ hanno la proprietà che la somma delle cifre di $n$ è uguale alla somma delle cifre di $137n$?
# --hints--
`euler290()` should return 20444710234716470.
`digitalSignature()` dovrebbe restituire `20444710234716470`.
```js
assert.strictEqual(euler290(), 20444710234716470);
assert.strictEqual(digitalSignature(), 20444710234716470);
```
# --seed--
@ -23,12 +23,12 @@ assert.strictEqual(euler290(), 20444710234716470);
## --seed-contents--
```js
function euler290() {
function digitalSignature() {
return true;
}
euler290();
digitalSignature();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f48f1000cf542c50ffa2
title: 'Problem 291: Panaitopol Primes'
title: 'Problema 291: Primi di Panaitopol'
challengeType: 5
forumTopicId: 301943
dashedName: problem-291-panaitopol-primes
@ -8,16 +8,16 @@ dashedName: problem-291-panaitopol-primes
# --description--
A prime number p is called a Panaitopol prime if for some positive integersx and y.
Un numero primo $p$ viene chiamato primo Panaitopol se $p = \frac{x^4 - y^4}{x^3 + y^3}$ per qualche numero positivo $x$ e $y$.
Find how many Panaitopol primes are less than 5×1015.
Trova quanti primi di Panaitopol sono sotto $5 × {10}^{15}$.
# --hints--
`euler291()` should return 4037526.
`panaitopolPrimes()` dovrebbe restituire `4037526`.
```js
assert.strictEqual(euler291(), 4037526);
assert.strictEqual(panaitopolPrimes(), 4037526);
```
# --seed--
@ -25,12 +25,12 @@ assert.strictEqual(euler291(), 4037526);
## --seed-contents--
```js
function euler291() {
function panaitopolPrimes() {
return true;
}
euler291();
panaitopolPrimes();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4911000cf542c50ffa3
title: 'Problem 292: Pythagorean Polygons'
title: 'Problema 292: Poligoni Pitagorici'
challengeType: 5
forumTopicId: 301944
dashedName: problem-292-pythagorean-polygons
@ -8,24 +8,27 @@ dashedName: problem-292-pythagorean-polygons
# --description--
We shall define a pythagorean polygon to be a convex polygon with the following properties:there are at least three vertices,
Definiremo un poligono pitagorico come poligono convesso con le seguenti proprietà:
no three vertices are aligned,
- ci sono almeno tre vertici,
- non ci sono tre vertici allineati,
- ogni vertice ha coordinate intere,
- ogni lato ha lunghezza intera.
each vertex has integer coordinates,
Per un dato numero intero $n$, definire $P(n)$ come il numero di poligoni pitagorici distinti per i quali il perimetro è $≤ n$.
each edge has integer length.For a given integer n, define P(n) as the number of distinct pythagorean polygons for which the perimeter is ≤ n.
I poligoni pitagorici dovrebbero essere considerati distinti purché nessuno sia la traduzione di un altro.
Pythagorean polygons should be considered distinct as long as none is a translation of another.
Ti viene dato che $P(4) = 1$, $P(30) = 3655$ e $P(60) = 891045$.
You are given that P(4) = 1, P(30) = 3655 and P(60) = 891045. Find P(120).
Trova $P(120)$.
# --hints--
`euler292()` should return 3600060866.
`pythagoreanPolygons()` dovrebbe restituire `3600060866`.
```js
assert.strictEqual(euler292(), 3600060866);
assert.strictEqual(pythagoreanPolygons(), 3600060866);
```
# --seed--
@ -33,12 +36,12 @@ assert.strictEqual(euler292(), 3600060866);
## --seed-contents--
```js
function euler292() {
function pythagoreanPolygons() {
return true;
}
euler292();
pythagoreanPolygons();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4931000cf542c50ffa4
title: 'Problem 293: Pseudo-Fortunate Numbers'
title: 'Problema 293: Numeri Pseudo-Fortunati'
challengeType: 5
forumTopicId: 301945
dashedName: problem-293-pseudo-fortunate-numbers
@ -8,22 +8,22 @@ dashedName: problem-293-pseudo-fortunate-numbers
# --description--
An even positive integer N will be called admissible, if it is a power of 2 or its distinct prime factors are consecutive primes.
Un intero pari positivo $N$ sarà chiamato ammissibile, se è una potenza di 2 o i suoi distinti fattori primi sono primi consecutivi.
The first twelve admissible numbers are 2,4,6,8,12,16,18,24,30,32,36,48.
I primi dodici numeri ammissibili sono 2, 4, 6, 8, 12, 16, 18, 24, 30, 32, 36, 48.
If N is admissible, the smallest integer M > 1 such that N+M is prime, will be called the pseudo-Fortunate number for N.
Se $N$ è ammissibile, il più piccolo numero intero $M > 1$ tale che la somma $N + M$ sia prima, sarà chiamato il numero pseudo-fortunato per $N$.
For example, N=630 is admissible since it is even and its distinct prime factors are the consecutive primes 2,3,5 and 7. The next prime number after 631 is 641; hence, the pseudo-Fortunate number for 630 is M=11. It can also be seen that the pseudo-Fortunate number for 16 is 3.
Ad esempio $N = 630$ è ammissibile in quanto è pari e i suoi distinti fattori primi sono i primi consecutivi 2, 3, 5 e 7. Il numero primo successivo a 631 è 641; quindi il numero pseudo-fortunato per 630 è $M = 11$. Si può anche vedere che il numero pseudo-fortunato per 16 è 3.
Find the sum of all distinct pseudo-Fortunate numbers for admissible numbers N less than 109.
Trova la somma di tutti i numeri pseudo-fortunati distinti per i numeri ammissibili $N$ minori di ${10}^9$.
# --hints--
`euler293()` should return 2209.
`pseudoFortunateNumbers()` dovrebbe restituire `2209`.
```js
assert.strictEqual(euler293(), 2209);
assert.strictEqual(pseudoFortunateNumbers(), 2209);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler293(), 2209);
## --seed-contents--
```js
function euler293() {
function pseudoFortunateNumbers() {
return true;
}
euler293();
pseudoFortunateNumbers();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4931000cf542c50ffa5
title: 'Problem 294: Sum of digits - experience #23'
title: 'Problema 294: Somma delle cifre - esperienza #23'
challengeType: 5
forumTopicId: 301946
dashedName: problem-294-sum-of-digits---experience-23
@ -8,22 +8,23 @@ dashedName: problem-294-sum-of-digits---experience-23
# --description--
For a positive integer k, define d(k) as the sum of the digits of k in its usual decimal representation.
Per un numero intero positivo $k$, si definisca $d(k)$ come la somma delle cifre di $k$ nella sua solita rappresentazione decimale. Così $d(42) = 4 + 2 = 6$.
Thus d(42) = 4+2 = 6.
Per un numero intero positivo $n$, definisci $S(n)$ come il numero di numeri interi positivi $k &lt; {10}^n$ con le seguenti proprietà:
For a positive integer n, define S(n) as the number of positive integers k &lt; 10n with the following properties : k is divisible by 23 and d(k) = 23.
- $k$ è divisibile per 23 e
- $d(k) = 23$.
You are given that S(9) = 263626 and S(42) = 6377168878570056.
Ti è dato che $S(9) = 263\\,626$ e $S(42) = 6\\,377\\,168\\,878\\,570\\,056$.
Find S(1112) and give your answer mod 109.
Trova $S({11}^{12})$ e dai la tua risposta $\bmod {10}^9$.
# --hints--
`euler294()` should return 789184709.
`experience23()` dovrebbe restituire `789184709`.
```js
assert.strictEqual(euler294(), 789184709);
assert.strictEqual(experience23(), 789184709);
```
# --seed--
@ -31,12 +32,12 @@ assert.strictEqual(euler294(), 789184709);
## --seed-contents--
```js
function euler294() {
function experience23() {
return true;
}
euler294();
experience23();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4931000cf542c50ffa6
title: 'Problem 295: Lenticular holes'
title: 'Problema 295: Fori lenticolari'
challengeType: 5
forumTopicId: 301947
dashedName: problem-295-lenticular-holes
@ -8,32 +8,34 @@ dashedName: problem-295-lenticular-holes
# --description--
We call the convex area enclosed by two circles a lenticular hole if:
Chiamiamo l'area convessa racchiusa da due cerchi un foro lenticolare se:
The centres of both circles are on lattice points.
- I centri di entrambi i cerchi sono su punti del reticolo.
- I due cerchi si intersecano in due distinti punti di reticolo.
- L'interno dell'area convessa racchiusa da entrambi i cerchi non contiene punti di reticolo.
The two circles intersect at two distinct lattice points.
Considera i cerchi:
The interior of the convex area enclosed by both circles does not contain any lattice points.
$$\begin{align} & C_0: x^2 + y^2 = 25 \\\\ & C_1: {(x + 4)}^2 + {(y - 4)}^2 = 1 \\\\ & C_2: {(x - 12)}^2 + {(y - 4)}^2 = 65 \end{align}$$
Consider the circles: C0: x2+y2=25 C1: (x+4)2+(y-4)2=1 C2: (x-12)2+(y-4)2=65
I cerchi $C_0$, $C_1$ e $C_2$ sono disegnati nell'immagine sottostante.
The circles C0, C1 and C2 are drawn in the picture below.
<img class="img-responsive center-block" alt="cerchi C_0, C_1 e C_2" src="https://cdn.freecodecamp.org/curriculum/project-euler/lenticular-holes.gif" style="background-color: white; padding: 10px;" />
C0 and C1 form a lenticular hole, as well as C0 and C2.
$C_0$ e $C_1$ formano un foro lenticolare, così come $C_0$ e $C_2$.
We call an ordered pair of positive real numbers (r1, r2) a lenticular pair if there exist two circles with radii r1 and r2 that form a lenticular hole. We can verify that (1, 5) and (5, √65) are the lenticular pairs of the example above.
Chiamiamo una coppia ordinata di numeri reali positivi ($r_1$, $r_2$) una coppia lenticolare se esistono due cerchi con raggi $r_1$ e $r_2$ che formano un foro lenticolare. Possiamo verificare che ($1$, $5$) e ($5$, $\sqrt{65}$) sono le coppie lenticolari dell'esempio sopra.
Let L(N) be the number of distinct lenticular pairs (r1, r2) for which 0 &lt; r1 ≤ r2 ≤ N. We can verify that L(10) = 30 and L(100) = 3442.
Sia $L(N)$ il numero di coppie lenticolari distinte ($r_1$, $r_2$) per le quali $0 &lt; r_1 ≤ r_2 ≤ N$. Possiamo verificare che $L(10) = 30$ e $L(100) = 3442$.
Find L(100 000).
Trova $L(100\\,000)$.
# --hints--
`euler295()` should return 4884650818.
`lenticularHoles()` dovrebbe restituire `4884650818`.
```js
assert.strictEqual(euler295(), 4884650818);
assert.strictEqual(lenticularHoles(), 4884650818);
```
# --seed--
@ -41,12 +43,12 @@ assert.strictEqual(euler295(), 4884650818);
## --seed-contents--
```js
function euler295() {
function lenticularHoles() {
return true;
}
euler295();
lenticularHoles();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4941000cf542c50ffa7
title: 'Problem 296: Angular Bisector and Tangent'
title: 'Problema 296: Bisettrice angolare e tangente'
challengeType: 5
forumTopicId: 301948
dashedName: problem-296-angular-bisector-and-tangent
@ -8,18 +8,20 @@ dashedName: problem-296-angular-bisector-and-tangent
# --description--
Given is an integer sided triangle ABC with BC ≤ AC ≤ AB.k is the angular bisector of angle ACB.m is the tangent at C to the circumscribed circle of ABC.n is a line parallel to m through B.
Dato un triangolo intero $ABC$ con $BC ≤ AC ≤ AB$. $k$ è la bisettrice angolare dell'angolo $ACB$. $m$ è la tangente a $C$ nel cerchio circoscritto di $ABC$. $n$ è una linea parallela a $m$ attraverso $B$.
The intersection of n and k is called E.
L'intersezione di $n$ e $k$ viene chiamata $E$.
How many triangles ABC with a perimeter not exceeding 100 000 exist such that BE has integral length?
<img class="img-responsive center-block" alt="triangolo ABC, con k - il bisettore angolare dell'angolo ACB, m - tangente nel punto C, n - linea parallela a m attraverso B, e punto E - intersezione di k e n" src="https://cdn.freecodecamp.org/curriculum/project-euler/angular-bisector-and-tangent.gif" style="background-color: white; padding: 10px;" />
Quanti triangoli $ABC$ con un perimetro non superiore a $100\\,000$ esistono tali che $BE$ ha lunghezza intera?
# --hints--
`euler296()` should return 1137208419.
`angularBisectorAndTangent()` dovrebbe restituire `1137208419`.
```js
assert.strictEqual(euler296(), 1137208419);
assert.strictEqual(angularBisectorAndTangent(), 1137208419);
```
# --seed--
@ -27,12 +29,12 @@ assert.strictEqual(euler296(), 1137208419);
## --seed-contents--
```js
function euler296() {
function angularBisectorAndTangent() {
return true;
}
euler296();
angularBisectorAndTangent();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4951000cf542c50ffa8
title: 'Problem 297: Zeckendorf Representation'
title: 'Problema 297: rappresentazione di Zeckendorf'
challengeType: 5
forumTopicId: 301949
dashedName: problem-297-zeckendorf-representation
@ -8,22 +8,28 @@ dashedName: problem-297-zeckendorf-representation
# --description--
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
Ogni nuovo termine della sequenza di Fibonacci è dato dalla somma dei due numeri precedenti.
Starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.
Iniziando con 1 e 2, i primi 10 termini saranno: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.
Every positive integer can be uniquely written as a sum of nonconsecutive terms of the Fibonacci sequence. For example, 100 = 3 + 8 + 89. Such a sum is called the Zeckendorf representation of the number.
Ogni numero intero positivo può essere scritto in maniera unica come somma di termini non consecutivi della sequenza di Fibonacci. Ad esempio, 100 = 3 + 8 + 89.
For any integer n>0, let z(n) be the number of terms in the Zeckendorf representation of n. Thus, z(5) = 1, z(14) = 2, z(100) = 3 etc. Also, for 0&lt;n&lt;106, ∑ z(n) = 7894453.
Tale somma è chiamata la rappresentazione Zeckendorf del numero.
Find ∑ z(n) for 0&lt;n&lt;1017.
Per qualsiasi numero intero $n>0$, sia $z(n)$ il numero di termini nella rappresentazione di Zeckendorf di $n$.
Così, $z(5) = 1$, $z(14) = 2$, $z(100) = 3$ ecc.
Inoltre, per $0 &lt; n &lt; {10}^6$, $\sum z(n) = 7\\,894\\,453$.
Trova $\sum z(n)$ per $0 &lt; n &lt; {10}^{17}$.
# --hints--
`euler297()` should return 2252639041804718000.
`zeckendorfRepresentation()` dovrebbe restituire `2252639041804718000`.
```js
assert.strictEqual(euler297(), 2252639041804718000);
assert.strictEqual(zeckendorfRepresentation(), 2252639041804718000);
```
# --seed--
@ -31,12 +37,12 @@ assert.strictEqual(euler297(), 2252639041804718000);
## --seed-contents--
```js
function euler297() {
function zeckendorfRepresentation() {
return true;
}
euler297();
zeckendorfRepresentation();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4971000cf542c50ffa9
title: 'Problem 298: Selective Amnesia'
title: 'Problema 298: Amnesia Selettiva'
challengeType: 5
forumTopicId: 301950
dashedName: problem-298-selective-amnesia
@ -8,20 +8,33 @@ dashedName: problem-298-selective-amnesia
# --description--
Larry and Robin play a memory game involving of a sequence of random numbers between 1 and 10, inclusive, that are called out one at a time. Each player can remember up to 5 previous numbers. When the called number is in a player's memory, that player is awarded a point. If it's not, the player adds the called number to his memory, removing another number if his memory is full.
Larry e Robin giocano un gioco di memoria che coinvolge una sequenza di numeri casuali tra 1 e 10, inclusi, che sono chiamati uno alla volta. Ogni giocatore può ricordare fino a 5 numeri precedenti. Quando il numero chiamato è nella memoria di un giocatore, a quel giocatore viene assegnato un punto. In caso contrario, il giocatore aggiunge il numero chiamato alla sua memoria, rimuovendo un altro numero se la sua memoria è piena.
Both players start with empty memories. Both players always add new missed numbers to their memory but use a different strategy in deciding which number to remove: Larry's strategy is to remove the number that hasn't been called in the longest time. Robin's strategy is to remove the number that's been in the memory the longest time.
Entrambi i giocatori iniziano con memoria vuota. Entrambi i giocatori aggiungono sempre nuovi numeri mancati alla loro memoria, ma usano una strategia diversa nel decidere quale numero rimuovere: la strategia di Larry è quella di rimuovere il numero che non è stato chiamato più lungo. La strategia di Robin è quella di rimuovere il numero che è stato più a lungo nella memoria.
Example game:Turn Callednumber Larry'smemory Larry'sscore Robin'smemory Robin'sscore 1 1 1 0 1 0 2 2 1,2 0 1,2 0 3 4 1,2,4 0 1,2,4 0 4 6 1,2,4,6 0 1,2,4,6 0 5 1 1,2,4,6 1 1,2,4,6 1 6 8 1,2,4,6,8 1 1,2,4,6,8 1 7 10 1,4,6,8,10 1 2,4,6,8,10 1 8 2 1,2,6,8,10 1 2,4,6,8,10 2 9 4 1,2,4,8,10 1 2,4,6,8,10 3 10 1 1,2,4,8,10 2 1,4,6,8,10 3
Esempio di gioco:
Denoting Larry's score by L and Robin's score by R, what is the expected value of |L-R| after 50 turns? Give your answer rounded to eight decimal places using the format x.xxxxxxxx .
| Turno | Numero chiamato | Memoria di Larry | Punteggio di Larry | Memoria di Robin | Punteggio di Robin |
| ----- | --------------- | ----------------:| ------------------ | ---------------- | ------------------ |
| 1 | 1 | 1 | 0 | 1 | 0 |
| 2 | 2 | 1,2 | 0 | 1,2 | 0 |
| 3 | 4 | 1,2,4 | 0 | 1,2,4 | 0 |
| 4 | 6 | 1,2,4,6 | 0 | 1,2,4,6 | 0 |
| 5 | 1 | 1,2,4,6 | 1 | 1,2,4,6 | 1 |
| 6 | 8 | 1,2,4,6,8 | 1 | 1,2,4,6,8 | 1 |
| 7 | 10 | 1,4,6,8,10 | 1 | 2,4,6,8,10 | 1 |
| 8 | 2 | 1,2,6,8,10 | 1 | 2,4,6,8,10 | 2 |
| 9 | 4 | 1,2,4,8,10 | 1 | 2,4,6,8,10 | 3 |
| 10 | 1 | 1,2,4,8,10 | 2 | 1,4,6,8,10 | 3 |
Denotando il punteggio di Larry con $L$ e il punteggio di Robin con $R$, qual è il valore aspettato di $|L - R|$ dopo 50 turni? Dai il tuo risultato arrotondato a otto cifre decimali usando il formato x.xxxxxxxx .
# --hints--
`euler298()` should return 1.76882294.
`selectiveAmnesia()` dovrebbe restituire `1.76882294`.
```js
assert.strictEqual(euler298(), 1.76882294);
assert.strictEqual(selectiveAmnesia(), 1.76882294);
```
# --seed--
@ -29,12 +42,12 @@ assert.strictEqual(euler298(), 1.76882294);
## --seed-contents--
```js
function euler298() {
function selectiveAmnesia() {
return true;
}
euler298();
selectiveAmnesia();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4971000cf542c50ffaa
title: 'Problem 299: Three similar triangles'
title: 'Problema 299: Tre triangoli simili'
challengeType: 5
forumTopicId: 301951
dashedName: problem-299-three-similar-triangles
@ -8,26 +8,32 @@ dashedName: problem-299-three-similar-triangles
# --description--
Four points with integer coordinates are selected:A(a, 0), B(b, 0), C(0, c) and D(0, d),
Sono selezionati quattro punti con coordinate intere:
with 0 &lt; a &lt; b and 0 &lt; c &lt; d.
$A(a, 0)$, $B(b, 0)$, $C(0, c)$ and $D(0, d)$, with $0 &lt; a &lt; b$ and $0 &lt; c &lt; d$.
Point P, also with integer coordinates, is chosen on the line AC so that the three triangles ABP, CDP and BDP are all similar.
Il punto $P$, anch'esso con coordinate intere, è scelto sulla linea $AC$ in modo che i tre triangoli $ABP$, $CDP$ e $BDP$ siano tutti simili.
It is easy to prove that the three triangles can be similar, only if a=c.
<img class="img-responsive center-block" alt="i punti A, B, C, D e P creano tre triangoli: ABP, CDP e BDP" src="https://cdn.freecodecamp.org/curriculum/project-euler/three-similar-triangles.gif" style="background-color: white; padding: 10px;" />
So, given that a=c, we are looking for triplets (a,b,d) such that at least one point P (with integer coordinates) exists on AC, making the three triangles ABP, CDP and BDP all similar.
È facile dimostrare che i tre triangoli possono essere simili, solo se $a = c$.
For example, if (a,b,d)=(2,3,4), it can be easily verified that point P(1,1) satisfies the above condition. Note that the triplets (2,3,4) and (2,4,3) are considered as distinct, although point P(1,1) is common for both.
Quindi, dato che $a = c$, stiamo cercando triplette ($a$, $b$, $d$) tali che almeno un punto $P$ (con coordinate intere) esista su $AC$, rendendo i tre triangoli $ABP$, $CDP$ e $BDP$ tutti simili.
If b+d &lt; 100, there are 92 distinct triplets (a,b,d) such that point P exists. If b+d &lt; 100 000, there are 320471 distinct triplets (a,b,d) such that point P exists. If b+d &lt; 100 000 000, how many distinct triplets (a,b,d) are there such that point P exists?
Ad esempio, se $(a, b, d) = (2, 3, 4)$, può essere facilmente verificato che il punto $P(1, 1)$ soddisfa la condizione di cui sopra. Si noti che le triplette (2,3,4) e (2,4,3) sono considerate distinte, anche se il punto $P(1, 1)$ è comune per entrambe.
Se $b + d &lt; 100$, ci sono 92 triplette distinte ($a$, $b$, $d$) tali che il punto $P$ esista.
Se $b + d &lt; 100\\,000$, ci sono 320471 triplette distinte ($a$, $b$, $d$) tali che il punto $P$ esista.
Se $b + d &lt; 100\\,000\\,000$, quante triplette distinte ($a$, $b$, $d$) ci sono tali che il punto $P$ esista?
# --hints--
`euler299()` should return 549936643.
`threeSimilarTriangles()` dovrebbe restituire `549936643`.
```js
assert.strictEqual(euler299(), 549936643);
assert.strictEqual(threeSimilarTriangles(), 549936643);
```
# --seed--
@ -35,12 +41,12 @@ assert.strictEqual(euler299(), 549936643);
## --seed-contents--
```js
function euler299() {
function threeSimilarTriangles() {
return true;
}
euler299();
threeSimilarTriangles();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f49a1000cf542c50ffac
title: 'Problem 300: Protein folding'
title: 'Problema 300: Folding delle proteine'
challengeType: 5
forumTopicId: 301954
dashedName: problem-300-protein-folding
@ -8,26 +8,32 @@ dashedName: problem-300-protein-folding
# --description--
In a very simplified form, we can consider proteins as strings consisting of hydrophobic (H) and polar (P) elements, e.g. HHPPHHHPHHPH.
In un modo molto semplificato, possiamo considerare proteine come stringhe consistenti di elementi idrofobi (H) e polari (P), esempio HHPPHHHPHHPH.
For this problem, the orientation of a protein is important; e.g. HPP is considered distinct from PPH. Thus, there are 2n distinct proteins consisting of n elements.
Per questo problema è importante l'orientamento di una proteina; ad esempio, l'HPP è considerata diversa dalla PPH. Quindi ci sono $2^n$ proteine distinte consistenti di $n$ elementi.
When one encounters these strings in nature, they are always folded in such a way that the number of H-H contact points is as large as possible, since this is energetically advantageous. As a result, the H-elements tend to accumulate in the inner part, with the P-elements on the outside. Natural proteins are folded in three dimensions of course, but we will only consider protein folding in two dimensions.
Quando si incontrano queste stringhe in natura, sono sempre piegate in modo tale che il numero di punti di contatto H-H sia il più grande possibile, poiché ciò è energeticamente vantaggioso.
The figure below shows two possible ways that our example protein could be folded (H-H contact points are shown with red dots).
Di conseguenza, gli elementi H tendono ad accumularsi nella parte interna, con gli elementi P all'esterno.
The folding on the left has only six H-H contact points, thus it would never occur naturally. On the other hand, the folding on the right has nine H-H contact points, which is optimal for this string.
Le proteine naturali sono piegate in tre dimensioni, ma considereremo solo la piegatura in <u>due dimensioni</u>.
Assuming that H and P elements are equally likely to occur in any position along the string, the average number of H-H contact points in an optimal folding of a random protein string of length 8 turns out to be 850 / 28=3.3203125.
La figura seguente mostra due possibili modi in cui la nostra proteina di esempio potrebbe essere ripiegata (i punti di contatto H-H sono mostrati con punti rossi).
What is the average number of H-H contact points in an optimal folding of a random protein string of length 15? Give your answer using as many decimal places as necessary for an exact result.
<img class="img-responsive center-block" alt="due possibili modi di piegare la proteina di esempio" src="https://cdn.freecodecamp.org/curriculum/project-euler/protein-folding.gif" style="background-color: white; padding: 10px;" />
La piegatura a sinistra ha solo sei punti di contatto H-H, quindi non si verificherebbe mai naturalmente. D'altra parte, la piegatura a destra ha nove punti di contatto H-H, che è ottimale per questa stringa.
Supponendo che gli elementi H e P siano altrettanto probabili in qualsiasi posizione lungo la stringa, il numero medio di punti di contatto H-H in una piegatura ottimale di una stringa proteica casuale di lunghezza 8 risulta essere $\frac{850}{2^8} = 3.3 203125$.
Qual è il numero medio di punti di contatto H-H in una piegatura ottimale di una stringa proteica casuale di lunghezza 15? Dai la tua risposta usando quanti decimali sono necessari per un risultato esatto.
# --hints--
`euler300()` should return 8.0540771484375.
`proteinFolding()` dovrebbe restituire `8.0540771484375`.
```js
assert.strictEqual(euler300(), 8.0540771484375);
assert.strictEqual(proteinFolding(), 8.0540771484375);
```
# --seed--
@ -35,12 +41,12 @@ assert.strictEqual(euler300(), 8.0540771484375);
## --seed-contents--
```js
function euler300() {
function proteinFolding() {
return true;
}
euler300();
proteinFolding();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4991000cf542c50ffab
title: 'Problem 301: Nim'
title: 'Problema 301: Nim'
challengeType: 5
forumTopicId: 301955
dashedName: problem-301-nim
@ -8,29 +8,34 @@ dashedName: problem-301-nim
# --description--
Nim is a game played with heaps of stones, where two players take it in turn to remove any number of stones from any heap until no stones remain.
Nim è un gioco giocato con pile di pietre, dove due giocatori si alternano a rimuovere qualsiasi numero di pietre da qualsiasi pila fino a quando non rimangono più pietre.
We'll consider the three-heap normal-play version of Nim, which works as follows:
Considereremo la versione del gioco normale a tre pile di Nim, che funziona come segue:
- At the start of the game there are three heaps of stones.
- On his turn the player removes any positive number of stones from any single heap.
- The first player unable to move (because no stones remain) loses.
- All'inizio del gioco ci sono tre cumuli di pietre.
- Al suo turno il giocatore rimuove qualsiasi numero positivo di pietre da qualsiasi mucchio singolo.
- Il primo giocatore non in grado di muovere (perché non ci sono pietre rimaste) perde.
If (n1,n2,n3) indicates a Nim position consisting of heaps of size n1, n2 and n3 then there is a simple function X(n1,n2,n3) — that you may look up or attempt to deduce for yourself — that returns: zero if, with perfect strategy, the player about to move will eventually lose; or non-zero if, with perfect strategy, the player about to move will eventually win. For example X(1,2,3) = 0 because, no matter what the current player does, his opponent can respond with a move that leaves two heaps of equal size, at which point every move by the current player can be mirrored by his opponent until no stones remain; so the current player loses. To illustrate:
Se ($n_1$, $n_2$, $n_3$) indica una posizione Nim consistente in cumuli di dimensione $n_1$, $n_2$ e $n_3$ c'è una funzione semplice $X(n_1,n_2, _3)$ — che si può cercare o tentare di dedurre da sé — che restituisce:
- current player moves to (1,2,1)
- opponent moves to (1,0,1)
- current player moves to (0,0,1)
- opponent moves to (0,0,0), and so wins.
- zero se, con una strategia perfetta, il giocatore che sta per muovere alla fine perdere; o
- non zero se, con una strategia perfetta, il giocatore in procinto di muovere alla fine vincerà.
For how many positive integers n ≤ 230 does X(n,2n,3n) = 0 ?
Per esempio $X(1, 2, 3) = 0$ perché, indipendentemente da ciò che fa il giocatore attuale, il suo avversario può rispondere con una mossa che lascia due cumuli di uguale dimensione, e a punto ogni mossa dal giocatore attuale può essere specchiata dal suo avversario fino a quando non rimangano pietre; così il giocatore attuale perde. Per illustrare:
- il giocatore corrente muove a (1,2,1)
- l'avversario muove a (1,0,1)
- il giocatore corrente muove a (0,0,1)
- l'avversario muove a (0,0,0), e così vince.
Per quanti interi positivi $n ≤ 2^{30}$ si ottiene $X(n, 2n, 3n) = 0$?
# --hints--
`euler301()` should return 2178309.
`nim()` dovrebbe restituire `2178309`.
```js
assert.strictEqual(euler301(), 2178309);
assert.strictEqual(nim(), 2178309);
```
# --seed--
@ -38,12 +43,12 @@ assert.strictEqual(euler301(), 2178309);
## --seed-contents--
```js
function euler301() {
function nim() {
return true;
}
euler301();
nim();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f49b1000cf542c50ffad
title: 'Problem 302: Strong Achilles Numbers'
title: 'Problema 302: Forti numeri di Achille'
challengeType: 5
forumTopicId: 301956
dashedName: problem-302-strong-achilles-numbers
@ -8,26 +8,26 @@ dashedName: problem-302-strong-achilles-numbers
# --description--
A positive integer n is powerful if p2 is a divisor of n for every prime factor p in n.
Un numero intero positivo $n$ è potente se $p^2$ è un divisore di $n$ per ogni fattore primo $p$ in $n$.
A positive integer n is a perfect power if n can be expressed as a power of another positive integer.
Un numero intero positivo $n$ è una potenza perfetta se $n$ può essere espresso come potenza di un altro numero intero positivo.
A positive integer n is an Achilles number if n is powerful but not a perfect power. For example, 864 and 1800 are Achilles numbers: 864 = 25·33 and 1800 = 23·32·52.
Un numero intero positivo $n$ è un numero di Achille se $n$ è potente ma non una potenza perfetta. Ad esempio, 864 e 1800 sono numeri di Achille: $864 = 2^5 \tvolte 3^3$ e $1800 = 2^3 \tvolte 3^2 \tvolte 5^2$.
We shall call a positive integer S a Strong Achilles number if both S and φ(S) are Achilles numbers.1 For example, 864 is a Strong Achilles number: φ(864) = 288 = 25·32. However, 1800 isn't a Strong Achilles number because: φ(1800) = 480 = 25·31·51.
Chiameremo un numero intero positivo $S$ un numero forte di Achille se sia $S$ che $φ(S)$ sono numeri di Achille. $φ$ denota la funzione toziente di Eulero.
There are 7 Strong Achilles numbers below 104 and 656 below 108.
Ad esempio, 864 è un numero forte di Achille: $φ(864) = 288 = 2^5 \tvolte 3^2$. Tuttavia, 1800 non è un numero forte di Achille perché: $φ(1800) = 480 = 2^5 \times 3^1 \times 5^1$.
How many Strong Achilles numbers are there below 1018?
Ci sono 7 numeri di Achille forti sotto ${10}^4$ e 656 sotto ${10}^8$.
1 φ denotes Euler's totient function.
Quanti numeri di Achille forti ci sono sotto ${10}^{18}$?
# --hints--
`euler302()` should return 1170060.
`strongAchillesNumbers()` dovrebbe restituire `1170060`.
```js
assert.strictEqual(euler302(), 1170060);
assert.strictEqual(strongAchillesNumbers(), 1170060);
```
# --seed--
@ -35,12 +35,12 @@ assert.strictEqual(euler302(), 1170060);
## --seed-contents--
```js
function euler302() {
function strongAchillesNumbers() {
return true;
}
euler302();
strongAchillesNumbers();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f49b1000cf542c50ffae
title: 'Problem 303: Multiples with small digits'
title: 'Problema 303: Moltiplicazioni con cifre piccole'
challengeType: 5
forumTopicId: 301957
dashedName: problem-303-multiples-with-small-digits
@ -8,20 +8,20 @@ dashedName: problem-303-multiples-with-small-digits
# --description--
For a positive integer n, define f(n) as the least positive multiple of n that, written in base 10, uses only digits ≤ 2.
Per un numero intero positivo $n$, definisci $f(n)$ come il minore multiplo positivo di $n$ che, scritto in base 10, utilizza solo cifre $≤ 2$.
Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222.
Così $f(2) = 2$, $f(3) = 12$, $f(7) = 21$, $f(42) = 210$, $f(89) = 1\\,121\\,222$.
Also, .
Inoltre, $\displaystyle\sum_{n = 1}^{100} \frac{f(n)}{n} = 11\\,363\\,107$.
Find .
Trova $\displaystyle\sum_{n = 1}^{10\\,000} \frac{f(n)}{n}$.
# --hints--
`euler303()` should return 1111981904675169.
`multiplesWithSmallDigits()` dovrebbe restituire `1111981904675169`.
```js
assert.strictEqual(euler303(), 1111981904675169);
assert.strictEqual(multiplesWithSmallDigits(), 1111981904675169);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler303(), 1111981904675169);
## --seed-contents--
```js
function euler303() {
function multiplesWithSmallDigits() {
return true;
}
euler303();
multiplesWithSmallDigits();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f49d1000cf542c50ffaf
title: 'Problem 304: Primonacci'
title: 'Problema 304: Primonacci'
challengeType: 5
forumTopicId: 301958
dashedName: problem-304-primonacci
@ -8,22 +8,22 @@ dashedName: problem-304-primonacci
# --description--
For any positive integer n the function next_prime(n) returns the smallest prime p such that p>n.
Per qualsiasi numero intero positivo $n$ la funzione $\text{next_prime}(n)$ restituisce il più piccolo $p$ tale che $p > n$.
The sequence a(n) is defined by: a(1)=next_prime(1014) and a(n)=next_prime(a(n-1)) for n>1.
La sequenza $a(n)$ è definita da: $a(1) = \text{next_prime}({10}^{14})$ e $a(n) = \text{next_prime}(a(n - 1))$ per $n > 1$.
The fibonacci sequence f(n) is defined by: f(0)=0, f(1)=1 and f(n)=f(n-1)+f(n-2) for n>1.
La sequenza di fibonacci $f(n)$ è definita da: $f(0) = 0$, $f(1) = 1$ e $f(n) = f(n - 1) + f(n - 2)$ per $n > 1$.
The sequence b(n) is defined as f(a(n)).
La sequenza $b(n)$ è definita come $f(a(n))$.
Find ∑b(n) for 1≤n≤100 000. Give your answer mod 1234567891011.
Trova $\sum b(n)$ per $1≤n≤100\\,000$. Dai la tua risposta $\bmod 1\\,234\\,567\\,891\\,011$.
# --hints--
`euler304()` should return 283988410192.
`primonacci()` dovrebbe restituire `283988410192`.
```js
assert.strictEqual(euler304(), 283988410192);
assert.strictEqual(primonacci(), 283988410192);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler304(), 283988410192);
## --seed-contents--
```js
function euler304() {
function primonacci() {
return true;
}
euler304();
primonacci();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f49d1000cf542c50ffb0
title: 'Problem 305: Reflexive Position'
title: 'Problem 305: posizioni riflessive'
challengeType: 5
forumTopicId: 301959
dashedName: problem-305-reflexive-position
@ -8,22 +8,22 @@ dashedName: problem-305-reflexive-position
# --description--
Let's call S the (infinite) string that is made by concatenating the consecutive positive integers (starting from 1) written down in base 10.
Sia $S$ la stringa infinita creata concatenando i numeri positivi interi partendo da 1 in base 10.
Thus, S = 1234567891011121314151617181920212223242...
Quindi, $S = 1234567891011121314151617181920212223242\ldots$
It's easy to see that any number will show up an infinite number of times in S.
È facile vedere che ogni numero apparirà un numero infinito di volte in $S$.
Let's call f(n) the starting position of the nth occurrence of n in S. For example, f(1)=1, f(5)=81, f(12)=271 and f(7780)=111111365.
Sia $f(n)$ la posizione iniziale della $n$-sima occorrenza di $n$ in $S$. Per esempio, $f(1) = 1$, $f(5) = 81$, $f(12) = 271$ e $f(7780) = 111\\,111\\,365$.
Find ∑f(3k) for 1≤k≤13.
Trova $\sum f(3^k) per 1 ≤ k ≤ 13$.
# --hints--
`euler305()` should return 18174995535140.
`reflexivePosition()` dovrebbe restituire `18174995535140`.
```js
assert.strictEqual(euler305(), 18174995535140);
assert.strictEqual(reflexivePosition(), 18174995535140);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler305(), 18174995535140);
## --seed-contents--
```js
function euler305() {
function reflexivePosition() {
return true;
}
euler305();
reflexivePosition();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f49f1000cf542c50ffb1
title: 'Problem 306: Paper-strip Game'
title: 'Problema 306: Gioco della striscia di carta'
challengeType: 5
forumTopicId: 301960
dashedName: problem-306-paper-strip-game
@ -8,22 +8,30 @@ dashedName: problem-306-paper-strip-game
# --description--
The following game is a classic example of Combinatorial Game Theory:
Il seguente gioco è un classico esempio di Teoria dei Giochi Combinatoriale:
Two players start with a strip of n white squares and they take alternate turns. On each turn, a player picks two contiguous white squares and paints them black. The first player who cannot make a move loses.
Due giocatori iniziano con una striscia di $n$ quadrati bianchi e si alternano i turni. A ogni turno, un giocatore sceglie due quadrati bianchi contigui e li colora di nero. Il primo giocatore che non può fare una mossa, perde.
If n = 1, there are no valid moves, so the first player loses automatically. If n = 2, there is only one valid move, after which the second player loses. If n = 3, there are two valid moves, but both leave a situation where the second player loses. If n = 4, there are three valid moves for the first player; she can win the game by painting the two middle squares. If n = 5, there are four valid moves for the first player (shown below in red); but no matter what she does, the second player (blue) wins.
- $n = 1$: Non ci sono mosse valide, quindi il primo giocatore perde automaticamente.
- $n = 2$: Solo una mossa valida, dopo la quale il secondo giocatore perde.
- $n = 3$: Due mosse valide, ma entrambe lasciano una situazione in cui il secondo giocatore perde.
- $n = 4$: Ci sono tre mosse valide per il primo giocatore; il quale può vincere colorando i due quadrati centrali.
- $n = 5$: Quattro mosse valide per il primo giocatore (mostrate sotto in rosso); ma qualsiasi mossa sceglie, il secondo giocatore (blu) vince.
So, for 1 ≤ n ≤ 5, there are 3 values of n for which the first player can force a win. Similarly, for 1 ≤ n ≤ 50, there are 40 values of n for which the first player can force a win.
<img class="img-responsive center-block" alt="mosse iniziali valide per una striscia con 5 quadrati" src="https://cdn.freecodecamp.org/curriculum/project-euler/paper-strip-game.gif" style="background-color: white; padding: 10px;" />
For 1 ≤ n ≤ 1 000 000, how many values of n are there for which the first player can force a win?
Quindi, per $1 ≤ n ≤ 5$, ci sono 3 valori di $n$ per cui il primo giocatore può forzare una vittoria.
In maniera simile, per 1 ≤ n ≤ 50$, ci sono 40 valori di $n$ per cui il primo giocatore può forzare una vittoria.
Per $1 ≤ n ≤ 1\\,000\\,000$, quanti valori di $n$ ci sono per cui il primo giocatore può forzare una vittoria?
# --hints--
`euler306()` should return 852938.
`paperStripGame()` dovrebbe restituire `852938`.
```js
assert.strictEqual(euler306(), 852938);
assert.strictEqual(paperStripGame(), 852938);
```
# --seed--
@ -31,12 +39,12 @@ assert.strictEqual(euler306(), 852938);
## --seed-contents--
```js
function euler306() {
function paperStripGame() {
return true;
}
euler306();
paperStripGame();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a01000cf542c50ffb2
title: 'Problem 307: Chip Defects'
title: 'Problema 307: Chip difettosi'
challengeType: 5
forumTopicId: 301961
dashedName: problem-307-chip-defects
@ -8,18 +8,18 @@ dashedName: problem-307-chip-defects
# --description--
k defects are randomly distributed amongst n integrated-circuit chips produced by a factory (any number of defects may be found on a chip and each defect is independent of the other defects).
$k$ difetti sono distribuiti casualmente tra $n$ chip a circuito integrato prodotti da una fabbrica (qualsiasi numero di difetti può essere trovato su un chip e ogni difetto è indipendente dagli altri difetti).
Let p(k,n) represent the probability that there is a chip with at least 3 defects. For instance p(3,7) ≈ 0.0204081633.
Sia $p(k,n)$ la probabilità che ci sia un chip con almeno 3 difetti. Ad esempio $p(3,7) ≈ 0.0204081633$.
Find p(20 000, 1 000 000) and give your answer rounded to 10 decimal places in the form 0.abcdefghij
Trova $p(20\\,000, 1\\,000\\,000)$ e dai la tua risposta arrotondata a 10 decimali nella forma 0.abcdefghij
# --hints--
`euler307()` should return 0.7311720251.
`chipDefects()` dovrebbe restituire `0.7311720251`.
```js
assert.strictEqual(euler307(), 0.7311720251);
assert.strictEqual(chipDefects(), 0.7311720251);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler307(), 0.7311720251);
## --seed-contents--
```js
function euler307() {
function chipDefects() {
return true;
}
euler307();
chipDefects();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a11000cf542c50ffb3
title: 'Problem 308: An amazing Prime-generating Automaton'
title: 'Problema 308: Un fantastico automaton che genera numeri primi'
challengeType: 5
forumTopicId: 301962
dashedName: problem-308-an-amazing-prime-generating-automaton
@ -8,22 +8,30 @@ dashedName: problem-308-an-amazing-prime-generating-automaton
# --description--
A program written in the programming language Fractran consists of a list of fractions.
Un programma scritto nel linguaggio di programmazione Fractan consiste in una lista di frazioni.
The internal state of the Fractran Virtual Machine is a positive integer, which is initially set to a seed value. Each iteration of a Fractran program multiplies the state integer by the first fraction in the list which will leave it an integer.
Lo stato interno della Macchina Virtuale Fractan è un numero intero positivo, che è inizialmente impostato a un valore di seed. Ogni iterazione di un programma Fractan moltiplica il numero intero di stato per la prima frazione della lista che lo lascerà un numero intero.
For example, one of the Fractran programs that John Horton Conway wrote for prime-generation consists of the following 14 fractions:1791 , 7885 , 1951 , 2338 , 2933 , 7729 , 9523 , 7719 , 117 , 1113 , 1311 , 152 , 17 , 551 . Starting with the seed integer 2, successive iterations of the program produce the sequence: 15, 825, 725, 1925, 2275, 425, ..., 68, 4, 30, ..., 136, 8, 60, ..., 544, 32, 240, ...
Ad esempio, uno dei programmi Fractran che John Horton Conway ha scritto per la prima generazione consiste delle seguenti 14 frazioni:
The powers of 2 that appear in this sequence are 22, 23, 25, ... It can be shown that all the powers of 2 in this sequence have prime exponents and that all the primes appear as exponents of powers of 2, in proper order!
$$\frac{17}{91}, \frac{78}{85}, \frac{19}{51}, \frac{23}{38}, \frac{29}{33}, \frac{77}{29}, \frac{95}{23}, \frac{77}{19}, \frac{1}{17}, \frac{11}{13}, \frac{13}{11}, \frac{15}{2}, \frac{1}{7}, \frac{55}{1}$$
If someone uses the above Fractran program to solve Project Euler Problem 7 (find the 10001st prime), how many iterations would be needed until the program produces 210001st prime ?
Iniziando con il numero intero di seed 2, successive iterazioni del programma producono la sequenza:
$$15, 825, 725, 1925, 2275, 425, \ldots, 68, \mathbf{4}, 30, \ldots, 136, \mathbf{8}, 60, \ldots, 544, \mathbf{32}, 240, \ldots$$
Le potenze di 2 che appaiono in questa sequenza sono $2^2, 2^3, 2^5, \ldots$.
Si può mostrare che tutte le potenze di 2 in questa sequenza hanno esponenti che sono numeri primi e tutti i numeri primi appaiono come esponenti delle potenze di 2, nel giusto ordine!
Se qualcuno usa il programma Fractran qua sopra per risolvere il Problema Progetto Eulero 7 (trovare il ${10001}$ numero primo), quante iterazioni sarebbero necessarie affinché il programma produca $2^{10001^{\text{simo}}\text{ primo}}$?
# --hints--
`euler308()` should return 1539669807660924.
`primeGeneratingAutomation()` dovrebbe restituire `1539669807660924`.
```js
assert.strictEqual(euler308(), 1539669807660924);
assert.strictEqual(primeGeneratingAutomation(), 1539669807660924);
```
# --seed--
@ -31,12 +39,12 @@ assert.strictEqual(euler308(), 1539669807660924);
## --seed-contents--
```js
function euler308() {
function primeGeneratingAutomation() {
return true;
}
euler308();
primeGeneratingAutomation();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a11000cf542c50ffb4
title: 'Problem 309: Integer Ladders'
title: 'Problema 309: Scale Intere'
challengeType: 5
forumTopicId: 301963
dashedName: problem-309-integer-ladders
@ -8,20 +8,22 @@ dashedName: problem-309-integer-ladders
# --description--
In the classic "Crossing Ladders" problem, we are given the lengths x and y of two ladders resting on the opposite walls of a narrow, level street. We are also given the height h above the street where the two ladders cross and we are asked to find the width of the street (w).
Nel classico problema delle "scale incrociate", ci sono date le lunghezze $x$ e $y$ di due scale che poggiano sulle pareti opposte di una strada stretta e livellata. Ci viene anche data l'altezza $h$ sopra la strada dove le due scale si incrociano e ci viene chiesto di trovare la larghezza della strada ($w$).
Here, we are only concerned with instances where all four variables are positive integers. For example, if x = 70, y = 119 and h = 30, we can calculate that w = 56.
<img class="img-responsive center-block" alt="scale x e y, attraversando all'altezza h, e poggiando su pareti opposte della strada di larghezza w" src="https://cdn.freecodecamp.org/curriculum/project-euler/integer-ladders.gif" style="background-color: white; padding: 10px;" />
In fact, for integer values x, y, h and 0 &lt; x &lt; y &lt; 200, there are only five triplets (x,y,h) producing integer solutions for w: (70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) and (119, 175, 40).
Qui ci occupiamo solo di casi in cui tutte e quattro le variabili sono intere positive. Ad esempio, se $x = 70$, $y = 119$ e $h = 30$, possiamo calcolare che $w = 56$.
For integer values x, y, h and 0 &lt; x &lt; y &lt; 1 000 000, how many triplets (x,y,h) produce integer solutions for w?
Infatti, per valori interi $x$, $y$, $h$ e $0 &lt; x &lt; y &lt; 200$, ci sono solo cinque triplette ($x$, $y$, $h$) cje producono soluzioni intere per $w$: (70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) e (119, 175, 40).
Per valori interi $x$, $y$, $h$ e $0 &lt; x &lt; y &lt; 1\\,000\\,000$, quante triplette ($x$, $y$, $h$) producono soluzioni intere per $w$?
# --hints--
`euler309()` should return 210139.
`integerLadders()` dovrebbe restituire `210139`.
```js
assert.strictEqual(euler309(), 210139);
assert.strictEqual(integerLadders(), 210139);
```
# --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler309(), 210139);
## --seed-contents--
```js
function euler309() {
function integerLadders() {
return true;
}
euler309();
integerLadders();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a21000cf542c50ffb5
title: 'Problem 310: Nim Square'
title: 'Problema 310: Nim Quadrato'
challengeType: 5
forumTopicId: 301966
dashedName: problem-310-nim-square
@ -8,22 +8,22 @@ dashedName: problem-310-nim-square
# --description--
Alice and Bob play the game Nim Square.
Alice e Bob giocano al gioco Nim Quadrato.
Nim Square is just like ordinary three-heap normal play Nim, but the players may only remove a square number of stones from a heap.
Nim Quadrato è proprio come il normale gioco delle tre torri di Nim, ma i giocatori possono solo rimuovere un numero quadrato di pietre da una pila.
The number of stones in the three heaps is represented by the ordered triple (a,b,c).
Il numero di pietre nei tre cumuli è rappresentato dal triplo ordinato ($a$, $b$, $c$).
If 0≤a≤b≤c≤29 then the number of losing positions for the next player is 1160.
Se $0 ≤ a ≤ b ≤ c ≤ 29$ allora il numero di posizioni perdenti per il giocatore successivo è 1160.
Find the number of losing positions for the next player if 0≤a≤b≤c≤100 000.
Trova il numero di posizioni perdenti per il giocatore successivo se $0 ≤ a ≤ b ≤ c ≤ 100\\,000$.
# --hints--
`euler310()` should return 2586528661783.
`nimSquare()` dovrebbe restituire `2586528661783`.
```js
assert.strictEqual(euler310(), 2586528661783);
assert.strictEqual(nimSquare(), 2586528661783);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler310(), 2586528661783);
## --seed-contents--
```js
function euler310() {
function nimSquare() {
return true;
}
euler310();
nimSquare();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a31000cf542c50ffb6
title: 'Problem 311: Biclinic Integral Quadrilaterals'
title: 'Problem 311: quadrilateri interi biclinici'
challengeType: 5
forumTopicId: 301967
dashedName: problem-311-biclinic-integral-quadrilaterals
@ -8,24 +8,26 @@ dashedName: problem-311-biclinic-integral-quadrilaterals
# --description--
ABCD is a convex, integer sided quadrilateral with 1 ≤ AB &lt; BC &lt; CD &lt; AD.
$ABCD$ è un quadrilatero convesso con lati di lunghezza intera con $1 ≤ AB &lt; BC &lt; CD &lt; AD$.
BD has integer length. O is the midpoint of BD. AO has integer length.
$BD$ ha una lunghezza intera. $O$è il punto centrale di $BD$. $AO$ ha lunghezza intera.
We'll call ABCD a biclinic integral quadrilateral if AO = CO ≤ BO = DO.
Chiamiamo $ABCD$ un quadrilatero intero biclinico se $AO = CO ≤ BO = DO$.
For example, the following quadrilateral is a biclinic integral quadrilateral: AB = 19, BC = 29, CD = 37, AD = 43, BD = 48 and AO = CO = 23.
Per esempio, il seguente quadrilatero è un quadrilatero intero biclinico: $AB = 19$, $BC = 29$, $CD = 37$, $AD = 43$, $BD = 48$ e $AO = CO = 23$.
Let B(N) be the number of distinct biclinic integral quadrilaterals ABCD that satisfy AB2+BC2+CD2+AD2 ≤ N. We can verify that B(10 000) = 49 and B(1 000 000) = 38239.
<img class="img-responsive center-block" alt="quadrilatero ABCD, con il punto O, punto a metà di BD" src="https://cdn.freecodecamp.org/curriculum/project-euler/biclinic-integral-quadrilaterals.gif" style="background-color: white; padding: 10px;" />
Find B(10 000 000 000).
Sia $B(N)$ il numero di quadrilateri interi biclinici $ABCD$ distinti che soddisfano ${AB}^2 + {BC}^2 + {CD}^2 + {AD}^2 ≤ N$. Possiamo verificare che $B(10\\,000) = 49$ e che $B(1\\,000\\,000) = 38239$.
Trova $B(10\\,000\\,000\\,000)$.
# --hints--
`euler311()` should return 2466018557.
`biclinicIntegralQuadrilaterals()` dovrebbe restituire `2466018557`.
```js
assert.strictEqual(euler311(), 2466018557);
assert.strictEqual(biclinicIntegralQuadrilaterals(), 2466018557);
```
# --seed--
@ -33,12 +35,12 @@ assert.strictEqual(euler311(), 2466018557);
## --seed-contents--
```js
function euler311() {
function biclinicIntegralQuadrilaterals() {
return true;
}
euler311();
biclinicIntegralQuadrilaterals();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a51000cf542c50ffb7
title: 'Problem 312: Cyclic paths on Sierpiński graphs'
title: 'Problema 312: Percorsi ciclici sui grafi di Sierpiński'
challengeType: 5
forumTopicId: 301968
dashedName: problem-312-cyclic-paths-on-sierpiski-graphs
@ -8,22 +8,27 @@ dashedName: problem-312-cyclic-paths-on-sierpiski-graphs
# --description--
\- A Sierpiński graph of order-1 (S1) is an equilateral triangle.
- Un grafico di Sierpiński di ordine 1 ($S_1$) è un triangolo equilatero.
- $S_{n + 1}$ è ottenuto da $S_n$ posizionando tre copie di $S_n$ in modo che ogni coppia di copie abbia un angolo comune.
\- Sn+1 is obtained from Sn by positioning three copies of Sn so that every pair of copies has one common corner.
<img class="img-responsive center-block" alt="Grafi di Sierpinski dellordine da 1 a 5" src="https://cdn.freecodecamp.org/curriculum/project-euler/cyclic-paths-on-sierpinski-graphs-1.gif" style="background-color: white; padding: 10px;" />
Let C(n) be the number of cycles that pass exactly once through all the vertices of Sn. For example, C(3) = 8 because eight such cycles can be drawn on S3, as shown below:
Sia $C(n)$ il numero di cicli che passano esattamente una volta attraverso tutti i vertici di $S_n$. Ad esempio, $C(3) = 8$ perché otto di questi cicli possono essere disegnati su $S_3$, come mostrato di seguito:
It can also be verified that : C(1) = C(2) = 1 C(5) = 71328803586048 C(10 000) mod 108 = 37652224 C(10 000) mod 138 = 617720485
<img class="img-responsive center-block" alt="otto cicli che passano esattamente una volta attraverso tutti i vertici di S_3" src="https://cdn.freecodecamp.org/curriculum/project-euler/cyclic-paths-on-sierpinski-graphs-2.gif" style="background-color: white; padding: 10px;" />
Find C(C(C(10 000))) mod 138.
Si può anche verificare che:
$$\begin{align} & C(1) = C(2) = 1 \\\\ & C(5) = 71\\,328\\,803\\,586\\,048 \\\\ & C(10 000)\bmod {10}^8 = 37\\,652\\,224 \\\\ & C(10 000)\bmod {13}^8 = 617\\,720\\,485 \\\\ \end{align}$$
Trova $C(C(C(C(10\\,000)))\bmod {13}^8$.
# --hints--
`euler312()` should return 324681947.
`pathsOnSierpinskiGraphs()` dovrebbe restituire `324681947`.
```js
assert.strictEqual(euler312(), 324681947);
assert.strictEqual(pathsOnSierpinskiGraphs(), 324681947);
```
# --seed--
@ -31,12 +36,12 @@ assert.strictEqual(euler312(), 324681947);
## --seed-contents--
```js
function euler312() {
function pathsOnSierpinskiGraphs() {
return true;
}
euler312();
pathsOnSierpinskiGraphs();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a61000cf542c50ffb8
title: 'Problem 313: Sliding game'
title: 'Problema 313: Gioco scorrevole'
challengeType: 5
forumTopicId: 301969
dashedName: problem-313-sliding-game
@ -8,20 +8,24 @@ dashedName: problem-313-sliding-game
# --description--
In a sliding game a counter may slide horizontally or vertically into an empty space. The objective of the game is to move the red counter from the top left corner of a grid to the bottom right corner; the space always starts in the bottom right corner. For example, the following sequence of pictures show how the game can be completed in five moves on a 2 by 2 grid.
In un gioco scorrevole un contatore può scorrere orizzontalmente o verticalmente in uno spazio vuoto. L'obiettivo del gioco è quello di spostare il contatore rosso dall'angolo in alto a sinistra di una griglia all'angolo in basso a destra; lo spazio inizia sempre nell'angolo in basso a destra. Ad esempio, la seguente sequenza di immagini mostra come il gioco può essere completato in cinque mosse su una griglia 2 per 2.
Let S(m,n) represent the minimum number of moves to complete the game on an m by n grid. For example, it can be verified that S(5,4) = 25.
<img class="img-responsive center-block" alt="completamento della partita in cinque mosse sulla griglia 2x2" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliding-game-1.gif" style="background-color: white; padding: 10px;" />
There are exactly 5482 grids for which S(m,n) = p2, where p &lt; 100 is prime.
Sia $S(m, n)$ il numero minimo di mosse necessarie a completare il gioco su una griglia $m$ x $n$. Ad esempio, si può verificare che $S(5, 4) = 25$.
How many grids does S(m,n) = p2, where p &lt; 106 is prime?
<img class="img-responsive center-block" alt="stato iniziale della griglia e stato finale della griglia per il gioco sulla griglia 5x4" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliding-game-2.gif" style="background-color: white; padding: 10px;" />
Ci sono esattamente 5482 griglie per le quali $S(m, n) = p^2$, dove $p &lt; 100$ è primo.
Quante griglie danno $S(m, n) = p^2$, dove $p &lt; {10}^6$ è primo?
# --hints--
`euler313()` should return 2057774861813004.
`slidingGame()` dovrebbe restituire `2057774861813004`.
```js
assert.strictEqual(euler313(), 2057774861813004);
assert.strictEqual(slidingGame(), 2057774861813004);
```
# --seed--
@ -29,12 +33,12 @@ assert.strictEqual(euler313(), 2057774861813004);
## --seed-contents--
```js
function euler313() {
function slidingGame() {
return true;
}
euler313();
slidingGame();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a71000cf542c50ffb9
title: 'Problem 314: The Mouse on the Moon'
title: 'Problema 314: Il topo sulla Luna'
challengeType: 5
forumTopicId: 301970
dashedName: problem-314-the-mouse-on-the-moon
@ -8,22 +8,26 @@ dashedName: problem-314-the-mouse-on-the-moon
# --description--
The moon has been opened up, and land can be obtained for free, but there is a catch. You have to build a wall around the land that you stake out, and building a wall on the moon is expensive. Every country has been allotted a 500 m by 500 m square area, but they will possess only that area which they wall in. 251001 posts have been placed in a rectangular grid with 1 meter spacing. The wall must be a closed series of straight lines, each line running from post to post.
La luna è stata aperta e il terreno può essere ottenuto gratuitamente, ma c'è un problema. È necessario costruire un muro intorno al terreno che vuoi delimitare, e costruire un muro sulla luna è costoso. Ad ogni Paese è stata assegnata una superficie quadrata di 500 m per 500 m, ma disporrà solo della zona delimitata dal muro. 251001 paletti sono stati collocati in una griglia rettangolare con una spaziatura di 1 metro. La parete deve essere una serie chiusa di linee rette, ogni linea che corre da paletto a paletto.
The bigger countries of course have built a 2000 m wall enclosing the entire 250 000 m2 area. The Duchy of Grand Fenwick, has a tighter budget, and has asked you (their Royal Programmer) to compute what shape would get best maximum enclosed-area/wall-length ratio.
I paesi più grandi hanno ovviamente costruito un muro di 2000 m che racchiude l'intera area di 250 000 $\text{m}^2$. Il Ducato di Grand Fenwick, ha un budget più ristretto, e ti ha chiesto (in quanto loro Programmatore Reale) di calcolare quale forma otterrebbe il massimo rapporto $\frac{\text{area-racchiusa}}{\text{lunghezza-muro}}$.
You have done some preliminary calculations on a sheet of paper. For a 2000 meter wall enclosing the 250 000 m2 area the enclosed-area/wall-length ratio is 125. Although not allowed , but to get an idea if this is anything better: if you place a circle inside the square area touching the four sides the area will be equal to π*2502 m2 and the perimeter will be π*500 m, so the enclosed-area/wall-length ratio will also be 125.
Hai fatto alcuni calcoli preliminari su un foglio di carta. Per un muro di 2000 metri che racchiude l'area di 250 000 $\text{m}^2$ il rapporto $\frac{\text{area-racchiusa}}{\text{lunghezza-muro}}$ è 125.
However, if you cut off from the square four triangles with sides 75 m, 75 m and 75√2 m the total area becomes 238750 m2 and the perimeter becomes 1400+300√2 m. So this gives an enclosed-area/wall-length ratio of 130.87, which is significantly better.
Anche se non è consentito, ma per avere un'idea se questo è qualcosa di meglio: se piazzi un cerchio all'interno dell'area quadrata che tocca i quattro lati l'area sarà uguale a $π \times {250}^2 \text{m}^2$ e il perimetro sarà $π \times 500 \text{m}$, per cui il rapporto $\frac{\text{area-racchiusa}}{\text{lunghezza-muro}}$ sarà comunque 125.
Find the maximum enclosed-area/wall-length ratio. Give your answer rounded to 8 places behind the decimal point in the form abc.defghijk.
Tuttavia, se si tagliano dal quadrato quattro triangoli con lati 75 m, 75 m e $75\sqrt{2}$ m l'area totale diventa 238750 $\text{m}^2$ e il perimetro diventa $1400 + 300\sqrt{2}$ m. Quindi questo dà un rapporto $\frac{\text{enclosed-area}}{\text{wall-length}}$ di 130.87, che è significativamente migliore.
<img class="img-responsive center-block" alt="immagine che mostra la differenza nell'area racchiusa tra cerchio e quadrato con il taglio di quattro triangoli" src="https://cdn.freecodecamp.org/curriculum/project-euler/the-mouse-on-the-moon.gif" style="background-color: white; padding: 10px;" />
Trova il massimo rapporto $\frac{\text{area-racchiusa}}{\text{lunghezza-muro}}$. Dai la tua risposta arrotondata a 8 posti dopo il punto decimale nella forma abc.defghijk.
# --hints--
`euler314()` should return 132.52756426.
`theMouseOnTheMoon()` dovrebbe restituire `132.52756426`.
```js
assert.strictEqual(euler314(), 132.52756426);
assert.strictEqual(theMouseOnTheMoon(), 132.52756426);
```
# --seed--
@ -31,12 +35,12 @@ assert.strictEqual(euler314(), 132.52756426);
## --seed-contents--
```js
function euler314() {
function theMouseOnTheMoon() {
return true;
}
euler314();
theMouseOnTheMoon();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a71000cf542c50ffba
title: 'Problem 315: Digital root clocks'
title: 'Problema 315: orologi a radici digitali'
challengeType: 5
forumTopicId: 301971
dashedName: problem-315-digital-root-clocks
@ -8,34 +8,48 @@ dashedName: problem-315-digital-root-clocks
# --description--
Sam and Max are asked to transform two digital clocks into two "digital root" clocks.
<img class="img-responsive center-block" alt="animazione degli orologi di Sam e Max che calcolano le radici digitali a partire da 137" src="https://cdn.freecodecamp.org/curriculum/project-euler/digital-root-clocks.gif" style="background-color: white; padding: 10px;" />
A digital root clock is a digital clock that calculates digital roots step by step.
Sam e Max sono incaricati di trasformare due orologi digitali in due orologi "radici digitali".
When a clock is fed a number, it will show it and then it will start the calculation, showing all the intermediate values until it gets to the result. For example, if the clock is fed the number 137, it will show: "137" → "11" → "2" and then it will go black, waiting for the next number.
Un orologio a radici digitali è un orologio digitale che calcola le radici digitali passo passo.
Every digital number consists of some light segments: three horizontal (top, middle, bottom) and four vertical (top-left, top-right, bottom-left, bottom-right). Number "1" is made of vertical top-right and bottom-right, number "4" is made by middle horizontal and vertical top-left, top-right and bottom-right. Number "8" lights them all.
Quando a un orologio viene dato un numero, lo mostra e poi inizia il calcolo, mostrando tutti i valori intermedi fino a che non arriva al risultato. Per esempio, se l'orologio riceve il numero 137, mostrerà: `137``11``2` e poi tornerà nero, aspettando il prossimo numero.
The clocks consume energy only when segments are turned on/off. To turn on a "2" will cost 5 transitions, while a "7" will cost only 4 transitions.
Ogni numero digitale è costituito da alcuni segmenti luminosi: tre orizzontali (alto, centrale, inferiore) e quattro verticali (alto-sinistra, in alto-destra, in basso-sinistra, in basso-destra). Il numero `1` è fatto dalla linea verticale in alto a destra e dalla linea verticale in basso a destra; il numero `4` è fatto dalla riga orizzontale in mezzo, dalla riga verticale in alto a sinistra, dalla riga verticale in alto a destra e dalla riga verticale in basso a destra. Il numero `8` illumina tutti i trattini.
Sam and Max built two different clocks.
L'orologio consuma energia solo quando i segmenti vengono accesi o spenti. Accendere un `2` costa 5 transizioni, mentre accendere un `7` ne costa solo 4.
Sam's clock is fed e.g. number 137: the clock shows "137", then the panel is turned off, then the next number ("11") is turned on, then the panel is turned off again and finally the last number ("2") is turned on and, after some time, off. For the example, with number 137, Sam's clock requires:"137" : (2 + 5 + 4) × 2 = 22 transitions ("137" on/off). "11" : (2 + 2) × 2 = 8 transitions ("11" on/off). "2" : (5) × 2 = 10 transitions ("2" on/off).
Sam e Max hanno costruito due orologi diversi.
For a grand total of 40 transitions.
Quando l'orologio di Sam riceve un numero, ad esempio il numero 137: l'orologio mostra `137`, poi lo schermo si spegne, poi il numero seguente si accende (`11`), poi lo schermo si spegne di nuovo e infine è mostrato l'ultimo numero (`2`) e infine lo schermo torna nero dopo un certo tempo.
Max's clock works differently. Instead of turning off the whole panel, it is smart enough to turn off only those segments that won't be needed for the next number. For number 137, Max's clock requires:"137" : 2 + 5 + 4 = 11 transitions ("137" on) 7 transitions (to turn off the segments that are not needed for number "11"). "11" : 0 transitions (number "11" is already turned on correctly) 3 transitions (to turn off the first "1" and the bottom part of the second "1"; the top part is common with number "2"). "2" : 4 transitions (to turn on the remaining segments in order to get a "2") 5 transitions (to turn off number "2").
Per esempio, con il numero 137, l'orologio di Sam richiede:
For a grand total of 30 transitions.
- `137`: $(2 + 5 + 4) × 2 = 22$ transizioni (`137` on/off).
- `11`: $(2 + 2) × 2 = 8$ transizioni (`11` on/off).
- `2`: $(5) × 2 = 10 $ transizioni (`2` on/off).
Of course, Max's clock consumes less power than Sam's one. The two clocks are fed all the prime numbers between A = 107 and B = 2×107. Find the difference between the total number of transitions needed by Sam's clock and that needed by Max's one.
Per un totale di 40 transizioni.
L'orologio di Max funziona in modo diverso. Invece di spegnere l'intero pannello, è abbastanza intelligente da spegnere solo quei segmenti che non saranno necessari per il numero successivo.
Per il numero 137, l'orologio di Max richiede:
- `137` : $2 + 5 + 4 = 11$ transizioni (`137` su), $7$ transizioni (per disattivare i segmenti che non sono necessari per il numero `11`).
- `11` : $0$ transizioni (il numero `11` è già acceso correttamente), $3$ transizioni (per disattivare il primo `1` e la parte inferiore del secondo `1`; la parte superiore è comune con il numero `2`).
- `2` : $4$ transizioni (per attivare i segmenti rimanenti al fine di ottenere un `2`), $5$ transizioni (per disattivare il numero `2`).
Per un totale di 30 transizioni.
Naturalmente, l'orologio di Max consuma meno energia di quello di Sam. Ai due orologi vengono dati tutti i numeri primi tra $A = {10}^7$ e $B = 2 × {10}^7$. Trova la differenza tra il numero totale di transizioni necessarie per l'orologio di Sam e quello di Max.
# --hints--
`euler315()` should return 13625242.
`digitalRootClocks()` dovrebbe restituire `13625242`.
```js
assert.strictEqual(euler315(), 13625242);
assert.strictEqual(digitalRootClocks(), 13625242);
```
# --seed--
@ -43,12 +57,12 @@ assert.strictEqual(euler315(), 13625242);
## --seed-contents--
```js
function euler315() {
function digitalRootClocks() {
return true;
}
euler315();
digitalRootClocks();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4a81000cf542c50ffbb
title: 'Problem 316: Numbers in decimal expansions'
title: 'Problema 316: numeri in una espansione decimale'
challengeType: 5
forumTopicId: 301972
dashedName: problem-316-numbers-in-decimal-expansions
@ -8,26 +8,34 @@ dashedName: problem-316-numbers-in-decimal-expansions
# --description--
Let p = p1 p2 p3 ... be an infinite sequence of random digits, selected from {0,1,2,3,4,5,6,7,8,9} with equal probability.
Sia $p = p_1 p_2 p_3 \ldots$ una sequenza infinita di cifre random, selezionate da {0,1,2,3,4,5,6,7,8,9} con probabilità uguali.
It can be seen that p corresponds to the real number 0.p1 p2 p3 ....
Si può vedere che $p$ corrisponde al numero reale $0.p_1 p_2 p_3 \ldots$.
It can also be seen that choosing a random real number from the interval \[0,1) is equivalent to choosing an infinite sequence of random digits selected from {0,1,2,3,4,5,6,7,8,9} with equal probability.
Si può anche vedere che la scelta di un numero reale casuale dall'intervallo [0,1) equivale a scegliere una sequenza infinita di cifre casuali selezionate da {0,1,2,3,4,5,6,7,8,9} con pari probabilità.
For any positive integer n with d decimal digits, let k be the smallest index such that pk, pk+1, ...pk+d-1 are the decimal digits of n, in the same order. Also, let g(n) be the expected value of k; it can be proven that g(n) is always finite and, interestingly, always an integer number.
Per ogni numero intero positivo $n$ con $d$ cifre decimali, sia $k$ l'indice più piccolo tale che $p_k, p_{k + 1}, \ldots p_{k + d - 1}$ sono le cifre decimali di $n$, nello stesso ordine.
For example, if n = 535, then for p = 31415926535897...., we get k = 9 for p = 355287143650049560000490848764084685354..., we get k = 36 etc and we find that g(535) = 1008.
Inoltre, sia $g(n)$ il valore atteso di $k$; si può dimostrare che $g(n)$ è sempre finito e, interessante, sempre un numero intero.
Given that , find
Per esempio, se $n = 535$, allora
Note: represents the floor function.
per $p = 31415926\mathbf{535}897\ldots$, otteniamo $k = 9$
per $p = 35528714365004956000049084876408468\mathbf{535}4\ldots$, otteniamo $k = 36$
ecc e troviamo che $g(535) = 1008$.
Dato che $\displaystyle\sum_{n = 2}^{999} g\left(\left\lfloor\frac{{10}^6}{n}\right\rfloor\right) = 27280188$, trova $\displaystyle\sum_{n = 2}^{999\\,999} g\left(\left\lfloor\frac{{10}^{16}}{n}\right\rfloor\right)$.
**Nota:** $\lfloor x\rfloor$ rappresenta la funzione arrotonda verso il basso.
# --hints--
`euler316()` should return 542934735751917760.
`numbersInDecimalExpansion()` dovrebbe restituire `542934735751917760`.
```js
assert.strictEqual(euler316(), 542934735751917760);
assert.strictEqual(numbersInDecimalExpansion(), 542934735751917760);
```
# --seed--
@ -35,12 +43,12 @@ assert.strictEqual(euler316(), 542934735751917760);
## --seed-contents--
```js
function euler316() {
function numbersInDecimalExpansion() {
return true;
}
euler316();
numbersInDecimalExpansion();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4aa1000cf542c50ffbc
title: 'Problem 317: Firecracker'
title: 'Problema 317: Petardo'
challengeType: 5
forumTopicId: 301973
dashedName: problem-317-firecracker
@ -8,18 +8,18 @@ dashedName: problem-317-firecracker
# --description--
A firecracker explodes at a height of 100 m above level ground. It breaks into a large number of very small fragments, which move in every direction; all of them have the same initial velocity of 20 m/s.
Un petardo esplode a un'altezza di 100 m dal livello del suolo. Si rompe in un gran numero di frammenti molto piccoli, che si muovono in ogni direzione; tutti hanno la stessa velocità iniziale di 20 $\frac{\text{m}}{\text{s}}$.
We assume that the fragments move without air resistance, in a uniform gravitational field with g=9.81 m/s2.
Supponiamo che i frammenti si muovano senza resistenza all'aria, in un campo gravitazionale uniforme con $g=9.81 \frac{\text{m}}{\text{s}^2}$.
Find the volume (in m3) of the region through which the fragments move before reaching the ground. Give your answer rounded to four decimal places.
Trova il volume (in $\text{m}^3$) della regione attraverso la quale i frammenti si muovono prima di raggiungere il suolo. Dai la risposta arrotondata a quattro decimali.
# --hints--
`euler317()` should return 1856532.8455.
`firecracker()` dovrebbe restituire `1856532.8455`.
```js
assert.strictEqual(euler317(), 1856532.8455);
assert.strictEqual(firecracker(), 1856532.8455);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler317(), 1856532.8455);
## --seed-contents--
```js
function euler317() {
function firecracker() {
return true;
}
euler317();
firecracker();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4ab1000cf542c50ffbd
title: 'Problem 318: 2011 nines'
title: 'Problema 318: 2011 nove'
challengeType: 5
forumTopicId: 301974
dashedName: problem-318-2011-nines
@ -8,44 +8,28 @@ dashedName: problem-318-2011-nines
# --description--
Consider the real number √2+√3.
Considera il numero reale $\sqrt{2} + \sqrt{3}$.
When we calculate the even powers of √2+√3
Quando calcoliamo le potenze pari di $\sqrt{2} + \sqrt{3}$ troviamo:
we get:
$$\begin{align} & {(\sqrt{2} + \sqrt{3})}^2 = 9.898979485566356\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^4 = 97.98979485566356\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^6 = 969.998969071069263\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^8 = 9601.99989585502907\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^{10} = 95049.999989479221\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^{12} = 940897.9999989371855\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^{14} = 9313929.99999989263\ldots \\\\ & {(\sqrt{2} + \sqrt{3})}^{16} = 92198401.99999998915\ldots \\\\ \end{align}$$
(√2+√3)2 = 9.898979485566356...
Sembra che il numero di nove consecutivi all'inizio della parte frazionaria di queste potenze non diminuisca. In realtà si può dimostrare che la parte frazionaria di ${(\sqrt{2} + \sqrt{3})}^{2n}$ si avvicina 1 per $n$ di grandi dimensioni.
(√2+√3)4 = 97.98979485566356...
Considera tutti i numeri reali del modulo $\sqrt{p} + \sqrt{q}$ con $p$ e $q$ interi positivi e $p &lt; q$, tali che la parte frazionaria di ${(\sqrt{p} + \sqrt{q})}^{2n}$ si avvicina 1 per $n$ di grandi dimensioni.
(√2+√3)6 = 969.998969071069263...
Sia $C(p,q,n)$ il numero di nove consecutivi all'inizio della parte frazionaria di ${(\sqrt{p} + \sqrt{q})}^{2n}$.
(√2+√3)8 = 9601.99989585502907...
Sia $N(p,q)$ il valore minimo di $n$ tale che $C(p,q,n) ≥ 2011$.
(√2+√3)10 = 95049.999989479221...
(√2+√3)12 = 940897.9999989371855...
(√2+√3)14 = 9313929.99999989263...
(√2+√3)16 = 92198401.99999998915...
It looks like that the number of consecutive nines at the beginning of the fractional part of these powers is non-decreasing. In fact it can be proven that the fractional part of (√2+√3)2n approaches 1 for large n.
Consider all real numbers of the form √p+√q with p and q positive integers and p&lt;q, such that the fractional part of (√p+√q)2n approaches 1 for large n.
Let C(p,q,n) be the number of consecutive nines at the beginning of the fractional part of (√p+√q)2n.
Let N(p,q) be the minimal value of n such that C(p,q,n) ≥ 2011.
Find ∑N(p,q) for p+q ≤ 2011.
Trova $\sum N(p,q)$ per $p + q ≤ 2011$.
# --hints--
`euler318()` should return 709313889.
`twoThousandElevenNines()` dovrebbe restituire `709313889`.
```js
assert.strictEqual(euler318(), 709313889);
assert.strictEqual(twoThousandElevenNines(), 709313889);
```
# --seed--
@ -53,12 +37,12 @@ assert.strictEqual(euler318(), 709313889);
## --seed-contents--
```js
function euler318() {
function twoThousandElevenNines() {
return true;
}
euler318();
twoThousandElevenNines();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4ab1000cf542c50ffbe
title: 'Problem 319: Bounded Sequences'
title: 'Problema 319: Sequenze limitate'
challengeType: 5
forumTopicId: 301975
dashedName: problem-319-bounded-sequences
@ -8,26 +8,24 @@ dashedName: problem-319-bounded-sequences
# --description--
Let x1, x2,..., xn be a sequence of length n such that:
Sia $x_1, x_2, \ldots, x_n$ una sequenza di lunghezza $n$ tale che:
x1 = 2
- $x_1 = 2$
- per ogni $1 &lt; i ≤ n : x_{i - 1} &lt; x_i$
- per ogni $i$ e $j$ con $1 ≤ i, j ≤ n : {(x_i)}^j &lt; {(x_j + 1)}^i$
for all 1 &lt; i ≤ n : xi-1 &lt; xi
Ci sono solo cinque di tali sequenze di lunghezza 2: {2,4}, {2,5}, {2,6}, {2,7} e {2,8}. Ci sono 293 sequenze di questo tipo di lunghezza 5; tre esempi sono: {2,5,11,25,55}, {2,6,14,36,88}, {2,8,22,64,181}.
for all i and j with 1 ≤ i, j ≤ n : (xi) j &lt; (xj + 1)i
Sia $t(n)$ il numero di tali sequenze di lunghezza $n$. Ti viene dato $t(10) = 86195$ e $t(20) = 5227991891$.
There are only five such sequences of length 2, namely: {2,4}, {2,5}, {2,6}, {2,7} and {2,8}. There are 293 such sequences of length 5; three examples are given below: {2,5,11,25,55}, {2,6,14,36,88}, {2,8,22,64,181}.
Let t(n) denote the number of such sequences of length n. You are given that t(10) = 86195 and t(20) = 5227991891.
Find t(1010) and give your answer modulo 109.
Trova $t({10}^{10})$ e dai la tua risposta modulo $10^9$.
# --hints--
`euler319()` should return 268457129.
`boundedSequences()` dovrebbe restituire `268457129`.
```js
assert.strictEqual(euler319(), 268457129);
assert.strictEqual(boundedSequences(), 268457129);
```
# --seed--
@ -35,12 +33,12 @@ assert.strictEqual(euler319(), 268457129);
## --seed-contents--
```js
function euler319() {
function boundedSequences() {
return true;
}
euler319();
boundedSequences();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4ae1000cf542c50ffbf
title: 'Problem 320: Factorials divisible by a huge integer'
title: 'Problema 320: Fattoriali divisibili da un numero intero enorme'
challengeType: 5
forumTopicId: 301977
dashedName: problem-320-factorials-divisible-by-a-huge-integer
@ -8,20 +8,20 @@ dashedName: problem-320-factorials-divisible-by-a-huge-integer
# --description--
Let N(i) be the smallest integer n such that n! is divisible by (i!)1234567890
Sia $N(i)$ sia il più piccolo numero intero $n$ tale che $n!$ sia divisibile per $(i!)^{1234567890}$
Let S(u)=∑N(i) for 10 ≤ i ≤ u.
Sia $S(u) = \sum N(i)$ per $10 ≤ i ≤ u$.
S(1000)=614538266565663.
$S(1000)=614\\,538\\,266\\,565\\,663$.
Find S(1 000 000) mod 1018.
Trova $S(1\\,000\\,000)\bmod {10}^{18}$.
# --hints--
`euler320()` should return 278157919195482660.
`divisibleByHugeInteger()` dovrebbe restituire `278157919195482660`.
```js
assert.strictEqual(euler320(), 278157919195482660);
assert.strictEqual(divisibleByHugeInteger(), 278157919195482660);
```
# --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler320(), 278157919195482660);
## --seed-contents--
```js
function euler320() {
function divisibleByHugeInteger() {
return true;
}
euler320();
divisibleByHugeInteger();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4ae1000cf542c50ffc0
title: 'Problem 321: Swapping Counters'
title: 'Problema 321: Contatori Di Scambio'
challengeType: 5
forumTopicId: 301978
dashedName: problem-321-swapping-counters
@ -8,22 +8,28 @@ dashedName: problem-321-swapping-counters
# --description--
A horizontal row comprising of 2n + 1 squares has n red counters placed at one end and n blue counters at the other end, being separated by a single empty square in the centre. For example, when n = 3.
Una riga orizzontale composta da $2n + 1$ quadrati ha $n$ contatori rossi posizionati ad un'estremità e $n$ contatori blu all'altra estremità, che sono separati da un unico quadrato vuoto nel centro. Per esempio, quando $n = 3$.
A counter can move from one square to the next (slide) or can jump over another counter (hop) as long as the square next to that counter is unoccupied.
<img class="img-responsive center-block" alt="tre quadrati con contatori rossi e blu posti sulle estremità opposte della fila, separati da un quadrato vuoto" src="https://cdn.freecodecamp.org/curriculum/project-euler/swapping-counters-1.gif" style="background-color: white; padding: 10px;" />
Let M(n) represent the minimum number of moves/actions to completely reverse the positions of the coloured counters; that is, move all the red counters to the right and all the blue counters to the left. It can be verified M(3) = 15, which also happens to be a triangle number.
Un contatore può spostarsi da un quadrato al successivo (slide) o può saltare sopra un altro contatore (hop) finché il quadrato accanto a quel contatore non è occupato.
If we create a sequence based on the values of n for which M(n) is a triangle number then the first five terms would be: 1, 3, 10, 22, and 63, and their sum would be 99.
<img class="img-responsive center-block" alt="mosse consentite del contatore" src="https://cdn.freecodecamp.org/curriculum/project-euler/swapping-counters-2.gif" style="background-color: white; padding: 10px;" />
Find the sum of the first forty terms of this sequence.
Sia $M(n)$ il numero minimo di mosse/azioni per invertire completamente le posizioni dei contatori colorati; cioè, spostare tutti i contatori rossi a destra e tutti i contatori blu a sinistra.
Si può verificare che $M(3) = 15$, che tra l'altro è un numero triangolare.
Se creiamo una sequenza basata sui valori di n per cui $M(n)$ è un numero triangolare, i primi cinque termini sarebbero: 1, 3, 10, 22, e 63, e la loro somma sarebbe 99.
Trova la somma dei primi quaranta termini di questa sequenza.
# --hints--
`euler321()` should return 2470433131948040.
`swappingCounters()` dovrebbe restituire `2470433131948040`.
```js
assert.strictEqual(euler321(), 2470433131948040);
assert.strictEqual(swappingCounters(), 2470433131948040);
```
# --seed--
@ -31,12 +37,12 @@ assert.strictEqual(euler321(), 2470433131948040);
## --seed-contents--
```js
function euler321() {
function swappingCounters() {
return true;
}
euler321();
swappingCounters();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4af1000cf542c50ffc1
title: 'Problem 322: Binomial coefficients divisible by 10'
title: 'Problema 322: Coefficienti binomiali divisibili per 10'
challengeType: 5
forumTopicId: 301979
dashedName: problem-322-binomial-coefficients-divisible-by-10
@ -8,18 +8,18 @@ dashedName: problem-322-binomial-coefficients-divisible-by-10
# --description--
Let T(m, n) be the number of the binomial coefficients iCn that are divisible by 10 for n ≤ i &lt; m(i, m and n are positive integers).
Sia $T(m, n)$ il numero dei coefficienti binomiali ${}^iC_n$ che sono divisibili per 10 per $n ≤ i &lt; m$ ($i$, $m$ e $n$ sono interi positivi).
You are given that T(109, 107-10) = 989697000.
Ti viene dato che $T({10}^9, {10}^7 - 10) = 989\\,697\\,000$.
Find T(1018, 1012-10).
Trova $T({10}^{18}, {10}^{12} - 10)$.
# --hints--
`euler322()` should return 999998760323314000.
`binomialCoefficientsDivisibleBy10()` dovrebbe restituire `999998760323314000`.
```js
assert.strictEqual(euler322(), 999998760323314000);
assert.strictEqual(binomialCoefficientsDivisibleBy10(), 999998760323314000);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler322(), 999998760323314000);
## --seed-contents--
```js
function euler322() {
function binomialCoefficientsDivisibleBy10() {
return true;
}
euler322();
binomialCoefficientsDivisibleBy10();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4b01000cf542c50ffc2
title: 'Problem 323: Bitwise-OR operations on random integers'
title: 'Problema 323: Operazioni sui bit di interi casuali'
challengeType: 5
forumTopicId: 301980
dashedName: problem-323-bitwise-or-operations-on-random-integers
@ -8,24 +8,25 @@ dashedName: problem-323-bitwise-or-operations-on-random-integers
# --description--
Let y0, y1, y2,... be a sequence of random unsigned 32 bit integers
Sia $y_0, y_1, y_2, \ldots$ una sequenza di numeri interi casuali a 32 bit senza segno
(i.e. 0 ≤ yi &lt; 232, every value equally likely).
(cioè $0 ≤ y_i &lt; 2^{32}$, con ogni valore ugualmente probabile).
For the sequence xi the following recursion is given:x0 = 0 and
Per la sequenza $x_i$ viene fornita la seguente ricorsione:
xi = xi-1| yi-1, for i > 0. ( | is the bitwise-OR operator)
- $x_0 = 0$ e
- $x_i = x_{i - 1} \mathbf{|} y_{i - 1}$, per $i > 0$. ($\mathbf{|}$ è l'operatore bitwise-OR)
It can be seen that eventually there will be an index N such that xi = 232 -1 (a bit-pattern of all ones) for all i ≥ N.
Si può vedere che alla fine ci sarà un indice $N$ tale che $x_i = 2^{32} - 1$ (un bit-pattern di solo uno) per tutti $i ≥ N$.
Find the expected value of N. Give your answer rounded to 10 digits after the decimal point.
Trova il valore atteso di $N$. Dare la risposta arrotondata a 10 cifre dopo il punto decimale.
# --hints--
`euler323()` should return 6.3551758451.
`bitwiseOrOnRandomIntegers()` dovrebbe restituire `6.3551758451`.
```js
assert.strictEqual(euler323(), 6.3551758451);
assert.strictEqual(bitwiseOrOnRandomIntegers(), 6.3551758451);
```
# --seed--
@ -33,12 +34,12 @@ assert.strictEqual(euler323(), 6.3551758451);
## --seed-contents--
```js
function euler323() {
function bitwiseOrOnRandomIntegers() {
return true;
}
euler323();
bitwiseOrOnRandomIntegers();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4b11000cf542c50ffc3
title: 'Problem 324: Building a tower'
title: 'Problema 324: Costruire una torre'
challengeType: 5
forumTopicId: 301981
dashedName: problem-324-building-a-tower
@ -8,18 +8,20 @@ dashedName: problem-324-building-a-tower
# --description--
Let f(n) represent the number of ways one can fill a 3×3×n tower with blocks of 2×1×1. You're allowed to rotate the blocks in any way you like; however, rotations, reflections etc of the tower itself are counted as distinct.
Sia $f(n)$ il numero di modi in cui si può riempire una torre $3×3×n$ con blocchi $2×1×1$. Hai il permesso di ruotare i blocchi in qualsiasi modo; tuttavia le rotazioni, le riflessioni ecc della torre stessa sono contati come distinti.
For example (with q = 100000007) :f(2) = 229,f(4) = 117805,f(10) mod q = 96149360,f(103) mod q = 24806056,f(106) mod q = 30808124.
Per esempio (con $q = 100\\,000\\,007$):
Find f(1010000) mod 100000007.
$$\begin{align} & f(2) = 229, \\\\ & f(4) = 117\\,805, \\\\ & f(10)\bmod q = 96\\,149\\,360, \\\\ & f({10}^3)\bmod q = 24\\,806\\,056, \\\\ & f({10}^6)\bmod q = 30\\,808\\,124. \end{align}$$
Trova $f({10}^{10000})\bmod 100\\,000\\,007$.
# --hints--
`euler324()` should return 96972774.
`buildingTower()` dovrebbe restituire `96972774`.
```js
assert.strictEqual(euler324(), 96972774);
assert.strictEqual(buildingTower(), 96972774);
```
# --seed--
@ -27,12 +29,12 @@ assert.strictEqual(euler324(), 96972774);
## --seed-contents--
```js
function euler324() {
function buildingTower() {
return true;
}
euler324();
buildingTower();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4b11000cf542c50ffc4
title: 'Problem 325: Stone Game II'
title: 'Problema 325: Gioco delle pietre II'
challengeType: 5
forumTopicId: 301982
dashedName: problem-325-stone-game-ii
@ -8,26 +8,26 @@ dashedName: problem-325-stone-game-ii
# --description--
A game is played with two piles of stones and two players. At her turn, a player removes a number of stones from the larger pile. The number of stones she removes must be a positive multiple of the number of stones in the smaller pile.
Un gioco si gioca con due mucchi di pietre e due giocatori. Al turno di ogni giocatore, il giocatore può rimuovere un certo numero di pietre dal mucchio più grande. Il numero di pietre che rimuove deve essere un multiplo positivo del numero di pietre nel mucchio più piccolo.
E.g., let the ordered pair(6,14) describe a configuration with 6 stones in the smaller pile and 14 stones in the larger pile, then the first player can remove 6 or 12 stones from the larger pile.
Ad esempio, la coppia ordinata (6,14) descrive una configurazione con 6 pietre nel mucchio più piccolo e 14 pietre nel mucchio più grande, quindi il primo giocatore può rimuovere 6 o 12 pietre dal mucchio più grande.
The player taking all the stones from a pile wins the game.
Il giocatore che prende tutte le pietre da un mucchio vince la partita.
A winning configuration is one where the first player can force a win. For example, (1,5), (2,6) and (3,12) are winning configurations because the first player can immediately remove all stones in the second pile.
Una configurazione vincente è quella in cui il primo giocatore può forzare una vittoria. Ad esempio, (1,5), (2,6) e (3,12) sono configurazioni vincenti perché il primo giocatore può rimuovere immediatamente tutte le pietre nel secondo mucchio.
A losing configuration is one where the second player can force a win, no matter what the first player does. For example, (2,3) and (3,4) are losing configurations: any legal move leaves a winning configuration for the second player.
Una configurazione perdente è quella in cui il secondo giocatore può forzare una vittoria, indipendentemente da ciò che fa il primo giocatore. Ad esempio, (2,3) e (3,4) sono configurazioni perdenti: qualsiasi mossa lecita lascia una configurazione vincente per il secondo giocatore.
Define S(N) as the sum of (xi+yi) for all losing configurations (xi,yi), 0 &lt; xi &lt; yi ≤ N. We can verify that S(10) = 211 and S(104) = 230312207313.
Definiamo $S(N)$ come somma di ($x_i + y_i$) per tutte le configurazioni perdenti ($x_i$, $y_i$), $0 &lt; x_i &lt; y_i ≤ N$. Possiamo verificare che $S(10) = 211$ e $S({10}^4) = 230\\,312\\,207\\,313$.
Find S(1016) mod 710.
Trova $S({10}^{16})\bmod 7^{10}$.
# --hints--
`euler325()` should return 54672965.
`stoneGameTwo()` dovrebbe restituire `54672965`.
```js
assert.strictEqual(euler325(), 54672965);
assert.strictEqual(stoneGameTwo(), 54672965);
```
# --seed--
@ -35,12 +35,12 @@ assert.strictEqual(euler325(), 54672965);
## --seed-contents--
```js
function euler325() {
function stoneGameTwo() {
return true;
}
euler325();
stoneGameTwo();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4b21000cf542c50ffc5
title: 'Problem 326: Modulo Summations'
title: 'Problema 326: sommatoria dei moduli'
challengeType: 5
forumTopicId: 301983
dashedName: problem-326-modulo-summations
@ -8,24 +8,26 @@ dashedName: problem-326-modulo-summations
# --description--
Let an be a sequence recursively defined by: .
Sia $a_n$ una sequenza definita ricorsivamente da: $a_1 = 1$, $\displaystyle a_n = \left(\sum_{k = 1}^{n - 1} k \times a_k\right)\bmod n$.
So the first 10 elements of an are: 1,1,0,3,0,3,5,4,1,9.
Quindi i primi 10 elementi di $a_n$ sono: 1, 1, 0, 3, 0, 3, 5, 4, 1, 9.
Let f(N,M) represent the number of pairs (p,q) such that:
Lascia che $f(N, M)$ rappresenti il numero di coppie $(p, q)$ tali che:
It can be seen that f(10,10)=4 with the pairs (3,3), (5,5), (7,9) and (9,10).
$$ 1 \le p \le q \le N \\; \text{and} \\; \left(\sum_{i = p}^q a_i\right)\bmod M = 0$$
You are also given that f(104,103)=97158.
Si può vedere che $f(10, 10) = 4$ con le coppie (3,3), (5,5), (7,9) e (9,10).
Find f(1012,106).
Ti viene anche dato che $f({10}^4, {10}^3) = 97\\,158$.
Trova $f({10}^{12}, {10}^6)$.
# --hints--
`euler326()` should return 1966666166408794400.
`moduloSummations()` dovrebbe restituire `1966666166408794400`.
```js
assert.strictEqual(euler326(), 1966666166408794400);
assert.strictEqual(moduloSummations(), 1966666166408794400);
```
# --seed--
@ -33,12 +35,12 @@ assert.strictEqual(euler326(), 1966666166408794400);
## --seed-contents--
```js
function euler326() {
function moduloSummations() {
return true;
}
euler326();
moduloSummations();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4b31000cf542c50ffc6
title: 'Problem 327: Rooms of Doom'
title: 'Problema 327: Stanze del destino'
challengeType: 5
forumTopicId: 301984
dashedName: problem-327-rooms-of-doom
@ -8,30 +8,38 @@ dashedName: problem-327-rooms-of-doom
# --description--
A series of three rooms are connected to each other by automatic doors.
Tre stanze sono collegate tra loro da porte automatiche.
Each door is operated by a security card. Once you enter a room the door automatically closes and that security card cannot be used again. A machine at the start will dispense an unlimited number of cards, but each room (including the starting room) contains scanners and if they detect that you are holding more than three security cards or if they detect an unattended security card on the floor, then all the doors will become permanently locked. However, each room contains a box where you may safely store any number of security cards for use at a later stage.
<img class="img-responsive center-block" alt="serie di tre stanze collegate tra loro da porte automatiche" src="https://cdn.freecodecamp.org/curriculum/project-euler/rooms-of-doom.gif" style="background-color: white; padding: 10px;" />
If you simply tried to travel through the rooms one at a time then as you entered room 3 you would have used all three cards and would be trapped in that room forever!
Ogni porta è azionata da una scheda di sicurezza. Una volta che si entra in una stanza, la porta si chiude automaticamente, e quella scheda di sicurezza non può essere utilizzata di nuovo. Una macchina distribuirà un numero illimitato di carte all'inizio, ma ogni stanza (compresa la stanza di partenza) contiene degli scanner. Se rilevano che si stanno tenendo più di tre carte di sicurezza o se rilevano una carta di sicurezza incustodita sul pavimento, poi tutte le porte diventeranno permanentemente bloccate. Tuttavia, ogni stanza contiene una scatola in cui è possibile conservare in modo sicuro qualsiasi numero di carte di sicurezza da utilizzare in una fase successiva.
However, if you make use of the storage boxes, then escape is possible. For example, you could enter room 1 using your first card, place one card in the storage box, and use your third card to exit the room back to the start. Then after collecting three more cards from the dispensing machine you could use one to enter room 1 and collect the card you placed in the box a moment ago. You now have three cards again and will be able to travel through the remaining three doors. This method allows you to travel through all three rooms using six security cards in total.
Se semplicemente cercassi di viaggiare attraverso le camere una alla volta, entrando nella stanza 3 avresti usato tutte e tre le carte e rimarresti intrappolato in quella stanza per sempre!
It is possible to travel through six rooms using a total of 123 security cards while carrying a maximum of 3 cards.
Tuttavia, se si fa uso delle scatole di archiviazione, allora fuggire è possibile. Ad esempio, è possibile entrare nella stanza 1 utilizzando la prima carta, posizionare una carta nella casella di archiviazione, e utilizzare la terza carta per uscire dalla stanza e tornare di nuovo all'inizio. Poi dopo aver raccolto altre tre carte dalla macchina erogatrice ne potresti utilizzare una per entrare nella stanza 1 e raccogliere la carta che hai messo nella scatola un attimo prima. Ora hai ancora tre carte e sarai in grado di viaggiare attraverso le rimanenti tre porte. Questo metodo consente di viaggiare attraverso tutte e tre le stanze utilizzando sei carte di sicurezza in totale.
Let C be the maximum number of cards which can be carried at any time. Let R be the number of rooms to travel through. Let M(C,R) be the minimum number of cards required from the dispensing machine to travel through R rooms carrying up to a maximum of C cards at any time.
È possibile viaggiare attraverso sei camere con un totale di 123 carte di sicurezza trasportando un massimo di 3 carte.
For example, M(3,6)=123 and M(4,6)=23.And, ΣM(C,6)=146 for 3 ≤ C ≤ 4.
Sia $C$ il numero massimo di carte che possono essere trasportate in qualsiasi momento.
You are given that ΣM(C,10)=10382 for 3 ≤ C ≤ 10.
Sia $R$ il numero di stanze da attraversare.
Find ΣM(C,30) for 3 ≤ C ≤ 40.
Sia $M(C, R)$ il numero minimo di carte richieste dal distributore per viaggiare attraverso $R$ stanze portando in ogni momento un massimo di $C$ carte.
Per esempio, $M(3, 6) = 123$ e $M(4, 6) = 23$.
E $\sum M(C, 6) = 146$ per $3 ≤ C ≤ 4$.
Ti viene dato che $\sum M(C, 10) = 10382$ per $3 ≤ C ≤ 10$.
Trova $\sum M(C, 30)$ per $3 ≤ C ≤ 40$.
# --hints--
`euler327()` should return 34315549139516.
`roomsOfDoom()` dovrebbe restituire `34315549139516`.
```js
assert.strictEqual(euler327(), 34315549139516);
assert.strictEqual(roomsOfDoom(), 34315549139516);
```
# --seed--
@ -39,12 +47,12 @@ assert.strictEqual(euler327(), 34315549139516);
## --seed-contents--
```js
function euler327() {
function roomsOfDoom() {
return true;
}
euler327();
roomsOfDoom();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4b41000cf542c50ffc7
title: 'Problem 328: Lowest-cost Search'
title: 'Problema 328: Ricerca a costo minore'
challengeType: 5
forumTopicId: 301985
dashedName: problem-328-lowest-cost-search
@ -8,32 +8,32 @@ dashedName: problem-328-lowest-cost-search
# --description--
We are trying to find a hidden number selected from the set of integers {1, 2, ..., n} by asking questions.
Stiamo cercando di trovare un numero nascosto selezionato dal set di interi {1, 2, ..., $n$} facendo domande. Ogni numero (domanda) che chiediamo, ha un <u>costo pari al numero chiesto</u> e otteniamo una delle tre risposte possibili:
Each number (question) we ask, has a cost equal to the number asked and we get one of three possible answers: "Your guess is lower than the hidden number", or
- "La tua ipotesi è inferiore al numero nascosto", o
- "Sì, è così!", o
- "La tua ipotesi è più alta del numero nascosto".
"Yes, that's it!", or
Dato il valore di $n$, una strategia ottimale minimizza il costo totale (es. la somma di tutte le domande poste) <u>per il caso peggiore</u>. Ad es.
"Your guess is higher than the hidden number".
Se $n = 3$, il meglio che possiamo fare è ovviamente chiedere il numero "<strong>2</strong>". La risposta ci porterà immediatamente a trovare il numero nascosto (a un costo totale = 2).
Given the value of n, an optimal strategy minimizes the total cost (i.e. the sum of all the questions asked) for the worst possible case. E.g.
Se $n = 8$, potremmo decidere di utilizzare un tipo di strategia di "ricerca binaria": la nostra prima domanda sarebbe "<strong>4</strong>" e se il numero nascosto è superiore a 4 avremo bisogno di una o due domande aggiuntive. Sia "<strong>6</strong>" la nostra seconda domanda. Se il numero nascosto è ancora superiore a 6, avremo bisogno di una terza domanda per operare una discriminazione tra 7 e 8. Così, la nostra terza domanda sarà "<strong>7</strong>" e il costo totale per questo scenario peggiore sarà di $4 + 6 + 7 = \mathbf{\color{red}{17}}$.
If n=3, the best we can do is obviously to ask the number "2". The answer will immediately lead us to find the hidden number (at a total cost = 2).
Possiamo migliorare notevolmente il costo peggiore per $n = 8$, scegliendo "<strong>5</strong>" come nostra prima domanda. Se ci viene detto che il numero nascosto è superiore a 5, la nostra seconda domanda sarà "<strong>7</strong>", allora sapremo per certo qual'è il numero nascosto (per un costo totale di $5 + 7 = \mathbf{\color{blue}{12}}$). Se ci viene detto che il numero nascosto è inferiore a 5, la nostra seconda domanda sarà "<strong>3</strong>" e se il numero nascosto è inferiore a 3 la nostra terza domanda sarà "<strong>1</strong>", dando un costo totale di $5 + 3 + 1 = \mathbf{\color{blue}{9}}$. Dal momento che $\mathbf{\color{blue}{12 > 9}}$, il costo più basso per questa strategia è <strong><span style="color: red;">12</span></strong>. Questo è meglio di quello che abbiamo realizzato in precedenza con la strategia di "ricerca binaria"; è anche migliore o uguale a qualsiasi altra strategia. Così, infatti, abbiamo appena descritto una strategia ottimale per $n = 8$.
If n=8, we might decide to use a "binary search" type of strategy: Our first question would be "4" and if the hidden number is higher than 4 we will need one or two additional questions. Let our second question be "6". If the hidden number is still higher than 6, we will need a third question in order to discriminate between 7 and 8. Thus, our third question will be "7" and the total cost for this worst-case scenario will be 4+6+7=17.
Sia $C(n)$ sia il costo peggiore ottenuto da una strategia ottimale per $n$, come descritto sopra. Così $C(1) = 0$, $C(2) = 1$, $C(3) = 2$ e $C(8) = 12$.
We can improve considerably the worst-case cost for n=8, by asking "5" as our first question. If we are told that the hidden number is higher than 5, our second question will be "7", then we'll know for certain what the hidden number is (for a total cost of 5+7=12). If we are told that the hidden number is lower than 5, our second question will be "3" and if the hidden number is lower than 3 our third question will be "1", giving a total cost of 5+3+1=9. Since 12>9, the worst-case cost for this strategy is 12. That's better than what we achieved previously with the "binary search" strategy; it is also better than or equal to any other strategy. So, in fact, we have just described an optimal strategy for n=8.
Allo stesso modo, $C(100) = 400$ e $\displaystyle\sum_{n = 1}^{100} C(n) = 17575$.
Let C(n) be the worst-case cost achieved by an optimal strategy for n, as described above. Thus C(1) = 0, C(2) = 1, C(3) = 2 and C(8) = 12. Similarly, C(100) = 400 and C(n) = 17575.
Find C(n).
Trova $\displaystyle\sum_{n = 1}^{200\\,000} C(n)$.
# --hints--
`euler328()` should return 260511850222.
`lowestCostSearch()` dovrebbe restituire `260511850222`.
```js
assert.strictEqual(euler328(), 260511850222);
assert.strictEqual(lowestCostSearch(), 260511850222);
```
# --seed--
@ -41,12 +41,12 @@ assert.strictEqual(euler328(), 260511850222);
## --seed-contents--
```js
function euler328() {
function lowestCostSearch() {
return true;
}
euler328();
lowestCostSearch();
```
# --solutions--

View File

@ -8,7 +8,7 @@ dashedName: problem-250-250250
# --description--
$\\{11, 22, 33, \ldots, {250250}^{250250}\\}$ の部分集合のうち、空ではなく、要素の和が 250 で割り切れるものはいくつありますか。 回答として下位 16 桁を入力すること。
Find the number of non-empty subsets of $\\{{1}^{1}, {2}^{2}, {3}^{3}, \ldots, {250250}^{250250}\\}$, the sum of whose elements is divisible by 250. 回答として下位 16 桁を入力すること。
# --hints--

View File

@ -80,6 +80,11 @@ assert.deepEqual(binarySearch(_testArray, 11), [13, 5, 10, 11])
assert.deepEqual(binarySearch(_testArray, 13), [13]);
```
`binarySearch(testArray, 70)` deve retornar `[13, 19, 22, 49, 70]`.
```js
assert.deepEqual(binarySearch(_testArray, 70), [13, 19, 22, 49, 70]);
```
# --seed--

View File

@ -20,10 +20,10 @@ Quantos triângulos há contendo a origem no interior e tendo todos os três vé
# --hints--
`trianglesConttainingOrigin()` deve retornar `1725323624056`.
`trianglesContainingOrigin()` deve retornar `1725323624056`.
```js
assert.strictEqual(trianglesConttainingOrigin(), 1725323624056);
assert.strictEqual(trianglesContainingOrigin(), 1725323624056);
```
# --seed--