chore(i18n,curriculum): update translations (#44140)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3f91000cf542c50ff0b
|
id: 5900f3f91000cf542c50ff0b
|
||||||
title: 'Problem 141: Investigating progressive numbers, n, which are also square'
|
title: 'Problema 141: Investigação de números progressivos, n, que também são quadrados'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301770
|
forumTopicId: 301770
|
||||||
dashedName: problem-141-investigating-progressive-numbers-n-which-are-also-square
|
dashedName: problem-141-investigating-progressive-numbers-n-which-are-also-square
|
||||||
@ -8,22 +8,22 @@ dashedName: problem-141-investigating-progressive-numbers-n-which-are-also-squar
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A positive integer, n, is divided by d and the quotient and remainder are q and r respectively. In addition d, q, and r are consecutive positive integer terms in a geometric sequence, but not necessarily in that order.
|
Um número inteiro positivo, $n$, é dividido por $d$ e o quociente e resto são $q$ e $r$, respectivamente. Além disso, $d$, $q$ e $r$ são termos inteiros positivos consecutivos em uma sequência geométrica, mas não necessariamente nessa ordem.
|
||||||
|
|
||||||
For example, 58 divided by 6 has quotient 9 and remainder 4. It can also be seen that 4, 6, 9 are consecutive terms in a geometric sequence (common ratio 3/2).
|
Por exemplo, 58 dividido por 6 têm um quociente de 9 e um resto de 4. Também pode-se ver que 4, 6 e 9 são termos consecutivos em uma sequência geométrica (razão comum $\frac{3}{2}$).
|
||||||
|
|
||||||
We will call such numbers, n, progressive.
|
Chamaremos esses números, $n$, de progressivos.
|
||||||
|
|
||||||
Some progressive numbers, such as 9 and 10404 = 1022, happen to also be perfect squares. The sum of all progressive perfect squares below one hundred thousand is 124657.
|
Alguns números progressivos, como 9 e 10404 = ${102}^2$, também são quadrados perfeitos. A soma de todos os quadrados perfeitos progressivos abaixo de cem mil é 124657.
|
||||||
|
|
||||||
Find the sum of all progressive perfect squares below one trillion (1012).
|
Encontre a soma de todos os quadrados perfeitos progressivos abaixo de um trilhão (${10}^{12}$).
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler141()` should return 878454337159.
|
`progressivePerfectSquares()` deve retornar `878454337159`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler141(), 878454337159);
|
assert.strictEqual(progressivePerfectSquares(), 878454337159);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +31,12 @@ assert.strictEqual(euler141(), 878454337159);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler141() {
|
function progressivePerfectSquares() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler141();
|
progressivePerfectSquares();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3fa1000cf542c50ff0d
|
id: 5900f3fa1000cf542c50ff0d
|
||||||
title: 'Problem 142: Perfect Square Collection'
|
title: 'Problema 142: Coleção de quadrados perfeitos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301771
|
forumTopicId: 301771
|
||||||
dashedName: problem-142-perfect-square-collection
|
dashedName: problem-142-perfect-square-collection
|
||||||
@ -8,14 +8,14 @@ dashedName: problem-142-perfect-square-collection
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Find the smallest x + y + z with integers x > y > z > 0 such that x + y, x − y, x + z, x − z, y + z, y − z are all perfect squares.
|
Encontre a menor soma de $x + y + z$, com números inteiros $x > y > z > 0$, tal que $x + y$, $x – y$, $x + z$, $x – z$, $y + z$, $y – z$ sejam todos quadrados perfeitos.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler142()` should return 1006193.
|
`perfectSquareCollection()` deve retornar `1006193`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler142(), 1006193);
|
assert.strictEqual(perfectSquareCollection(), 1006193);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -23,12 +23,12 @@ assert.strictEqual(euler142(), 1006193);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler142() {
|
function perfectSquareCollection() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler142();
|
perfectSquareCollection();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3fc1000cf542c50ff0e
|
id: 5900f3fc1000cf542c50ff0e
|
||||||
title: 'Problem 143: Investigating the Torricelli point of a triangle'
|
title: 'Problema 143: Investigação do ponto de Torricelli de um triângulo'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301772
|
forumTopicId: 301772
|
||||||
dashedName: problem-143-investigating-the-torricelli-point-of-a-triangle
|
dashedName: problem-143-investigating-the-torricelli-point-of-a-triangle
|
||||||
@ -8,20 +8,22 @@ dashedName: problem-143-investigating-the-torricelli-point-of-a-triangle
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Let ABC be a triangle with all interior angles being less than 120 degrees. Let X be any point inside the triangle and let XA = p, XC = q, and XB = r.
|
Imagine que ABC seja um triângulo com todos os ângulos internos menores que 120 graus. Considere X qualquer ponto dentro do triângulo e $XA = p$, $XC = q$ e $XB = r$.
|
||||||
|
|
||||||
Fermat challenged Torricelli to find the position of X such that p + q + r was minimised.
|
Fermat desafiou Torricelli a encontrar a posição de X, de modo que p + q + r seja minimizado.
|
||||||
|
|
||||||
Torricelli was able to prove that if equilateral triangles AOB, BNC and AMC are constructed on each side of triangle ABC, the circumscribed circles of AOB, BNC, and AMC will intersect at a single point, T, inside the triangle. Moreover he proved that T, called the Torricelli/Fermat point, minimises p + q + r. Even more remarkable, it can be shown that when the sum is minimised, AN = BM = CO = p + q + r and that AN, BM and CO also intersect at T.
|
Torricelli foi capaz de provar que, se triângulos equiláteros AOB, BNC e AMC são construídos em cada lado do triângulo ABC, os círculos circunscritos da AOB, BNC e AMC se entrecruzarão em um único ponto, T, dentro do triângulo. Além disso, ele provou que T, chamado de ponto de Torricelli/Fermat, minimiza $p + q + r$. Ainda mais notável, pode mostrar-se que, quando a soma é minimizada, $AN = BM = CO = p + q + r$ e AN, BM e CO também se cruzam em T.
|
||||||
|
|
||||||
If the sum is minimised and a, b, c, p, q and r are all positive integers we shall call triangle ABC a Torricelli triangle. For example, a = 399, b = 455, c = 511 is an example of a Torricelli triangle, with p + q + r = 784. Find the sum of all distinct values of p + q + r ≤ 120000 for Torricelli triangles.
|
<img class="img-responsive center-block" alt="triângulos equiláteros AOB, BNC e AMC construídos em cada lado do triângulo ABC; os círculos circunscritos da AOB, BNC e AMC se entrecruzarão em um único ponto, T, dentro do triângulo" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-the-torricelli-point-of-a-triangle.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Se a soma for minimizada e a, b, c, p, q e r forem todos números inteiros positivos, chamaremos o triângulo ABC de triângulo de Torricelli. Por exemplo, $a = 399$, $b = 455$, $c = 511$ é um exemplo de um triângulo de Torricelli, com $p + q + r = 784$. Encontre a soma de todos os valores distintos de $p + q + r ≤ 120000$ para os triângulos de Torricelli.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler143()` should return 30758397.
|
`sumTorricelliTriangles()` deve retornar `30758397`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler143(), 30758397);
|
assert.strictEqual(sumTorricelliTriangles(), 30758397);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +31,12 @@ assert.strictEqual(euler143(), 30758397);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler143() {
|
function sumTorricelliTriangles() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler143();
|
sumTorricelliTriangles();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3fc1000cf542c50ff0f
|
id: 5900f3fc1000cf542c50ff0f
|
||||||
title: 'Problem 144: Investigating multiple reflections of a laser beam'
|
title: 'Problema 144: Investigação das várias reflexões de um raio laser'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301773
|
forumTopicId: 301773
|
||||||
dashedName: problem-144-investigating-multiple-reflections-of-a-laser-beam
|
dashedName: problem-144-investigating-multiple-reflections-of-a-laser-beam
|
||||||
@ -8,22 +8,37 @@ dashedName: problem-144-investigating-multiple-reflections-of-a-laser-beam
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In laser physics, a "white cell" is a mirror system that acts as a delay line for the laser beam. The beam enters the cell, bounces around on the mirrors, and eventually works its way back out.
|
Na física de lasers, uma "célula branca" é um sistema de espelho que atua como uma linha de retardo para o raio laser. O raio entra na célula, colide com os espelhos e, por fim, sai.
|
||||||
|
|
||||||
The specific white cell we will be considering is an ellipse with the equation 4x2 + y2 = 100
|
A célula branca específica que consideraremos é uma elipse com a equação $4{x}^2 + y^2 = 100$
|
||||||
|
|
||||||
The section corresponding to −0.01 ≤ x ≤ +0.01 at the top is missing, allowing the light to enter and exit through the hole.
|
A seção correspondente a $-0,01 ≤ x ≤ + 0,01$ na parte superior está ausente, permitindo que a luz entre e saia pelo buraco.
|
||||||
|
|
||||||
The light beam in this problem starts at the point (0.0,10.1) just outside the white cell, and the beam first impacts the mirror at (1.4,-9.6). Each time the laser beam hits the surface of the ellipse, it follows the usual law of reflection "angle of incidence equals angle of reflection." That is, both the incident and reflected beams make the same angle with the normal line at the point of incidence. In the figure on the left, the red line shows the first two points of contact between the laser beam and the wall of the white cell; the blue line shows the line tangent to the ellipse at the point of incidence of the first bounce.The slope m of the tangent line at any point (x,y) of the given ellipse is: m = −4x/yThe normal line is perpendicular to this tangent line at the point of incidence. The animation on the right shows the first 10 reflections of the beam.
|
<div style="text-align: center">
|
||||||
|
<img class="img-responsive center-block" alt="raio de luz começando no ponto (0,0, 10,1) e colidindo com o espelho no ponto (1,4, -9,6)" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-multiple-reflections-of-a-laser-beam-1.png" style="display: inline-block; background-color: white; padding: 10px;">
|
||||||
|
<img class="img-responsive center-block" alt="animação com as primeiras 10 reflexões do raio" src="https://cdn.freecodecamp.org/curriculum/project-euler/investigating-multiple-reflections-of-a-laser-beam-2.gif" style="display: inline-block; background-color: white; padding: 10px;">
|
||||||
|
</div><br>
|
||||||
|
|
||||||
How many times does the beam hit the internal surface of the white cell before exiting?
|
O raio de luz neste problema começa no ponto (0,0, 10,1) no exterior da célula branca e o raio colide no espelho primeiramente em (1,4, -9,6).
|
||||||
|
|
||||||
|
Cada vez que o laser atinge a superfície da elipse, segue a lei habitual de reflexão, que diz que "o ângulo de incidência é igual a ângulo de reflexão". Ou seja, tanto o raio incidente como raio refletido têm o mesmo ângulo, com a linha normal no momento da incidência.
|
||||||
|
|
||||||
|
Na figura à esquerda, a linha vermelha mostra os dois primeiros pontos de contato entre o raio laser e a parede da célula branca. A linha azul mostra a reta tangente à elipse no ponto da incidência da primeira colisão.
|
||||||
|
|
||||||
|
A curva m da reta tangente em qualquer ponto (x, y) da elipse é: $m = -4 × \frac{x}{y}$
|
||||||
|
|
||||||
|
A linha normal é perpendicular a essa reta tangente no ponto de incidência.
|
||||||
|
|
||||||
|
A animação à direita mostra as primeiras 10 reflexões do raio.
|
||||||
|
|
||||||
|
Quantas vezes o raio atinge a superfície interna da célula branca antes de sair?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler144()` should return 354.
|
`laserBeamReflections()` deve retornar `354`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler144(), 354);
|
assert.strictEqual(laserBeamReflections(), 354);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +46,12 @@ assert.strictEqual(euler144(), 354);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler144() {
|
function laserBeamReflections() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler144();
|
laserBeamReflections();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3fd1000cf542c50ff10
|
id: 5900f3fd1000cf542c50ff10
|
||||||
title: 'Problem 145: How many reversible numbers are there below one-billion?'
|
title: 'Problema 145: Quantos números reversíveis há abaixo de um bilhão?'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301774
|
forumTopicId: 301774
|
||||||
dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||||
@ -8,18 +8,18 @@ dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Some positive integers n have the property that the sum \[ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n).
|
Alguns números inteiros positivos $n$ têm a propriedade de que a soma [ $n + reverse(n)$ ] consiste inteiramente de dígitos ímpares (decimais). Por exemplo, $36 + 63 = 99$ e $409 + 904 = 1313$. Chamaremos esses números de reversíveis. Portanto, 36, 63, 409 e 904 são reversíveis. Zeros à esquerda não são permitidos em $n$ ou em $reverse(n)$.
|
||||||
|
|
||||||
There are 120 reversible numbers below one-thousand.
|
Há 120 números reversíveis abaixo de mil.
|
||||||
|
|
||||||
How many reversible numbers are there below one-billion (109)?
|
Quantos números reversíveis há abaixo de um bilhão (${10}^9$)?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler145()` should return 608720.
|
`reversibleNumbers()` deve retornar `608720`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler145(), 608720);
|
assert.strictEqual(reversibleNumbers(), 608720);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -27,12 +27,12 @@ assert.strictEqual(euler145(), 608720);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler145() {
|
function reversibleNumbers() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler145();
|
reversibleNumbers();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3fe1000cf542c50ff11
|
id: 5900f3fe1000cf542c50ff11
|
||||||
title: 'Problem 146: Investigating a Prime Pattern'
|
title: 'Problema 146: Investigação de um padrão em números primos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301775
|
forumTopicId: 301775
|
||||||
dashedName: problem-146-investigating-a-prime-pattern
|
dashedName: problem-146-investigating-a-prime-pattern
|
||||||
@ -8,16 +8,16 @@ dashedName: problem-146-investigating-a-prime-pattern
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
The smallest positive integer n for which the numbers n2+1, n2+3, n2+7, n2+9, n2+13, and n2+27 are consecutive primes is 10. The sum of all such integers n below one-million is 1242490.
|
O menor número inteiro positivo $n$ para o qual os números $n^2 + 1$, $n^2 + 3$, $n^2 + 7$, $n^2 + 9$, $n^2 + 13$, e $n^2 + 27$ são 10 números primos consecutivos. A soma de todos esses números inteiros $n$ abaixo de um milhão é 1242490.
|
||||||
|
|
||||||
What is the sum of all such integers n below 150 million?
|
Qual é a soma de todos esses números inteiros $n$ abaixo dos 150 milhões?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler146()` should return 676333270.
|
`primePattern()` deve retornar `676333270`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler146(), 676333270);
|
assert.strictEqual(primePattern(), 676333270);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -25,12 +25,12 @@ assert.strictEqual(euler146(), 676333270);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler146() {
|
function primePattern() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler146();
|
primePattern();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f3ff1000cf542c50ff12
|
id: 5900f3ff1000cf542c50ff12
|
||||||
title: 'Problem 147: Rectangles in cross-hatched grids'
|
title: 'Problema 147: Retângulos em grades cruzadas'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301776
|
forumTopicId: 301776
|
||||||
dashedName: problem-147-rectangles-in-cross-hatched-grids
|
dashedName: problem-147-rectangles-in-cross-hatched-grids
|
||||||
@ -8,20 +8,24 @@ dashedName: problem-147-rectangles-in-cross-hatched-grids
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In a 3x2 cross-hatched grid, a total of 37 different rectangles could be situated within that grid as indicated in the sketch.
|
Em uma grade cruzada de 3x2, um total de 37 retângulos diferentes podem ser situados dentro dela, conforme indicado no esboço.
|
||||||
|
|
||||||
There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important, i.e. 1x1, 2x1, 3x1, 1x2 and 2x2. If each of them is cross-hatched, the following number of different rectangles could be situated within those smaller grids: 1x1: 1 2x1: 4 3x1: 8 1x2: 4 2x2: 18
|
<img class="img-responsive center-block" alt="formas de situar diferentes retângulos dentro da grade cruzada de 3x2" src="https://cdn.freecodecamp.org/curriculum/project-euler/rectangles-in-cross-hatched-grids.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Adding those to the 37 of the 3x2 grid, a total of 72 different rectangles could be situated within 3x2 and smaller grids.
|
Há 5 grades menores que 3x2, com dimensões vertical e horizontal importantes. São eles: 1x1, 2x1, 3x1, 1x2 e 2x2. Se cada uma delas for cruzada, o número de retângulos diferentes a seguir poderia estar situado dentro dessas grades menores:
|
||||||
|
|
||||||
How many different rectangles could be situated within 47x43 and smaller grids?
|
$$\begin{array}{|c|c|} \hline 1 \times 1 & 1 \\\\ \hline 2 \times 1 & 4 \\\\ \hline 3 \times 1 & 8 \\\\ \hline 1 \times 2 & 4 \\\\ \hline 2 \times 2 & 18 \\\\ \hline \end{array}$$
|
||||||
|
|
||||||
|
Adicionando estes valores aos 37 da grade de 3x2, um total de 72 retângulos diferentes pode ficar situado dentro da grade de 3x2 e das grades menores.
|
||||||
|
|
||||||
|
Quantos retângulos diferentes poderiam estar localizados na grade de 47x43 e em suas grades menores?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler147()` should return 846910284.
|
`crossHatchedRectangles()` deve retornar `846910284`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler147(), 846910284);
|
assert.strictEqual(crossHatchedRectangles(), 846910284);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +33,12 @@ assert.strictEqual(euler147(), 846910284);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler147() {
|
function crossHatchedRectangles() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler147();
|
crossHatchedRectangles();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4021000cf542c50ff13
|
id: 5900f4021000cf542c50ff13
|
||||||
title: 'Problem 149: Searching for a maximum-sum subsequence'
|
title: 'Problema 149: Procura de uma subsequência de soma máxima'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301778
|
forumTopicId: 301778
|
||||||
dashedName: problem-149-searching-for-a-maximum-sum-subsequence
|
dashedName: problem-149-searching-for-a-maximum-sum-subsequence
|
||||||
@ -8,28 +8,30 @@ dashedName: problem-149-searching-for-a-maximum-sum-subsequence
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Looking at the table below, it is easy to verify that the maximum possible sum of adjacent numbers in any direction (horizontal, vertical, diagonal or anti-diagonal) is 16 (= 8 + 7 + 1).
|
Olhando para a tabela abaixo, é fácil verificar se a soma máxima possível de números adjacentes em qualquer direção (horizontal, vertical, diagonal ou antidiagonal) é de $16 (= 8 + 7 + 1)$.
|
||||||
|
|
||||||
−25329−6513273−18−4 8
|
$$\begin{array}{|r|r|r|r|} \hline −2 & 5 & 3 & 2 \\\\ \hline 9 & −6 & 5 & 1 \\\\ \hline 3 & 2 & 7 & 3 \\\\ \hline −1 & 8 & −4 & 8 \\\\ \hline \end{array}$$
|
||||||
|
|
||||||
Now, let us repeat the search, but on a much larger scale:
|
Agora, vamos repetir a busca, mas em uma escala muito maior:
|
||||||
|
|
||||||
First, generate four million pseudo-random numbers using a specific form of what is known as a "Lagged Fibonacci Generator":
|
Primeiro, gere quatro milhões de números pseudoaleatórios usando uma forma específica do que é conhecido como "Gerador Fibonacci com atraso":
|
||||||
|
|
||||||
For 1 ≤ k ≤ 55, sk = \[100003 − 200003k + 300007k3] (modulo 1000000) − 500000. For 56 ≤ k ≤ 4000000, sk = \[sk−24 + sk−55 + 1000000] (modulo 1000000) − 500000.
|
Para $1 ≤ k ≤ 55$, $s_k = (100003 − 200003k + 300007{k}^3) \\ (modulo\\ 1000000) − 500000$.
|
||||||
|
|
||||||
Thus, s10 = −393027 and s100 = 86613.
|
Para $56 ≤ k ≤ 4000000$, $s_k = (s_{k − 24} + s_{k − 55} + 1000000) \\ (modulo\\ 1000000) − 500000$.
|
||||||
|
|
||||||
The terms of s are then arranged in a 2000×2000 table, using the first 2000 numbers to fill the first row (sequentially), the next 2000 numbers to fill the second row, and so on.
|
Portanto, $s_{10} = −393027$ e $s_{100} = 86613$.
|
||||||
|
|
||||||
Finally, find the greatest sum of (any number of) adjacent entries in any direction (horizontal, vertical, diagonal or anti-diagonal).
|
Os termos de $s$ estão combinados em uma tabela de 2000×2000 usando os primeiros 2000 números para preencher a primeira linha (sequencialmente), os próximos 2000 números para preencher a segunda linha e assim por diante.
|
||||||
|
|
||||||
|
Por fim, encontre a maior soma de (qualquer número de) entradas adjacentes em qualquer direção (horizontal, vertical, diagonal ou antidiagonal).
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler149()` should return 52852124.
|
`maximumSubSequence()` deve retornar `52852124`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler149(), 52852124);
|
assert.strictEqual(maximumSubSequence(), 52852124);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -37,12 +39,12 @@ assert.strictEqual(euler149(), 52852124);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler149() {
|
function maximumSubSequence() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler149();
|
maximumSubSequence();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4031000cf542c50ff15
|
id: 5900f4031000cf542c50ff15
|
||||||
title: >-
|
title: >-
|
||||||
Problem 150: Searching a triangular array for a sub-triangle having minimum-sum
|
Problema 150: Procura de uma matriz triangular para um subtriângulo com a soma mínima
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301781
|
forumTopicId: 301781
|
||||||
dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum
|
dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum
|
||||||
@ -9,32 +9,34 @@ dashedName: problem-150-searching-a-triangular-array-for-a-sub-triangle-having-m
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
In a triangular array of positive and negative integers, we wish to find a sub-triangle such that the sum of the numbers it contains is the smallest possible.
|
Em uma matriz triangular de números inteiros positivos e negativos, queremos encontrar um subtriângulo onde a soma dos números nele contidos seja a menor possível.
|
||||||
|
|
||||||
In the example below, it can be easily verified that the marked triangle satisfies this condition having a sum of −42.
|
No exemplo abaixo, pode ser facilmente verificado que o triângulo marcado satisfaz esta condição tendo uma soma de -42.
|
||||||
|
|
||||||
We wish to make such a triangular array with one thousand rows, so we generate 500500 pseudo-random numbers sk in the range ±219, using a type of random number generator (known as a Linear Congruential Generator) as follows: t := 0
|
<img class="img-responsive center-block" alt="matriz triangular, com subtriângulo marcado, somando -42" src="https://cdn.freecodecamp.org/curriculum/project-euler/searching-a-triangular-array-for-a-sub-triangle-having-minimum-sum.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
for k = 1 up to k = 500500:
|
Queremos fazer uma matriz triangular desse tipo com mil fileiras. Então, geramos 500500 números pseudoaleatórios $s_k$ no intervalo $±2^{19}$, usando um tipo de gerador de número aleatório (conhecido como gerador congruente linear), da seguinte forma:
|
||||||
|
|
||||||
t := (615949\*t + 797807) modulo 220 sk := t−219 Thus: s1 = 273519, s2 = −153582, s3 = 450905 etc Our triangular array is then formed using the pseudo-random numbers thus:
|
$$\begin{align} t := & \\ 0\\\\ \text{for}\\ & k = 1\\ \text{up to}\\ k = 500500:\\\\ & t := (615949 × t + 797807)\\ \text{modulo}\\ 2^{20}\\\\ & s_k := t − 219\\\\ \end{align}$$
|
||||||
|
|
||||||
s1 s2 s3 s4 s5 s6
|
Assim: $s_1 = 273519$, $s_2 = −153582$, $s_3 = 450905$ e assim por diante.
|
||||||
|
|
||||||
s7 s8 s9 s10 ...
|
Nossa matriz triangular é então formada usando os pseudonúmeros aleatórios, ou seja:
|
||||||
|
|
||||||
Sub-triangles can start at any element of the array and extend down as far as we like (taking-in the two elements directly below it from the next row, the three elements directly below from the row after that, and so on).
|
$$ s_1 \\\\ s_2\\;s_3 \\\\ s_4\\; s_5\\; s_6 \\\\ s_7\\; s_8\\; s_9\\; s_{10} \\\\ \ldots $$
|
||||||
|
|
||||||
The "sum of a sub-triangle" is defined as the sum of all the elements it contains.
|
Os subtriângulos podem começar em qualquer elemento da matriz e se estender até onde quisermos (pegando os dois elementos diretamente abaixo dele na próxima fileira, sendo os três elementos diretamente abaixo da linha depois disso e assim por diante).
|
||||||
|
|
||||||
Find the smallest possible sub-triangle sum.
|
A "soma de um subtriângulo" é definida como a soma de todos os elementos que o contêm.
|
||||||
|
|
||||||
|
Encontre o subtriângulo de menor soma de elementos possível.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler150()` should return -271248680.
|
`smallestSubTriangleSum()` deve retornar `-271248680`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler150(), -271248680);
|
assert.strictEqual(smallestSubTriangleSum(), -271248680);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -42,12 +44,12 @@ assert.strictEqual(euler150(), -271248680);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler150() {
|
function smallestSubTriangleSum() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler150();
|
smallestSubTriangleSum();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4031000cf542c50ff16
|
id: 5900f4031000cf542c50ff16
|
||||||
title: 'Problem 151: Paper sheets of standard sizes: an expected-value problem'
|
title: 'Problema 151: Folhas de papel de tamanhos padrão: um problema de valor esperado'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301782
|
forumTopicId: 301782
|
||||||
dashedName: problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem
|
dashedName: problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem
|
||||||
@ -8,22 +8,28 @@ dashedName: problem-151-paper-sheets-of-standard-sizes-an-expected-value-problem
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A printing shop runs 16 batches (jobs) every week and each batch requires a sheet of special colour-proofing paper of size A5.
|
Uma gráfica executa 16 lotes (tarefas) toda semana e cada lote requer uma folha de papel especial de tamanho A5 para a prova de cores.
|
||||||
|
|
||||||
Every Monday morning, the foreman opens a new envelope, containing a large sheet of the special paper with size A1.
|
Todas as segundas de manhã, o coordenador abre um novo envelope, contendo uma grande folha do papel especial com tamanho A1.
|
||||||
|
|
||||||
He proceeds to cut it in half, thus getting two sheets of size A2. Then he cuts one of them in half to get two sheets of size A3 and so on until he obtains the A5-size sheet needed for the first batch of the week.
|
Ele, então, prossegue reduzindo-a ao meio e obtendo, assim, duas folhas de tamanho A2. Depois, corta uma delas pela metade para obter duas folhas de tamanho A3 e assim por diante até obter a folha A5 necessária para o primeiro lote da semana.
|
||||||
|
|
||||||
All the unused sheets are placed back in the envelope.
|
Todas as folhas não utilizadas são colocadas de volta no envelope.
|
||||||
|
|
||||||
At the beginning of each subsequent batch, he takes from the envelope one sheet of paper at random. If it is of size A5, he uses it. If it is larger, he repeats the 'cut-in-half' procedure until he has what he needs and any remaining sheets are always placed back in the envelope. Excluding the first and last batch of the week, find the expected number of times (during each week) that the foreman finds a single sheet of paper in the envelope. Give your answer rounded to six decimal places using the format x.xxxxxx .
|
<img class="img-responsive center-block" alt="Folha de tamanho A1 dividida em: A2, A3, A4 e duas folhas A5" src="https://cdn.freecodecamp.org/curriculum/project-euler/paper-sheets-of-standard-sizes-an-expected-value-problem.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
No início de cada lote subsequente, ele tira uma folha de papel do envelope aleatoriamente. Se ela for de tamanho A5, ele a usa. Se for maior, ele repete o procedimento de "cortar pela metade" até ter o que precisa. Todas as folhas restantes são sempre colocadas de volta no envelope.
|
||||||
|
|
||||||
|
Excluindo o primeiro e último lote da semana, encontre o número esperado de vezes (durante cada semana) em que o coordenador encontrará uma única folha de papel no envelope.
|
||||||
|
|
||||||
|
Arredonde sua resposta para até seis casas decimais usando o formato `x.xxxxxx`.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler151()` should return 0.464399.
|
`expectedValueProblem()` deve retornar `0.464399`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler151(), 0.464399);
|
assert.strictEqual(expectedValueProblem(), 0.464399);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +37,12 @@ assert.strictEqual(euler151(), 0.464399);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler151() {
|
function expectedValueProblem() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler151();
|
expectedValueProblem();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4041000cf542c50ff17
|
id: 5900f4041000cf542c50ff17
|
||||||
title: 'Problem 152: Writing one half as a sum of inverse squares'
|
title: 'Problema 152: Escrever a metade como uma soma de quadrados inversos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301783
|
forumTopicId: 301783
|
||||||
dashedName: problem-152-writing-one-half-as-a-sum-of-inverse-squares
|
dashedName: problem-152-writing-one-half-as-a-sum-of-inverse-squares
|
||||||
@ -8,18 +8,22 @@ dashedName: problem-152-writing-one-half-as-a-sum-of-inverse-squares
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
There are several ways to write the number 1/2 as a sum of inverse squares using distinct integers.
|
Há várias maneiras de escrever o número $\frac{1}{2}$ como uma soma de quadrados inversos usando números inteiros distintos.
|
||||||
|
|
||||||
For instance, the numbers {2,3,4,5,7,12,15,20,28,35} can be used:
|
Por exemplo, os números {2, 3, 4, 5, 7, 12, 15, 20, 28, 35} podem ser usados:
|
||||||
|
|
||||||
In fact, only using integers between 2 and 45 inclusive, there are exactly three ways to do it, the remaining two being: {2,3,4,6,7,9,10,20,28,35,36,45} and {2,3,4,6,7,9,12,15,28,30,35,36,45}. How many ways are there to write the number 1/2 as a sum of inverse squares using distinct integers between 2 and 80 inclusive?
|
$$\frac{1}{2} = \frac{1}{2^2} + \frac{1}{3^2} + \frac{1}{4^2} + \frac{1}{5^2} + \frac{1}{7^2} + \frac{1}{{12}^2} + \frac{1}{{15}^2} + \frac{1}{{20}^2} + \frac{1}{{28}^2} + \frac{1}{{35}^2}$$
|
||||||
|
|
||||||
|
De fato, usando apenas números inteiros entre 2 e 45, há exatamente três maneiras de fazer isso. As duas formas restantes são: {2, 3, 4, 6, 7, 9, 10, 20, 28, 35, 36, 45} e {2, 3, 4, 6, 7, 9, 12, 15, 28, 30, 35, 36, 45}.
|
||||||
|
|
||||||
|
Quantas formas existem de escrever o número $\frac{1}{2}$ como uma soma de quadrados inversos usando números inteiros distintos entre 2 e 80?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler152()` should return 301.
|
`sumInverseSquares()` deve retornar `301`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler152(), 301);
|
assert.strictEqual(sumInverseSquares(), 301);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -27,12 +31,12 @@ assert.strictEqual(euler152(), 301);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler152() {
|
function sumInverseSquares() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler152();
|
sumInverseSquares();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4051000cf542c50ff18
|
id: 5900f4051000cf542c50ff18
|
||||||
title: 'Problem 153: Investigating Gaussian Integers'
|
title: 'Problema 153: Investigação de números inteiros gaussianos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301784
|
forumTopicId: 301784
|
||||||
dashedName: problem-153-investigating-gaussian-integers
|
dashedName: problem-153-investigating-gaussian-integers
|
||||||
@ -8,46 +8,60 @@ dashedName: problem-153-investigating-gaussian-integers
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
As we all know the equation x2=-1 has no solutions for real x.
|
Como todos sabemos, a equação $x^2 = -1$ não tem soluções para $x$ real.
|
||||||
|
|
||||||
If we however introduce the imaginary number i this equation has two solutions: x=i and x=-i.
|
Se, no entanto, introduzirmos o número imaginário $i$, esta equação tem duas soluções: $x = i$ e $x = -i$.
|
||||||
|
|
||||||
If we go a step further the equation (x-3)2=-4 has two complex solutions: x=3+2i and x=3-2i. x=3+2i and x=3-2i are called each others' complex conjugate.
|
Se formos mais longe, a equação ${(x - 3)}^2 = -4$ tem duas soluções complexas: $x = 3 + 2i$ e $x = 3 - 2i$, que são chamados de complexos conjugados um do outro.
|
||||||
|
|
||||||
Numbers of the form a+bi are called complex numbers.
|
Os números na forma $a + bi$ são chamados de números complexos.
|
||||||
|
|
||||||
In general a+bi and a−bi are each other's complex conjugate. A Gaussian Integer is a complex number a+bi such that both a and b are integers.
|
Em geral, $a + bi$ e $a - bi$ são os conjugados complexos um do outro. Um número inteiro gaussiano é um número complexo $a + bi$, tal que $a$ e $b$ são números inteiros.
|
||||||
|
|
||||||
The regular integers are also Gaussian integers (with b=0).
|
Os números inteiros regulares também são números inteiros gaussianos (com $b = 0$).
|
||||||
|
|
||||||
To distinguish them from Gaussian integers with b ≠ 0 we call such integers "rational integers."
|
Para distingui-los de números inteiros gaussianos com $b ≠ 0$ chamamos esses inteiros de "inteiros racionais".
|
||||||
|
|
||||||
A Gaussian integer is called a divisor of a rational integer n if the result is also a Gaussian integer.
|
Um número inteiro gaussiano é chamado de divisor de um número inteiro racional $n$ se o resultado também for um número inteiro gaussiano.
|
||||||
|
|
||||||
If for example we divide 5 by 1+2i we can simplify in the following manner:
|
Se, por exemplo, dividirmos 5 por $1 + 2i$, podemos simplificar da seguinte maneira:
|
||||||
|
|
||||||
Multiply numerator and denominator by the complex conjugate of 1+2i: 1−2i.
|
Multiplicar o numerador e o denominador pelo conjugado complexo de $1 + 2i$, ou seja, $1 - 2i$.
|
||||||
|
|
||||||
The result is .
|
O resultado é:
|
||||||
|
|
||||||
So 1+2i is a divisor of 5.
|
$$\frac{5}{1 + 2i} = \frac{5}{1 + 2i} \frac{1 - 2i}{1 - 2i} = \frac{5(1 - 2i)}{1 - {(2i)}^2} = \frac{5(1 - 2i)}{1 - (-4)} = \frac{5(1 - 2i)}{5} = 1 - 2i$$
|
||||||
|
|
||||||
Note that 1+i is not a divisor of 5 because .
|
Assim sendo, $1 + 2i$ é um divisor de 5.
|
||||||
|
|
||||||
Note also that if the Gaussian Integer (a+bi) is a divisor of a rational integer n, then its complex conjugate (a−bi) is also a divisor of n. In fact, 5 has six divisors such that the real part is positive: {1, 1 + 2i, 1 − 2i, 2 + i, 2 − i, 5}.
|
Observe que $1 + i$ não é um divisor de 5, pois:
|
||||||
|
|
||||||
The following is a table of all of the divisors for the first five positive rational integers:
|
$$\frac{5}{1 + i} = \frac{5}{2} - \frac{5}{2}i$$
|
||||||
|
|
||||||
n Gaussian integer divisors with positive real partSum s(n) of these
|
Observe também que se o número inteiro gaussiano ($a + bi$) for um divisor de um número inteiro racional $n$, então seu conjugado complexo ($a - bi$) também será um divisor de $n$. De fato, 5 tem seis divisores, sendo que a parte real é positiva: {1, 1 + 2i, 1 - 2i, 2 + i, 2 - i, 5}.
|
||||||
|
|
||||||
divisors111 21, 1+i, 1-i, 25 31, 34 41, 1+i, 1-i, 2, 2+2i, 2-2i,413 51, 1+2i, 1-2i, 2+i, 2-i, 512 For divisors with positive real parts, then, we have: . For 1 ≤ n ≤ 105, ∑ s(n)=17924657155. What is ∑ s(n) for 1 ≤ n ≤ 108?
|
A seguir, vemos uma tabela de todos os divisores para os primeiros cinco números inteiros racionais positivos:
|
||||||
|
|
||||||
|
| n | Números inteiros gaussianos divisores com parte real positiva | Soma s(n) destes divisores |
|
||||||
|
| - | ------------------------------------------------------------- | -------------------------- |
|
||||||
|
| 1 | 1 | 1 |
|
||||||
|
| 2 | 1, 1 + i, 1 - i, 2 | 5 |
|
||||||
|
| 3 | 1, 3 | 4 |
|
||||||
|
| 4 | 1, 1 + i, 1 - i, 2, 2 + 2i, 2 - 2i, 4 | 13 |
|
||||||
|
| 5 | 1, 1 + 2i, 1 - 2i, 2 + i, 2 - i, 5 | 12 |
|
||||||
|
|
||||||
|
Para divisores com partes reais positivas, então, temos: $\displaystyle\sum_{n=1}^5 s(n) = 35$.
|
||||||
|
|
||||||
|
Para $1 ≤ n ≤ {10}^5$, $\displaystyle\sum_{n = 1}^{{10}^5} s(n) = 17924657155$.
|
||||||
|
|
||||||
|
Qual é $\displaystyle\sum_{n=1}^{{10}^8} s(n)$?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler153()` should return 17971254122360636.
|
`sumGaussianIntegers()` deve retornar `17971254122360636`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler153(), 17971254122360636);
|
assert.strictEqual(sumGaussianIntegers(), 17971254122360636);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -55,12 +69,12 @@ assert.strictEqual(euler153(), 17971254122360636);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler153() {
|
function sumGaussianIntegers() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler153();
|
sumGaussianIntegers();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4071000cf542c50ff19
|
id: 5900f4071000cf542c50ff19
|
||||||
title: 'Problem 154: Exploring Pascal''s pyramid'
|
title: 'Problema 154: Explorando o triângulo de Pascal'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301785
|
forumTopicId: 301785
|
||||||
dashedName: problem-154-exploring-pascals-pyramid
|
dashedName: problem-154-exploring-pascals-pyramid
|
||||||
@ -8,16 +8,22 @@ dashedName: problem-154-exploring-pascals-pyramid
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A triangular pyramid is constructed using spherical balls so that each ball rests on exactly three balls of the next lower level.
|
Uma pirâmide triangular é construída usando bolas esféricas de modo que cada bola fique exatamente sobre três bolas do próximo nível.
|
||||||
|
|
||||||
Then, we calculate the number of paths leading from the apex to each position: A path starts at the apex and progresses downwards to any of the three spheres directly below the current position. Consequently, the number of paths to reach a certain position is the sum of the numbers immediately above it (depending on the position, there are up to three numbers above it). The result is Pascal's pyramid and the numbers at each level n are the coefficients of the trinomial expansion (x + y + z)n. How many coefficients in the expansion of (x + y + z)200000 are multiples of 1012?
|
<img class="img-responsive center-block" alt="pirâmide triangular de quatro níveis construída usando bolas esféricas" src="https://cdn.freecodecamp.org/curriculum/project-euler/exploring-pascals-pyramid.png" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Então, calculamos o número de caminhos que levam a partir do ápice para cada posição: um caminho começa no ápice e avança para baixo para qualquer uma das três esferas diretamente abaixo da posição atual. Consequentemente, o número de caminhos para chegar a uma determinada posição é a soma dos números imediatamente acima dele (dependendo da posição, há até três números acima dele).
|
||||||
|
|
||||||
|
O resultado é a pirâmide de Pascal e os números de cada nível são os coeficientes da expansão trinomial ${(x + y + z)}^n$.
|
||||||
|
|
||||||
|
Quantos coeficientes na expansão de ${(x + y + z)}^{200000}$ são múltiplos de ${10}^{12}$?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler154()` should return 479742450.
|
`pascalsPyramid()` deve retornar `479742450`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler154(), 479742450);
|
assert.strictEqual(pascalsPyramid(), 479742450);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -25,12 +31,12 @@ assert.strictEqual(euler154(), 479742450);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler154() {
|
function pascalsPyramid() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler154();
|
pascalsPyramid();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4081000cf542c50ff1a
|
id: 5900f4081000cf542c50ff1a
|
||||||
title: 'Problem 155: Counting Capacitor Circuits'
|
title: 'Problema 155: Contagem de circuitos de capacitor'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301786
|
forumTopicId: 301786
|
||||||
dashedName: problem-155-counting-capacitor-circuits
|
dashedName: problem-155-counting-capacitor-circuits
|
||||||
@ -8,20 +8,26 @@ dashedName: problem-155-counting-capacitor-circuits
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
An electric circuit uses exclusively identical capacitors of the same value C.
|
Um circuito elétrico usa exclusivamente capacitores idênticos de mesmo valor C.
|
||||||
|
|
||||||
The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit. Using this simple procedure and up to n identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to n=3 capacitors of 60 F each, we can obtain the following 7 distinct total capacitance values:
|
Os capacitores podem ser conectados em série ou em paralelo para formar subunidades, as quais podem então ser conectadas em série ou em paralelo com outros capacitores ou outras subunidades para formar subunidades maiores e assim por diante até um circuito final.
|
||||||
|
|
||||||
If we denote by D(n) the number of distinct total capacitance values we can obtain when using up to n equal-valued capacitors and the simple procedure described above, we have: D(1)=1, D(2)=3, D(3)=7 ... Find D(18). Reminder : When connecting capacitors C1, C2 etc in parallel, the total capacitance is CT = C1 + C2 +...,
|
Utilizando este procedimento simples e com n capacitores idênticos, podemos fazer circuitos que tenham um intervalo de capacitâncias total diferentes. Por exemplo, usando até $n = 3$ capacitores de $60 μF$ cada, podemos obter os seguintes 7 valores distintos de capacitância total:
|
||||||
|
|
||||||
whereas when connecting them in series, the overall capacitance is given by:
|
<img class="img-responsive center-block" alt="circuitos de exemplo com até três capacitores, cada um com 60 μF" src="https://cdn.freecodecamp.org/curriculum/project-euler/counting-capacitor-circuits.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Se considerarmos $D(n)$ o número de valores de capacitância total distintos que podemos obter ao usar até $n$ capacitores de valor igual e o procedimento simples descrito acima, temos: $D(1) = 1, D(2) = 3, D(3)=7, \ldots$
|
||||||
|
|
||||||
|
Encontre $D(18)$.
|
||||||
|
|
||||||
|
Lembrete: Ao conectar os capacitores $C_1$, $C_2$ e assim por diante em paralelo, a capacitância total é $C_T = C_1 + C_2 + \cdots$, enquanto, ao conectá-los em série, a capacitância geral é dada por: $\frac{1}{C_T} = \frac{1}{C_1} + \frac{1}{C_2} + \cdots$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler155()` should return 3857447.
|
`capacitanceValues()` deve retornar `3857447`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler155(), 3857447);
|
assert.strictEqual(capacitanceValues(), 3857447);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -29,12 +35,12 @@ assert.strictEqual(euler155(), 3857447);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler155() {
|
function capacitanceValues() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler155();
|
capacitanceValues();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4091000cf542c50ff1b
|
id: 5900f4091000cf542c50ff1b
|
||||||
title: 'Problem 156: Counting Digits'
|
title: 'Problema 156: Contagem de algarismos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301787
|
forumTopicId: 301787
|
||||||
dashedName: problem-156-counting-digits
|
dashedName: problem-156-counting-digits
|
||||||
@ -8,28 +8,44 @@ dashedName: problem-156-counting-digits
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Starting from zero the natural numbers are written down in base 10 like this:
|
A partir de zero, os números naturais são escritos na base 10, assim:
|
||||||
|
|
||||||
0 1 2 3 4 5 6 7 8 9 10 11 12....
|
0 1 2 3 4 5 6 7 8 9 10 11 12....
|
||||||
|
|
||||||
Consider the digit d=1. After we write down each number n, we will update the number of ones that have occurred and call this number f(n,1). The first values for f(n,1), then, are as follows:
|
Considere o algarismo $d = 1$. Depois de anotarmos cada número, vamos atualizar o número de unidades que ocorreram e chamar esse número de $f(n, 1)$. Os primeiros valores para $f(n, 1)$, então, são os seguintes:
|
||||||
|
|
||||||
nf(n,1) 00 11 21 31 41 51 61 71 81 91 102 114 125
|
| $n$ | $f(n, 1)$ |
|
||||||
|
| --- | --------- |
|
||||||
|
| 0 | 0 |
|
||||||
|
| 1 | 1 |
|
||||||
|
| 2 | 1 |
|
||||||
|
| 3 | 1 |
|
||||||
|
| 4 | 1 |
|
||||||
|
| 5 | 1 |
|
||||||
|
| 6 | 1 |
|
||||||
|
| 7 | 1 |
|
||||||
|
| 8 | 1 |
|
||||||
|
| 9 | 1 |
|
||||||
|
| 10 | 2 |
|
||||||
|
| 11 | 4 |
|
||||||
|
| 12 | 5 |
|
||||||
|
|
||||||
Note that f(n,1) never equals 3.
|
Observe que $f(n, 1)$ nunca é igual a 3.
|
||||||
|
|
||||||
So the first two solutions of the equation f(n,1)=n are n=0 and n=1. The next solution is n=199981. In the same manner the function f(n,d) gives the total number of digits d that have been written down after the number n has been written.
|
Portanto, as duas primeiras soluções da equação $f(n, 1) = n$ são $n = 0$ e $n = 1$. A próxima solução é $n = 199981$. Da mesma forma, a função $f(n, d)$ indica o número total de algarismos d que foram anotados após o número $n$ ter sido escrito.
|
||||||
|
|
||||||
In fact, for every digit d ≠ 0, 0 is the first solution of the equation f(n,d)=n. Let s(d) be the sum of all the solutions for which f(n,d)=n.
|
De fato, para cada algarismo $d ≠ 0$, 0 é a primeira solução da equação $f(n, d) = n$. Considere $s(d)$ a soma de todas as soluções para as quais $f(n, d) = n$.
|
||||||
|
|
||||||
You are given that s(1)=22786974071. Find ∑ s(d) for 1 ≤ d ≤ 9. Note: if, for some n, f(n,d)=n for more than one value of d this value of n is counted again for every value of d for which f(n,d)=n.
|
Você é informado de que $s(1) = 22786974071$. Encontre $\sum{s(d)}$ para $1 ≤ d ≤ 9$.
|
||||||
|
|
||||||
|
Observação: se, para alguns $n$, $f(n, d) = n$ para mais de um valor de $d$ este valor de $n$ é contado novamente para cada valor de $d$ para o qual $f(n, d) = n$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler156()` should return 21295121502550.
|
`countingDigits()` deve retornar `21295121502550`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler156(), 21295121502550);
|
assert.strictEqual(countingDigits(), 21295121502550);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -37,12 +53,12 @@ assert.strictEqual(euler156(), 21295121502550);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler156() {
|
function countingDigits() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler156();
|
countingDigits();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4091000cf542c50ff1c
|
id: 5900f4091000cf542c50ff1c
|
||||||
title: 'Problem 157: Solving the diophantine equation'
|
title: 'Problema 157: Resolução da equação diofantina'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301788
|
forumTopicId: 301788
|
||||||
dashedName: problem-157-solving-the-diophantine-equation
|
dashedName: problem-157-solving-the-diophantine-equation
|
||||||
@ -8,58 +8,20 @@ dashedName: problem-157-solving-the-diophantine-equation
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Consider the diophantine equation 1/a+1/b= p/10n with a, b, p, n positive integers and a ≤ b.
|
Considere a equação diofantina $\frac{1}{a} + \frac{1}{b} = \frac{p}{{10}^n}$, sendo $a$, $b$, $p$, $n$ números inteiros positivos e $a ≤ b$.
|
||||||
|
|
||||||
For n=1 this equation has 20 solutions that are listed below:
|
Para $n = 1$, esta equação tem 20 soluções listadas abaixo:
|
||||||
|
|
||||||
1/1+1/1=20/10
|
$$\begin{array}{lllll} \frac{1}{1} + \frac{1}{1} = \frac{20}{10} & \frac{1}{1} + \frac{1}{2} = \frac{15}{10} & \frac{1}{1} + \frac{1}{5} = \frac{12}{10} & \frac{1}{1} + \frac{1}{10} = \frac{11}{10} & \frac{1}{2} + \frac{1}{2} = \frac{10}{10} \\\\ \frac{1}{2} + \frac{1}{5} = \frac{7}{10} & \frac{1}{2} + \frac{1}{10} = \frac{6}{10} & \frac{1}{3} + \frac{1}{6} = \frac{5}{10} & \frac{1}{3} + \frac{1}{15} = \frac{4}{10} & \frac{1}{4} + \frac{1}{4} = \frac{5}{10} \\\\ \frac{1}{4} + \frac{1}{4} = \frac{5}{10} & \frac{1}{5} + \frac{1}{5} = \frac{4}{10} & \frac{1}{5} + \frac{1}{10} = \frac{3}{10} & \frac{1}{6} + \frac{1}{30} = \frac{2}{10} & \frac{1}{10} + \frac{1}{10} = \frac{2}{10} \\\\ \frac{1}{11} + \frac{1}{110} = \frac{1}{10} & \frac{1}{12} + \frac{1}{60} = \frac{1}{10} & \frac{1}{14} + \frac{1}{35} = \frac{1}{10} & \frac{1}{15} + \frac{1}{30} = \frac{1}{10} & \frac{1}{20} + \frac{1}{20} = \frac{1}{10} \end{array}$$
|
||||||
|
|
||||||
1/1+1/2=15/10
|
Quantas soluções tem esta equação para $1 ≤ n ≤ 9$?
|
||||||
|
|
||||||
1/1+1/5=12/10
|
|
||||||
|
|
||||||
1/1+1/10=11/10
|
|
||||||
|
|
||||||
1/2+1/2=10/10
|
|
||||||
|
|
||||||
1/2+1/5=7/10
|
|
||||||
|
|
||||||
1/2+1/10=6/10
|
|
||||||
|
|
||||||
1/3+1/6=5/10
|
|
||||||
|
|
||||||
1/3+1/15=4/10
|
|
||||||
|
|
||||||
1/4+1/4=5/10
|
|
||||||
|
|
||||||
1/4+1/20=3/10
|
|
||||||
|
|
||||||
1/5+1/5=4/10
|
|
||||||
|
|
||||||
1/5+1/10=3/10
|
|
||||||
|
|
||||||
1/6+1/30=2/10
|
|
||||||
|
|
||||||
1/10+1/10=2/10
|
|
||||||
|
|
||||||
1/11+1/110=1/10
|
|
||||||
|
|
||||||
1/12+1/60=1/10
|
|
||||||
|
|
||||||
1/14+1/35=1/10
|
|
||||||
|
|
||||||
1/15+1/30=1/10
|
|
||||||
|
|
||||||
1/20+1/20=1/10
|
|
||||||
|
|
||||||
How many solutions has this equation for 1 ≤ n ≤ 9?
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler157()` should return 53490.
|
`diophantineEquation()` deve retornar `53490`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler157(), 53490);
|
assert.strictEqual(diophantineEquation(), 53490);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -67,12 +29,12 @@ assert.strictEqual(euler157(), 53490);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler157() {
|
function diophantineEquation() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler157();
|
diophantineEquation();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
id: 5900f40a1000cf542c50ff1d
|
id: 5900f40a1000cf542c50ff1d
|
||||||
title: >-
|
title: >-
|
||||||
Problem 158: Exploring strings for which only one character comes lexicographically after its neighbour to the left
|
Problema 158: Explorar strings para as quais apenas um caractere vem lexicograficamente após seu vizinho à esquerda
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301789
|
forumTopicId: 301789
|
||||||
dashedName: >-
|
dashedName: >-
|
||||||
@ -10,28 +10,28 @@ dashedName: >-
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Taking three different letters from the 26 letters of the alphabet, character strings of length three can be formed.
|
Levando em conta três letras diferentes das 26 letras do alfabeto, strings de comprimento três podem ser formadas.
|
||||||
|
|
||||||
Examples are 'abc', 'hat' and 'zyx'.
|
Exemplos são 'abc', 'hat' e 'zyx'.
|
||||||
|
|
||||||
When we study these three examples we see that for 'abc' two characters come lexicographically after its neighbour to the left.
|
Quando analisamos estes três exemplos, verificamos que, para "abc", dois caracteres vêm lexicograficamente depois do vizinho à esquerda.
|
||||||
|
|
||||||
For 'hat' there is exactly one character that comes lexicographically after its neighbour to the left. For 'zyx' there are zero characters that come lexicographically after its neighbour to the left.
|
Para "hat", há exatamente um caractere que vem lexicograficamente depois de seu vizinho à esquerda. Para "zyx", não há caracteres que venham lexicograficamente depois de seu vizinho à esquerda.
|
||||||
|
|
||||||
In all there are 10400 strings of length 3 for which exactly one character comes lexicographically after its neighbour to the left.
|
Ao todo, há 10.400 strings de tamanho 3 para as quais apenas um caractere vem lexicograficamente após seu vizinho à esquerda.
|
||||||
|
|
||||||
We now consider strings of n ≤ 26 different characters from the alphabet.
|
Consideremos agora strings de $n ≤ 26$ caracteres diferentes do alfabeto.
|
||||||
|
|
||||||
For every n, p(n) is the number of strings of length n for which exactly one character comes lexicographically after its neighbour to the left.
|
Para cada $n$, $p(n)$ é o número de strings de comprimento $n$ para as quais exatamente um caractere vem lexicograficamente depois de seu vizinho à esquerda.
|
||||||
|
|
||||||
What is the maximum value of p(n)?
|
Qual é o valor máximo de $p(n)$?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler158()` should return 409511334375.
|
`lexicographicNeighbours()` deve retornar `409511334375`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler158(), 409511334375);
|
assert.strictEqual(lexicographicNeighbours(), 409511334375);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -39,12 +39,12 @@ assert.strictEqual(euler158(), 409511334375);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler158() {
|
function lexicographicNeighbours() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler158();
|
lexicographicNeighbours();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f40c1000cf542c50ff1e
|
id: 5900f40c1000cf542c50ff1e
|
||||||
title: 'Problem 159: Digital root sums of factorisations'
|
title: 'Problema 159: Somas das raízes dos algarismos de fatorações'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301790
|
forumTopicId: 301790
|
||||||
dashedName: problem-159-digital-root-sums-of-factorisations
|
dashedName: problem-159-digital-root-sums-of-factorisations
|
||||||
@ -8,17 +8,33 @@ dashedName: problem-159-digital-root-sums-of-factorisations
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A composite number can be factored many different ways.
|
Um número composto pode ser fatorado de várias maneiras.
|
||||||
|
|
||||||
For instance, not including multiplication by one, 24 can be factored in 7 distinct ways:
|
Por exemplo, não incluindo a multiplicação por um, 24 podem ser fatorado de 7 formas distintas:
|
||||||
|
|
||||||
24 = 2x2x2x3 24 = 2x3x4 24 = 2x2x6 24 = 4x6 24 = 3x8 24 = 2x12 24 = 24
|
$$\begin{align} & 24 = 2 \times 2 \times 2 \times 3\\\\ & 24 = 2 \times 3 \times 4 \\\\ & 24 = 2 \times 2 \times 6 \\\\ & 24 = 4 \times 6 \\\\ & 24 = 3 \times 8 \\\\ & 24 = 2 \times 12 \\\\ & 24 = 24 \end{align}$$
|
||||||
|
|
||||||
Recall that the digital root of a number, in base 10, is found by adding together the digits of that number, and repeating that process until a number is arrived at that is less than 10. Thus the digital root of 467 is 8. We shall call a Digital Root Sum (DRS) the sum of the digital roots of the individual factors of our number. The chart below demonstrates all of the DRS values for 24. FactorisationDigital Root Sum2x2x2x3 92x3x4 92x2x6 104x6 103x8 112x12 524 6The maximum Digital Root Sum of 24 is 11. The function mdrs(n) gives the maximum Digital Root Sum of n. So mdrs(24)=11. Find ∑mdrs(n) for 1 < n < 1,000,000.
|
Lembre-se de que a raiz de algarismos de um número, na base 10, é encontrada adicionando os algarismos daquele número e repetindo esse processo até que um número chegue a menos de 10. Assim, a raiz dos algarismos de 467 é 8.
|
||||||
|
|
||||||
|
Vamos chamar a um soma da raiz dos algarismos (DRS) a soma das raízes dos algarismos dos fatores individuais do nosso número. A tabela abaixo demonstra todos os valores de DRS para 24.
|
||||||
|
|
||||||
|
| Fatoração | Soma da raiz dos algarismos |
|
||||||
|
| --------- | --------------------------- |
|
||||||
|
| 2x2x2x3 | 9 |
|
||||||
|
| 2x3x4 | 9 |
|
||||||
|
| 2x2x6 | 10 |
|
||||||
|
| 4x6 | 10 |
|
||||||
|
| 3x8 | 11 |
|
||||||
|
| 2x12 | 5 |
|
||||||
|
| 24 | 6 |
|
||||||
|
|
||||||
|
A soma da raiz dos algarismos máxima de 24 é 11. A função $mdrs(n)$ fornece a soma da raiz dos algarismos máxima de $n$. Portanto, $mdrs(24) = 11$.
|
||||||
|
|
||||||
|
Encontre $\sum{mdrs(n)}$ para $1 < n < 1.000.000$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler159()` should return 14489159.
|
`euler159()` deve retornar `14489159`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler159(), 14489159);
|
assert.strictEqual(euler159(), 14489159);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f40d1000cf542c50ff1f
|
id: 5900f40d1000cf542c50ff1f
|
||||||
title: 'Problem 160: Factorial trailing digits'
|
title: 'Problema 160: algarismos à direita do fatorial'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301794
|
forumTopicId: 301794
|
||||||
dashedName: problem-160-factorial-trailing-digits
|
dashedName: problem-160-factorial-trailing-digits
|
||||||
@ -8,24 +8,20 @@ dashedName: problem-160-factorial-trailing-digits
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
For any N, let f(N) be the last five digits before the trailing zeroes in N!.
|
Para qualquer $N$, considere $f(N)$ como os últimos cinco dígitos antes dos zeros à direita em $N!$.
|
||||||
|
|
||||||
For example,
|
Por exemplo:
|
||||||
|
|
||||||
9! = 362880 so f(9)=36288
|
$$\begin{align} & 9! = 362880 \\; \text{so} \\; f(9) = 36288 \\\\ & 10! = 3628800 \\; \text{so} \\; f(10) = 36288 \\\\ & 20! = 2432902008176640000 \\; \text{so} \\; f(20) = 17664 \end{align}$$
|
||||||
|
|
||||||
10! = 3628800 so f(10)=36288
|
Encontre $f(1.000.000.000.000)$
|
||||||
|
|
||||||
20! = 2432902008176640000 so f(20)=17664
|
|
||||||
|
|
||||||
Find f(1,000,000,000,000)
|
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler160()` should return 16576.
|
`factorialTrailingDigits()` deve retornar `16576`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler160(), 16576);
|
assert.strictEqual(factorialTrailingDigits(), 16576);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -33,12 +29,12 @@ assert.strictEqual(euler160(), 16576);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler160() {
|
function factorialTrailingDigits() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler160();
|
factorialTrailingDigits();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f40d1000cf542c50ff20
|
id: 5900f40d1000cf542c50ff20
|
||||||
title: 'Problem 161: Triominoes'
|
title: 'Problema 161: Triominos'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301795
|
forumTopicId: 301795
|
||||||
dashedName: problem-161-triominoes
|
dashedName: problem-161-triominoes
|
||||||
@ -8,22 +8,28 @@ dashedName: problem-161-triominoes
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
A triomino is a shape consisting of three squares joined via the edges.
|
Um triomino é uma forma que consiste de três quadrados unidos pelas bordas.
|
||||||
|
|
||||||
There are two basic forms:
|
Existem duas formas básicas:
|
||||||
|
|
||||||
If all possible orientations are taken into account there are six:
|
<img class="img-responsive center-block" alt="duas formas básicas de triominos" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-1.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
Any n by m grid for which nxm is divisible by 3 can be tiled with triominoes. If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes:
|
Se todas as orientações possíveis forem levadas em conta, existem seis:
|
||||||
|
|
||||||
In how many ways can a 9 by 12 grid be tiled in this way by triominoes?
|
<img class="img-responsive center-block" alt="formas de triominos incluindo orientação" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-2.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Qualquer grid n por m para qual n * m é divisível por 3 pode ser preenchido por triominos. Se considerarmos que os agrupamentos que podem ser obtidos por reflexão ou rotação de outro agrupamento diferente, existem 41 maneiras de um grid de 2 por 9 ser completado por triominos:
|
||||||
|
|
||||||
|
<img class="img-responsive center-block" alt="animação mostrando 41 maneiras de preencher a grade 2x9 com triominos" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-3.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
De quantas maneiras um grid 9 por 12 pode ser encaixados dessa forma por triominos?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler161()` should return 20574308184277972.
|
`triominoes()` deve retornar `20574308184277972`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler161(), 20574308184277972);
|
assert.strictEqual(triominoes(), 20574308184277972);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -31,12 +37,12 @@ assert.strictEqual(euler161(), 20574308184277972);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler161() {
|
function triominoes() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler161();
|
triominoes();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
id: 5900f40f1000cf542c50ff22
|
id: 5900f40f1000cf542c50ff22
|
||||||
title: 'Problem 163: Cross-hatched triangles'
|
title: 'Problema 163: Triângulos cruzados'
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301797
|
forumTopicId: 301797
|
||||||
dashedName: problem-163-cross-hatched-triangles
|
dashedName: problem-163-cross-hatched-triangles
|
||||||
@ -8,16 +8,26 @@ dashedName: problem-163-cross-hatched-triangles
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
Consider an equilateral triangle in which straight lines are drawn from each vertex to the middle of the opposite side, such as in the size 1 triangle in the sketch below.
|
Considere um triângulo equilátero em que linhas retas são desenhadas a partir de cada vértice até o meio do lado oposto, como no triângulo de tamanho 1 no esboço abaixo.
|
||||||
|
|
||||||
Sixteen triangles of either different shape or size or orientation or location can now be observed in that triangle. Using size 1 triangles as building blocks, larger triangles can be formed, such as the size 2 triangle in the above sketch. One-hundred and four triangles of either different shape or size or orientation or location can now be observed in that size 2 triangle. It can be observed that the size 2 triangle contains 4 size 1 triangle building blocks. A size 3 triangle would contain 9 size 1 triangle building blocks and a size n triangle would thus contain n2 size 1 triangle building blocks. If we denote T(n) as the number of triangles present in a triangle of size n, then T(1) = 16 T(2) = 104 Find T(36).
|
<img class="img-responsive center-block" alt="triângulos de tamanho 1 e tamanho 2" src="https://cdn.freecodecamp.org/curriculum/project-euler/cross-hatched-triangles.gif" style="background-color: white; padding: 10px;" />
|
||||||
|
|
||||||
|
Agora, nesse triângulo, podem ser observados dezesseis triângulos de forma, tamanho, orientação ou localização diferentes. Usando o triângulos de tamanho 1 como blocos de construção, triângulos maiores podem ser formados, como o de tamanho 2 no esboço acima. Agora, nesse triângulo de lado 2, podem ser observados 104 triângulos de forma, tamanho, orientação ou localização diferentes.
|
||||||
|
|
||||||
|
É possível observar que o triângulo de tamanho 2 contém como blocos de construção 4 triângulos de tamanho 1. Um triângulo de tamanho 3 contém 9 blocos de construção de triângulos de tamanho 1, e um triângulo de tamanho $n$ teria, portanto, $n^2$ blocos de construção de triângulos de tamanho 1.
|
||||||
|
|
||||||
|
Se quisermos indicar que $T(n)$ é o número de triângulos presentes em um triângulo de tamanho $n$, então
|
||||||
|
|
||||||
|
$$\begin{align} & T(1) = 16 \\\\ & T(2) = 104 \end{align}$$
|
||||||
|
|
||||||
|
Encontre $T(36)$.
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler163()` should return 343047.
|
`crossHatchedTriangles()` deve retornar `343047`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler163(), 343047);
|
assert.strictEqual(crossHatchedTriangles(), 343047);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -25,12 +35,12 @@ assert.strictEqual(euler163(), 343047);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler163() {
|
function crossHatchedTriangles() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler163();
|
crossHatchedTriangles();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
id: 5900f4111000cf542c50ff23
|
id: 5900f4111000cf542c50ff23
|
||||||
title: >-
|
title: >-
|
||||||
Problem 164: Numbers for which no three consecutive digits have a sum greater than a given value
|
Problema 164: Números para os quais nenhuma sequência de três algarismos consecutivos têm uma soma maior que um determinado valor
|
||||||
challengeType: 5
|
challengeType: 5
|
||||||
forumTopicId: 301798
|
forumTopicId: 301798
|
||||||
dashedName: >-
|
dashedName: >-
|
||||||
@ -10,14 +10,14 @@ dashedName: >-
|
|||||||
|
|
||||||
# --description--
|
# --description--
|
||||||
|
|
||||||
How many 20 digit numbers n (without any leading zero) exist such that no three consecutive digits of n have a sum greater than 9?
|
Quantos números de 20 algarismos $n$ (sem zeros à esquerda) existem, de modo que não haja três algarismos consecutivos de $n$ com uma soma maior que 9?
|
||||||
|
|
||||||
# --hints--
|
# --hints--
|
||||||
|
|
||||||
`euler164()` should return 378158756814587.
|
`consecutiveDigitsSum()` deve retornar `378158756814587`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
assert.strictEqual(euler164(), 378158756814587);
|
assert.strictEqual(consecutiveDigitsSum(), 378158756814587);
|
||||||
```
|
```
|
||||||
|
|
||||||
# --seed--
|
# --seed--
|
||||||
@ -25,12 +25,12 @@ assert.strictEqual(euler164(), 378158756814587);
|
|||||||
## --seed-contents--
|
## --seed-contents--
|
||||||
|
|
||||||
```js
|
```js
|
||||||
function euler164() {
|
function consecutiveDigitsSum() {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
euler164();
|
consecutiveDigitsSum();
|
||||||
```
|
```
|
||||||
|
|
||||||
# --solutions--
|
# --solutions--
|
||||||
|
Reference in New Issue
Block a user