chore(i18n,curriculum): update translations (#44199)
This commit is contained in:
@ -12,7 +12,7 @@ Chamaremos uma fração que não pode ser anulada de uma fração resiliente.
|
||||
|
||||
Além disso, definiremos a resiliência de um denominador, $R(d)$, como a razão entre suas frações adequadas que são resilientes; por exemplo, $R(12) = \frac{4}{11}$.
|
||||
|
||||
A resiliência de um número $d > 1$ é então $\frac{φ(d)}{d − 1}$, onde $φ$ é a função tociente de Euler.
|
||||
A resiliência de um número $d > 1$ é então $\frac{φ(d)}{d − 1}$, onde $φ$ é a função totiente de Euler.
|
||||
|
||||
Também definiremos a corresiliência de um número $n > 1$ como $C(n) = \frac{n − φ(n)}{n − 1}$.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4651000cf542c50ff77
|
||||
title: 'Problema 248: Números para os quais a função tociente de Euler é igual a 13!'
|
||||
title: 'Problema 248: Números para os quais a função totiente de Euler é igual a 13!'
|
||||
challengeType: 5
|
||||
forumTopicId: 301895
|
||||
dashedName: problem-248-numbers-for-which-eulers-totient-function-equals-13
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f48f1000cf542c50ffa2
|
||||
title: 'Problem 291: Panaitopol Primes'
|
||||
title: 'Problema 291: Números primos de 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.
|
||||
Um número primo $p$ é chamado de primo de Panaitopol se $p = \frac{x^4 - y^4}{x^3 + y^3}$ para alguns inteiros positivos $x$ e $y$.
|
||||
|
||||
Find how many Panaitopol primes are less than 5×1015.
|
||||
Encontre quantos primos de Panaitopol são menores que $5 × {10}^{15}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler291()` should return 4037526.
|
||||
`panaitopolPrimes()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4911000cf542c50ffa3
|
||||
title: 'Problem 292: Pythagorean Polygons'
|
||||
title: 'Problema 292: Polígonos de Pitágoras'
|
||||
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,
|
||||
Definiremos um polígono pitagórico como ser um polígono convexo com as seguintes propriedades:
|
||||
|
||||
no three vertices are aligned,
|
||||
- existem pelo menos três vértices,
|
||||
- não há três vértices alinhados,
|
||||
- cada vértice tem coordenadas inteiras,
|
||||
- cada aresta tem comprimento inteiro.
|
||||
|
||||
each vertex has integer coordinates,
|
||||
Para um número inteiro determinado $n$, defina $P(n)$ como o número de polígonos pitagóricos distintos para os quais o perímetro é $≤ 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.
|
||||
Os polígonos pitagóricos devem ser considerados distintos, desde que um não seja uma tradução de outro.
|
||||
|
||||
Pythagorean polygons should be considered distinct as long as none is a translation of another.
|
||||
Você é informado de que $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).
|
||||
Encontre $P(120)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler292()` should return 3600060866.
|
||||
`pythagoreanPolygons()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4931000cf542c50ffa4
|
||||
title: 'Problem 293: Pseudo-Fortunate Numbers'
|
||||
title: 'Problema 293: Pseudonúmeros da sorte'
|
||||
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.
|
||||
Um número inteiro positivo e par $N$ será chamado de admissível se for uma potência de 2 ou seus fatores primos distintos forem número primos consecutivos.
|
||||
|
||||
The first twelve admissible numbers are 2,4,6,8,12,16,18,24,30,32,36,48.
|
||||
Os primeiros doze números admissíveis são 2, 4, 6, 8, 12, 16, 18, 24, 30, 32, 36 e 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$ for admissível, o menor inteiro $M > 1$ tal que $N + M$ é um número primo, será chamado de pseudonúmero da sorte para $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.
|
||||
Por exemplo, $N = 630$ é admissível, pois é par e seus fatores primos distintos são os números primos consecutivos 2, 3, 5 e 7. O próximo número primo depois de 631 é 641; portanto, o pseudonúmero da sorte para 630 é $M = 11$. Também se pode ver que o pseudonúmero da sorte para 16 é 3.
|
||||
|
||||
Find the sum of all distinct pseudo-Fortunate numbers for admissible numbers N less than 109.
|
||||
Encontre a soma de todos os pseudonúmeros da sorte distintos para números admissíveis $N$ inferiores a ${10}^9$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler293()` should return 2209.
|
||||
`pseudoFortunateNumbers()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4931000cf542c50ffa5
|
||||
title: 'Problem 294: Sum of digits - experience #23'
|
||||
title: 'Problema 294: Soma dos algarismos - experiência nº 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.
|
||||
Para um número inteiro positivo $k$, defina $d(k)$ como a soma dos algarismos de $k$ em sua representação decimal normal. Portanto, $d(42) = 4 + 2 = 6$.
|
||||
|
||||
Thus d(42) = 4+2 = 6.
|
||||
Para um número inteiro positivo $n$, defina $S(n)$ como a quantidade de número inteiros positivos $k < {10}^n$ com as seguintes propriedades:
|
||||
|
||||
For a positive integer n, define S(n) as the number of positive integers k < 10n with the following properties : k is divisible by 23 and d(k) = 23.
|
||||
- $k$ é divisível por 23 e,
|
||||
- $d(k) = 23$.
|
||||
|
||||
You are given that S(9) = 263626 and S(42) = 6377168878570056.
|
||||
Você é informado de que $S(9) = 263.626$ e $S(42) = 6.377.168.878.570.056$.
|
||||
|
||||
Find S(1112) and give your answer mod 109.
|
||||
Encontre $S({11}^{12})$ e dê sua resposta $\bmod {10}^9$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler294()` should return 789184709.
|
||||
`experience23()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4931000cf542c50ffa6
|
||||
title: 'Problem 295: Lenticular holes'
|
||||
title: 'Problema 295: Orifícios lenticulares'
|
||||
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:
|
||||
Chamamos a área convexa criada no cruzamento de dois círculos de um orifício lenticular se:
|
||||
|
||||
The centres of both circles are on lattice points.
|
||||
- Os centros de ambos os círculos estão em pontos da rede.
|
||||
- Os dois círculos se cruzam em dois pontos de da rede distintos.
|
||||
- O interior da área convexa criada pelos dois os círculos não contém pontos da rede.
|
||||
|
||||
The two circles intersect at two distinct lattice points.
|
||||
Considere os círculos:
|
||||
|
||||
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
|
||||
Os círculos $C_0$, $C_1$ e $C_2$ estão desenhados na imagem abaixo.
|
||||
|
||||
The circles C0, C1 and C2 are drawn in the picture below.
|
||||
<img class="img-responsive center-block" alt="círculos 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$ formam um orifício lenticular, assim como $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.
|
||||
Chamamos de par ordenado de números reais positivos ($r_1$, $r_2$) um par lenticular se existirem dois círculos com raio $r_1$ e $r_2$ que formem um orifício lenticular. Podemos verificar que ($1$, $5$) e ($5$, $\sqrt{65}$) são os pares lenticulares do exemplo acima.
|
||||
|
||||
Let L(N) be the number of distinct lenticular pairs (r1, r2) for which 0 < r1 ≤ r2 ≤ N. We can verify that L(10) = 30 and L(100) = 3442.
|
||||
Considere $L(N)$ como o número de pares lenticulares distintos ($r_1$, $r_2$) para os quais $0 < r_1 ≤ r_2 ≤ N$. Podemos verificar que $L(10) = 30$ e $L(100) = 3442$.
|
||||
|
||||
Find L(100 000).
|
||||
Encontre $L(100.000)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler295()` should return 4884650818.
|
||||
`lenticularHoles()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4941000cf542c50ffa7
|
||||
title: 'Problem 296: Angular Bisector and Tangent'
|
||||
title: 'Problema 296: Bissetor angular 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.
|
||||
Você recebe um triângulo com o comprimento dos lados de números inteiros $ABC$ com os lados $BC ≤ AC ≤ AB$. $k$ é o bissetor angular do ângulo $ACB$. $m$ é a tangente em $C$ ao círculo circunscrito de $ABC$. $n$ é uma linha paralela a $m$ através de $B$.
|
||||
|
||||
The intersection of n and k is called E.
|
||||
A interseção entre $n$ e $k$ é chamada de $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="triângulo ABC, com k - bissetor angular do ângulo ACB, m - tangente no ponto C, n - linha paralela a m através do ponto B e do ponto E - interseção entre k e n" src="https://cdn.freecodecamp.org/curriculum/project-euler/angular-bisector-and-tangent.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Quantos triângulos $ABC$ com um perímetro não excedendo $100.000$ existem de tal forma que $BE$ tem como comprimento um número inteiro?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler296()` should return 1137208419.
|
||||
`angularBisectorAndTangent()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4951000cf542c50ffa8
|
||||
title: 'Problem 297: Zeckendorf Representation'
|
||||
title: 'Problema 297: Representação de 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.
|
||||
Cada novo número na sequência de Fibonacci é gerado pela soma dos dois números anteriores.
|
||||
|
||||
Starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.
|
||||
Começando com 1 e 2, os primeiros 10 termos serão: 1, 2, 3, 5, 8, 13, 21, 34, 55 e 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.
|
||||
Cada número inteiro positivo pode ser escrito exclusivamente como uma soma de termos não consecutivos da sequência de Fibonacci. Por exemplo, 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<n<106, ∑ z(n) = 7894453.
|
||||
Tal soma se chama a representação de Zeckendorf do número.
|
||||
|
||||
Find ∑ z(n) for 0<n<1017.
|
||||
Para qualquer número inteiro $n>0$, considere $z(n)$ como o número de termos na representação de Zeckendorf de $n$.
|
||||
|
||||
Assim, $z(5) = 1$, $z(14) = 2$, $z(100) = 3$ etc.
|
||||
|
||||
Além disso, para $0 < n < {10}^6$, $\sum z(n) = 7.894.453$.
|
||||
|
||||
Encontre $\sum z(n)$ para $0 < n < {10}^{17}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler297()` should return 2252639041804718000.
|
||||
`zeckendorfRepresentation()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4971000cf542c50ffa9
|
||||
title: 'Problem 298: Selective Amnesia'
|
||||
title: 'Problema 298: Amnésia seletiva'
|
||||
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 jogam um jogo de memória envolvendo uma sequência de números aleatórios entre 1 e 10, que são chamado um a cada turno. Cada jogador pode se lembrar de até 5 números anteriores. Quando o número chamado estiver na memória de um jogador, este jogador recebe um ponto. Caso contrário, o jogador adiciona o número chamado à memória, removendo outro número se a memória estiver cheia.
|
||||
|
||||
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.
|
||||
Os dois jogadores começam com as memórias vazias. Os dois jogadores sempre adicionam novos números perdidos à sua memória, mas usam uma estratégia diferente para decidir qual número remover: a estratégia de Larry é remover o número que não foi chamado há mais tempo. A estratégia de Robin é remover o número que esteve na memória por mais tempo.
|
||||
|
||||
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
|
||||
Jogo de exemplo:
|
||||
|
||||
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 | Número chamado | Memória de Larry | Pontuação de Larry | Memória de Robin | Pontuação de 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 |
|
||||
|
||||
Chamando a pontuação de Larry de $L$ e a pontuação do Robin de $R$, qual é o valor esperado de $|L - R|$ após 50 turnos? Arredonde sua resposta para até oito casas decimais usando o formato x.xxxxxxxx.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler298()` should return 1.76882294.
|
||||
`selectiveAmnesia()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4971000cf542c50ffaa
|
||||
title: 'Problem 299: Three similar triangles'
|
||||
title: 'Problema 299: Três triângulos similares'
|
||||
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),
|
||||
Quatro pontos com coordenadas em números inteiros são selecionadas:
|
||||
|
||||
with 0 < a < b and 0 < c < d.
|
||||
$A(a, 0)$, $B(b, 0)$, $C(0, c)$ e $D(0, d)$, com $0 < a < b$ and $0 < c < 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.
|
||||
O ponto $P$, também com coordenadas em número inteiros, é escolhido na linha $AC$ de modo que os três triângulos, $ABP$, $CDP$ e $BDP$, são todos similares.
|
||||
|
||||
It is easy to prove that the three triangles can be similar, only if a=c.
|
||||
<img class="img-responsive center-block" alt="pontos A, B, C, D e P criando três triângulos: 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.
|
||||
É fácil provar que os três triângulos podem ser similares apenas 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.
|
||||
Então, dado que $a = c$, estamos procurando por trios ($a$, $b$, $d$), de modo que pelo menos um ponto $P$ (com coordenadas em números inteiros) existe em $AC$, tornando todos os três triângulos $ABP$, $CDP$ e $BDP$ similares.
|
||||
|
||||
If b+d < 100, there are 92 distinct triplets (a,b,d) such that point P exists. If b+d < 100 000, there are 320471 distinct triplets (a,b,d) such that point P exists. If b+d < 100 000 000, how many distinct triplets (a,b,d) are there such that point P exists?
|
||||
Por exemplo, se $(a, b, d) = (2, 3, 4)$, pode ser facilmente verificado que o ponto $P(1, 1)$ satisfaz a condição acima. Observe que os trios (2,3,4) e (2,4,3) são considerados distintos, embora o ponto $P(1, 1)$ seja comum para ambos.
|
||||
|
||||
Se $b + d < 100$, existem 92 trios distintos ($a$, $b$, $d$) de modo que o ponto $P$ exista.
|
||||
|
||||
Se $b + d < 100.000$, existem 320471 trios distintos ($a$, $b$, $d$) de modo que o ponto $P$ exista.
|
||||
|
||||
Se $b + d < 100.000.000$, quantos trios distintos ($a$, $b$, $d$) existem de modo que o ponto $P$ exista?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler299()` should return 549936643.
|
||||
`threeSimilarTriangles()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f49a1000cf542c50ffac
|
||||
title: 'Problem 300: Protein folding'
|
||||
title: 'Problema 300: Enovelamento de proteínas'
|
||||
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.
|
||||
De maneiras muito simplificada, podemos considerar as proteínas como strings consistindo em elementos hidrofóbicos (H) e polares (P), por exemplo, 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.
|
||||
Para este problema, a orientação de uma proteína é importante; por exemplo, HPP é considerado diferente de PPH. Portanto, existem $2^n$ proteínas distintas compostas por $n$ elementos.
|
||||
|
||||
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 alguém encontra essas strings na natureza, elas estão sempre enoveladas de modo que o número de pontos de contato de H-H é tão grande quanto possível, pois isso é energeticamente vantajoso.
|
||||
|
||||
The figure below shows two possible ways that our example protein could be folded (H-H contact points are shown with red dots).
|
||||
Como resultado, os elementos H tendem a se acumular na parte interna, com os elementos P ficando do lado de fora.
|
||||
|
||||
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.
|
||||
As proteínas naturais são enoveladas em três dimensões, é claro, mas só vamos considerar um enovelamento proteico em <u>duas dimensões</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.
|
||||
A figura abaixo mostra duas maneiras possíveis de o nosso exemplo de proteína poder ser enovelado (pontos de contato H-H são mostrados como pontos vermelhos).
|
||||
|
||||
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="duas maneiras possíveis de exemplo de enovelamento de proteínas" src="https://cdn.freecodecamp.org/curriculum/project-euler/protein-folding.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
O enovelamento da esquerda tem apenas seis pontos de contato H-H e, por isso, nunca ocorreria naturalmente. Por outro lado, o enovelamento à direita tem nove pontos de contato H-H, o que é ideal para esta string.
|
||||
|
||||
Assumindo que os elementos H e P têm igual probabilidade de ocorrer em qualquer posição ao longo da string, o número médio de pontos de contato de H-H em um enovelamento ideal de uma string de proteína aleatória de comprimento 8 acaba sendo $\frac{850}{2^8} = 3.3203125$.
|
||||
|
||||
Qual é o número médio de pontos de contato de H-H em um enovelamento ideal de uma string de proteína aleatória de comprimento 15? Dê sua resposta usando tantas casas decimais quantas for necessário para um resultado exato.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler300()` should return 8.0540771484375.
|
||||
`proteinFolding()` deve retornar `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--
|
||||
|
@ -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 é um jogo jogado com pilhas de pedras, onde dois jogadores, cada um em seu turno, removem um número de pedras qualquer de alguma das pilhas até que nenhuma pedra permaneça.
|
||||
|
||||
We'll consider the three-heap normal-play version of Nim, which works as follows:
|
||||
Vamos considerar a versão normal de jogo do Nim, com três pilhas, que funciona da seguinte forma:
|
||||
|
||||
- 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.
|
||||
- No início do jogo, há três pilhas de pedras.
|
||||
- Em sua vez, o jogador remove qualquer número positivo de pedras de qualquer pilha.
|
||||
- O primeiro jogador que não puder fazer movimentos (por não haver pedras sobrando) 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 uma posição do Nim composta por pilhas de tamanho $n_1$, $n_2$ e $n_3$, há uma função simples $X(n_1,n_2, _3)$ — que você pode procurar ou tentar deduzir por conta própria — que retorna:
|
||||
|
||||
- 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, com estratégia perfeita, o jogador que está prestes a fazer seu movimento perder; ou
|
||||
- diferente de zero se, com a estratégia perfeita, o jogador que está prestes a fazer seu movimento vencer.
|
||||
|
||||
For how many positive integers n ≤ 230 does X(n,2n,3n) = 0 ?
|
||||
Por exemplo $X(1, 2, 3) = 0$ porque, independentemente do jogador atual, o oponente dele pode responder com um movimento que deixa duas pilhas de tamanho igual, ponto em que qualquer movimento do jogador atual pode ser espelhado por seu oponente até que nenhuma pedra permaneça e o jogador atual perca. Para ilustrar:
|
||||
|
||||
- o jogador atual deixa (1,2,1) nas pilhas
|
||||
- oponente deixa (1,0,1)
|
||||
- o jogador atual deixa (0,0,1) nas pilhas
|
||||
- o oponente deixa (0,0,0) e ganha.
|
||||
|
||||
Para quantos números inteiros positivos $n ≤ 2^{30}$ temos que $X(n, 2n, 3n) = 0$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler301()` should return 2178309.
|
||||
`nim()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f49b1000cf542c50ffad
|
||||
title: 'Problem 302: Strong Achilles Numbers'
|
||||
title: 'Problema 302: Números de Aquiles fortes'
|
||||
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.
|
||||
Um número inteiro positivo $n$ é poderoso se $p^2$ é um divisor de $n$ para cada fator primo $p$ em $n$.
|
||||
|
||||
A positive integer n is a perfect power if n can be expressed as a power of another positive integer.
|
||||
Um número inteiro positivo $n$ é uma potência perfeita se $n$ puder ser expresso como uma potência de outro número inteiro 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.
|
||||
Um número inteiro positivo $n$ é um número de Aquiles se $n$ for poderoso mas não for uma potência perfeita. Por exemplo, 864 e 1800 são números de Aquiles: $864 = 2^5 \times 3^3$ e $1800 = 2^3 \times 3^2 \times 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.
|
||||
Vamos chamar um número inteiro positivo $S$ de número de Aquiles forte se $S$ e $φ(S)$ forem números de Aquiles. $φ$ é a função totiente de Euler.
|
||||
|
||||
There are 7 Strong Achilles numbers below 104 and 656 below 108.
|
||||
Por exemplo, 864 é um número de Aquiles forte: $φ(864) = 288 = 2^5 \times 3^2$. No entanto, 1800 não é um número de Aquiles forte porque: $φ(1800) = 480 = 2^5 \times 3^1 \times 5^1$.
|
||||
|
||||
How many Strong Achilles numbers are there below 1018?
|
||||
Há 7 números de Aquiles fortes abaixo de ${10}^4$ e 656 abaixo de ${10}^8$.
|
||||
|
||||
1 φ denotes Euler's totient function.
|
||||
Quantos números de Aquiles fortes existem abaixo de ${10}^{18}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler302()` should return 1170060.
|
||||
`strongAchillesNumbers()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f49b1000cf542c50ffae
|
||||
title: 'Problem 303: Multiples with small digits'
|
||||
title: 'Problema 303: Múltiplos com algarismos pequenos'
|
||||
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.
|
||||
Para um número inteiro positivo $n$, defina $f(n)$ como o menor múltiplo positivo de $n$ que, escrito na base 10, usa apenas algarismos $≤ 2$.
|
||||
|
||||
Thus f(2)=2, f(3)=12, f(7)=21, f(42)=210, f(89)=1121222.
|
||||
Assim $f(2) = 2$, $f(3) = 12$, $f(7) = 21$, $f(42) = 210$, $f(89) = 1.121.222$.
|
||||
|
||||
Also, .
|
||||
Além disso, $\displaystyle\sum_{n = 1}^{100} \frac{f(n)}{n} = 11.363.107$.
|
||||
|
||||
Find .
|
||||
Encontre $\displaystyle\sum_{n = 1}^{10.000} \frac{f(n)}{n}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler303()` should return 1111981904675169.
|
||||
`multiplesWithSmallDigits()` deve retornar `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--
|
||||
|
@ -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.
|
||||
Para qualquer número inteiro positivo $n$, a função $\text{next_prime}(n)$ retorna o menor número primo $p$, tal que $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.
|
||||
A sequência $a(n)$ é definida por: $a(1) = \text{next_prime}({10}^{14})$ e $a(n) = \text{next_prime}(a(n - 1))$ para $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.
|
||||
A sequência de Fibonacci $f(n)$ é definida por: $f(0) = 0$, $f(1) = 1$ e $f(n) = f(n - 1) + f(n - 2)$ para $n > 1$.
|
||||
|
||||
The sequence b(n) is defined as f(a(n)).
|
||||
A sequência $b(n)$ é definida como $f(a(n))$.
|
||||
|
||||
Find ∑b(n) for 1≤n≤100 000. Give your answer mod 1234567891011.
|
||||
Encontre $\sum b(n)$ para $1≤n≤100.000$. Dê a sua resposta $\bmod 1.234.567.891.011$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler304()` should return 283988410192.
|
||||
`primonacci()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f49d1000cf542c50ffb0
|
||||
title: 'Problem 305: Reflexive Position'
|
||||
title: 'Problema 305: Posição reflexiva'
|
||||
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.
|
||||
Vamos chamar de $S$ a string (infinita) que é feita concatenando os números inteiros positivos consecutivos (começando de 1) escrita na base 10.
|
||||
|
||||
Thus, S = 1234567891011121314151617181920212223242...
|
||||
Assim, $S = 1234567891011121314151617181920212223242\ldots$
|
||||
|
||||
It's easy to see that any number will show up an infinite number of times in S.
|
||||
É fácil ver que qualquer número vai aparecer um número infinito de vezes em $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.
|
||||
Vamos chamar de $f(n)$ na posição inicial da $n^{\text{-ésima}}$ ocorrência de $n$ em $S$. Por exemplo, $f(1) = 1$, $f(5) = 81$, $f(12) = 271$ e $f(7780) = 111.111.365$.
|
||||
|
||||
Find ∑f(3k) for 1≤k≤13.
|
||||
Encontre $\sum f(3^k) para 1 ≤ k ≤ 13$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler305()` should return 18174995535140.
|
||||
`reflexivePosition()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f49f1000cf542c50ffb1
|
||||
title: 'Problem 306: Paper-strip Game'
|
||||
title: 'Problema 306: Jogo das tiras de papel'
|
||||
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:
|
||||
O jogo a seguir é um exemplo clássico da Teoria Combinatória de Jogos:
|
||||
|
||||
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.
|
||||
Dois jogadores começam com uma tira de papel com $n$ quadrados brancos e eles revezam turnos. Em cada turno, um jogador escolhe dois quadrados brancos vizinhos e os pinta de preto. O primeiro jogador que não puder fazer um movimento 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$: Sem movimentos válidos, então o primeiro jogador perde automaticamente.
|
||||
- $n = 2$: Apenas um movimento válido, após o qual o segundo jogador perde.
|
||||
- $n = 3$: Dois movimentos válidos, mas ambos deixam uma situação na qual o segundo jogador perde.
|
||||
- $n = 4$: Há três movimentos válidos para o primeiro jogador; ele é capaz de vencer o jogo pintando os dois quadrados do meio.
|
||||
- $n = 5$: Quatro movimentos válidos para o primeiro jogador (mostrado abaixo em vermelho); mas não importa o que o jogador faça, o segundo jogador (azul) ganha.
|
||||
|
||||
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="movimentos iniciais válidos para uma tira com 5 quadrados" 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?
|
||||
Então, para $1 ≤ n ≤ 5$, há 3 valores de $n$ para os quais o primeiro jogador pode forçar uma vitória.
|
||||
|
||||
Da mesma forma, para $1 ≤ n ≤ 50$, há 40 valores de $n$ para os quais o primeiro jogador pode forçar uma vitória.
|
||||
|
||||
Para $1 ≤ n ≤ 1.000.000$, quantos valores de $n$ existem para os quais o primeiro jogador pode forçar uma vitória?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler306()` should return 852938.
|
||||
`paperStripGame()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a01000cf542c50ffb2
|
||||
title: 'Problem 307: Chip Defects'
|
||||
title: 'Problema 307: Defeitos do chip'
|
||||
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$ defeitos são distribuídos aleatoriamente entre $n$ chips de circuito integrado produzidos por uma fábrica (qualquer número de defeitos pode ser encontrado em um chip e cada defeito é independente dos outros defeitos).
|
||||
|
||||
Let p(k,n) represent the probability that there is a chip with at least 3 defects. For instance p(3,7) ≈ 0.0204081633.
|
||||
Considere $p(k,n)$ como representando a probabilidade de haver um chip com pelo menos 3 defeitos. Por exemplo, $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
|
||||
Encontre $p(20.000, 1.000.000)$ e dê a sua resposta arredondada para 10 casas decimais na forma 0.abcdefghij
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler307()` should return 0.7311720251.
|
||||
`chipDefects()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a11000cf542c50ffb3
|
||||
title: 'Problem 308: An amazing Prime-generating Automaton'
|
||||
title: 'Problema 308: Um incrível autômato gerador de números primos'
|
||||
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.
|
||||
Um programa escrito na linguagem de programação Fractran consiste em uma lista de frações.
|
||||
|
||||
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.
|
||||
O estado interno da Máquina Virtual do Fractran é um número inteiro positivo, que é inicialmente definido como um valor de seed. Cada iteração de um programa em Fractran multiplica o inteiro do estado pela primeira fração da lista que o tornará um número inteiro.
|
||||
|
||||
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, ...
|
||||
Por exemplo, um dos programas em Fractran que John Horton Conway escreveu para a geração de números primos consiste nas seguintes 14 frações:
|
||||
|
||||
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 ?
|
||||
Começando pela seed do número inteiro 2, as iterações sucessivas do programa produzem a sequência:
|
||||
|
||||
$$15, 825, 725, 1925, 2275, 425, \ldots, 68, \mathbf{4}, 30, \ldots, 136, \mathbf{8}, 60, \ldots, 544, \mathbf{32}, 240, \ldots$$
|
||||
|
||||
As potências de 2 que aparecem nessa sequência são $2^2, 2^3, 2^5, \ldots$.
|
||||
|
||||
É possível mostrar que todas as potências de 2 nesta sequência têm expoentes de números primos e que todos os números primos aparecem como expoentes de potência 2, em uma ordem adequada!
|
||||
|
||||
Se alguém usar o programa em Fractran acima para resolver o problema 7 do Projeto Euler (encontrar o ${10001}^{\text{o}}$ número primo), quantas iterações seriam necessárias até o programa produzir o $2^{10001^{\text{o}}\text{ número primo}}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler308()` should return 1539669807660924.
|
||||
`primeGeneratingAutomation()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a11000cf542c50ffb4
|
||||
title: 'Problem 309: Integer Ladders'
|
||||
title: 'Problema 309: Escadas de números inteiros'
|
||||
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).
|
||||
No problema clássico das "escadas cruzadas", temos os comprimentos $x$ e $y$ de duas escadas colocadas contra paredes opostas de uma rua nivelada e estreita. Também somos informados da altura $h$ acima da rua onde as duas escadas se cruzam e nos é pedido para encontrar a largura da rua ($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="escadas x e y, se cruzando na altura h, colocadas contra as paredes opostas da rua de largura 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 < x < y < 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).
|
||||
Aqui, estamos preocupados apenas com instâncias em que as quatro variáveis são números inteiros positivos. Por exemplo, se $x = 70$, $y = 119$ e $h = 30$, podemos calcular que $w = 56$.
|
||||
|
||||
For integer values x, y, h and 0 < x < y < 1 000 000, how many triplets (x,y,h) produce integer solutions for w?
|
||||
De fato, para valores inteiros $x$, $y$, $h$ e $0 < x < y < 200$, há apenas cinco trios ($x$, $y$, $h$) que produzem soluções em números inteiros para $w$: (70, 119, 30), (74, 182, 21), (87, 105, 35), (100, 116, 35) e (119, 175, 40).
|
||||
|
||||
Para os valores inteiros $x$, $y$, $h$ e $0 < x < y < 1.000.000$, quantos trios ($x$, $y$, $h$) produzem soluções com números inteiros para $w$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler309()` should return 210139.
|
||||
`integerLadders()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a21000cf542c50ffb5
|
||||
title: 'Problem 310: Nim Square'
|
||||
title: 'Problema 310: Nim quadrado'
|
||||
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 jogam o jogo Nim quadrado.
|
||||
|
||||
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 quadrado é como o jogo de três pilhas de pedras comum (o Nim), mas os jogadores só podem remover um número quadrado de pedras de um pilha.
|
||||
|
||||
The number of stones in the three heaps is represented by the ordered triple (a,b,c).
|
||||
O número de pedras nas três pilhas é representado pelo trio ordenado ($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$, o número de posições de derrota para o segundo jogador é 1160.
|
||||
|
||||
Find the number of losing positions for the next player if 0≤a≤b≤c≤100 000.
|
||||
Encontre o número de posições de derrota para o segundo jogador se $0 ≤ a ≤ b ≤ c ≤ 100.000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler310()` should return 2586528661783.
|
||||
`nimSquare()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a31000cf542c50ffb6
|
||||
title: 'Problem 311: Biclinic Integral Quadrilaterals'
|
||||
title: 'Problema 311: Quadriláteros inteiros biclínicos'
|
||||
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 < BC < CD < AD.
|
||||
$ABCD$ é um quadrilátero de lados expressos em números inteiros e convexo, com $1 ≤ AB < BC < CD < AD$.
|
||||
|
||||
BD has integer length. O is the midpoint of BD. AO has integer length.
|
||||
$BD$ tem comprimento inteiro. $O$ é o ponto central de $BD$. $AO$ tem comprimento inteiro.
|
||||
|
||||
We'll call ABCD a biclinic integral quadrilateral if AO = CO ≤ BO = DO.
|
||||
Vamos chamar $ABCD$ de um quadrilátero integral biclínico 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.
|
||||
Por exemplo, o quadrilátero a seguir é um quadrilátero integral biclínico: $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="quadrilátero ABCD, com ponto O, um ponto médio de 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).
|
||||
Considere $B(N)$ como o número de quadriláteros integrais biclínicos distintos $ABCD$ que satisfazem ${AB}^2 + {BC}^2 + {CD}^2 + {AD}^2 ≤ N$. Podemos verificar que $B(10.000) = 49$ e $B(1.000.000) = 38239$.
|
||||
|
||||
Encontre $B(10.000.000.000)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler311()` should return 2466018557.
|
||||
`biclinicIntegralQuadrilaterals()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a51000cf542c50ffb7
|
||||
title: 'Problem 312: Cyclic paths on Sierpiński graphs'
|
||||
title: 'Problema 312: Caminhos cíclicos em gráficos de 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.
|
||||
- Um gráfico de Sierpiński de ordem 1 ($S_1$) é um triângulo equilátero.
|
||||
- $S_{n + 1}$ é obtido de $S_n$ posicionando três cópias de $S_n$ de modo que cada par de cópias tenha um canto comum.
|
||||
|
||||
\- 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="gráficos de Sierpiński de ordem 1 até a ordem 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:
|
||||
Considere $C(n)$ como o número de ciclos que passam exatamente uma vez por todos os vértices de $S_n$. Por exemplo, $C(3) = 8$, porque oito desses ciclos podem ser desenhados em $S_3$, como mostrado abaixo:
|
||||
|
||||
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="oito ciclos que passam exatamente uma vez por todos os vértices de 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.
|
||||
Também pode ser verificado que:
|
||||
|
||||
$$\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}$$
|
||||
|
||||
Encontre $C(C(C(10.000)))\bmod {13}^8$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler312()` should return 324681947.
|
||||
`pathsOnSierpinskiGraphs()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a61000cf542c50ffb8
|
||||
title: 'Problem 313: Sliding game'
|
||||
title: 'Problema 313: Jogo de deslizar'
|
||||
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.
|
||||
Em um jogo de deslizar, um contador pode deslizar horizontalmente ou verticalmente para um espaço vazio. O objetivo do jogo é mover o contador vermelho do canto superior esquerdo de uma grade para o canto inferior direito; o espaço sempre começa no canto inferior direito. Por exemplo, a sequência de imagens a seguir mostra como o jogo pode ser concluído em cinco movimentos em uma grade de 2 em 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="completando o jogo em cinco movimentos na grade 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 < 100 is prime.
|
||||
Considere $S(m, n)$ como representante do número mínimo de movimentos para completar o jogo em uma grade de $m$ por $n$. Por exemplo, pode-se verificar que $S(5, 4) = 25$.
|
||||
|
||||
How many grids does S(m,n) = p2, where p < 106 is prime?
|
||||
<img class="img-responsive center-block" alt="estado inicial da grade e estado final da grade para um jogo na grade 5x4" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliding-game-2.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Há exatamente 5482 grades quadriculadas, para as quais $S(m, n) = p^2$, em que $p < 100$ é um número primo.
|
||||
|
||||
Em quantas grades $S(m, n) = p^2$, onde $p < {10}^6$ é um número primo?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler313()` should return 2057774861813004.
|
||||
`slidingGame()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a71000cf542c50ffb9
|
||||
title: 'Problem 314: The Mouse on the Moon'
|
||||
title: 'Problema 314: O rato na lua'
|
||||
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.
|
||||
A lua foi liberada e terrenos podiam ser obtidos gratuitamente, mas tem uma pegadinha. É preciso construir um muro ao redor do terreno de que nos apropriamos. Construir um muro na lua é caro. Todos os países receberam um dote de 500 m por 500 m quadrados, mas eles só possuem as áreas que eles cercarem com o muro. 251001 postes foram colocados em uma grade retangular com um espaçamento de 1 metro. O muro deve ser uma série fechada de linhas retas, cada linha indo de um poste a outro.
|
||||
|
||||
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.
|
||||
Os países maiores construíram, é claro, uma parede de 2000 metros que inclui toda a área de 250 000 $\text{m}^2$. O Ducado do Grande Fenwick tem um orçamento mais apertado. Ele pediu para você (o Programador Real) calcular qual formato obteria a melhor proporção máxima de $\frac{\text{área cercada}}{\text{comprimento do 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.
|
||||
Você já fez cálculos preliminares em uma folha de papel. Para um muro de 2000 metros cercando a área de 250 000 $\text{m}^2$, a proporção de $\frac{\text{área cercada}}{\text{comprimento do muro}}$ é de 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.
|
||||
Embora não seja permitido, mas para ter uma ideia se isto era melhor: se você colocar um círculo dentro da área quadrada tocando os quatro lados, a área será igual a $π \times {250}^2 \text{m}^2$ e o perímetro será $π \times 500 \text{m}$, então a proporção $\frac{\text{área cercada}}{\text{comprimento do muro}}$ também será 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.
|
||||
No entanto, se você cortar do quadrados qyatro triângulos com lados 75 m, 75 m e $75\sqrt{2}$ m, a área total se torna 238750 $\text{m}^2$ e o perímetro se torna $1400 + 300\sqrt{2}$ m. Então, isso dá uma proporção de $\frac{\text{área cercada}}{\text{comprimento do muro}}$ de 130,87, o que é significativamente melhor.
|
||||
|
||||
<img class="img-responsive center-block" alt="imagem mostrando a diferença na área cercada entre círculo e o quadrado com o corte de quatro triângulos" src="https://cdn.freecodecamp.org/curriculum/project-euler/the-mouse-on-the-moon.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Encontre a proporção máxima de $\frac{\text{área cercada}}{\text{comprimento do muro}}$. Arredonde sua resposta para até 8 casas decimais usando o formato abc.defghijk.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler314()` should return 132.52756426.
|
||||
`theMouseOnTheMoon()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4a71000cf542c50ffba
|
||||
title: 'Problem 315: Digital root clocks'
|
||||
title: 'Problema 315: Relógios de raiz digital'
|
||||
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="animação dos relógios de Sam e de Max, calculando raízes dos algarismos a partir de 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 são convidados a transformar dois relógios digitais em dois relógios "de raízes digitais".
|
||||
|
||||
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.
|
||||
Um relógio de raiz digital é um relógio digital que calcula gradualmente as raízes dos algarismos.
|
||||
|
||||
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 um relógio recebe um número, ele vai mostrá-lo e então ele vai iniciar o cálculo, mostrar todos os valores intermédios até que chegue ao resultado. Por exemplo, se o relógio receber o número 137, vai mostrar: `137` → `11` → `2` e então vai ficar preto, esperando o próximo número.
|
||||
|
||||
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.
|
||||
Todo número digital consiste em alguns segmentos de luz: três horizontais (superior, médio, inferior) e quatro verticais (superior esquerdo, superior direito, inferior esquerdo e inferior direito). O número `1` é feito do canto superior direito e do canto inferior direito verticais. O número `4` é feito pela linha do meio horizontal e pelo canto superior esquerdo, canto superior direito e canto inferior direito. O número `8` ilumina todas as luzes.
|
||||
|
||||
Sam and Max built two different clocks.
|
||||
Os relógios consomem energia apenas quando os segmentos são ligados/desligados. Para ativar um `2` custará 5 transições, enquanto um `7` custará apenas 4 transições.
|
||||
|
||||
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 construíram dois relógios diferentes.
|
||||
|
||||
For a grand total of 40 transitions.
|
||||
O relógio de Sam recebe, por exemplo, o número 137: o relógio mostra `137`, então o painel é desligado. Depois, o próximo número (`11`) é ligado, e o painel é desligado novamente. Por fim, o último número (`2`) é ligado e, após algum tempo, desligado.
|
||||
|
||||
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").
|
||||
Por exemplo, com o número 137, o relógio de Sam exige:
|
||||
|
||||
For a grand total of 30 transitions.
|
||||
- `137`: $(2 + 5 + 4) × 2 = 22$ transições (`137` ligado/desligado).
|
||||
- `11`: $(2 + 2) × 2 = 8$ transições (`11` ligado/desligado).
|
||||
- `2`: $(5) × 2 = 10$ transições (`2` ligado/desligado).
|
||||
|
||||
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.
|
||||
Isso dá um total de 40 transições.
|
||||
|
||||
O relógio do Max funciona de maneira diferente. Em vez de desligar todo o painel, é inteligente o suficiente para desativar apenas os segmentos que não serão necessários para o próximo número.
|
||||
|
||||
Para o número 137, o relógio do Max exige:
|
||||
|
||||
- `137` : $2 + 5 + 4 = 11$ transições (`137` ligado), $7$ transições (para desativar os segmentos que não são necessários para o número `11`).
|
||||
- `11` : $0$ transições (número `11` já está ativado corretamente), $3$ transições (para desativar o primeiro `1` e a parte inferior do segundo `1`; a parte superior é comum com o número `2`).
|
||||
- `2` : $4$ transições (para ativar os segmentos restantes para obter um `2`), $5$ transições (para desativar o número `2`).
|
||||
|
||||
Isso dá um total de 30 transições.
|
||||
|
||||
Claro, o relógio de Max consome menos energia que o de Sam. Os dois relógios recebem todos os números primos entre $A = {10}^7$ e $B = 2 × {10}^7$. Encontre a diferença entre o número total de transições necessárias pelo relógio de Sam e as necessárias pelo relógio de Max.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler315()` should return 13625242.
|
||||
`digitalRootClocks()` deve retornar `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--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 602da0c222201c65d2a019f5
|
||||
title: "Learn SQL by Building a Student Database: Part 1"
|
||||
title: "Aprenda SQL criando um banco de dados de alunos: Parte 1"
|
||||
challengeType: 12
|
||||
helpCategory: Relational Databases
|
||||
url: https://github.com/freeCodeCamp/learn-sql-by-building-a-student-database-part-1
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 618590adb0730ca724e37672
|
||||
title: "Learn SQL by Building a Student Database: Part 2"
|
||||
title: "Aprenda SQL criando um banco de dados de alunos: Parte 2"
|
||||
challengeType: 12
|
||||
helpCategory: Relational Databases
|
||||
url: https://github.com/freeCodeCamp/learn-sql-by-building-a-student-database-part-2
|
||||
|
Reference in New Issue
Block a user