chore(i18n,curriculum): update translations (#44272)

This commit is contained in:
camperbot
2021-11-24 07:29:35 -08:00
committed by GitHub
parent 340f423c36
commit 9cf0d9fc3c
15 changed files with 198 additions and 159 deletions

View File

@ -1,6 +1,6 @@
---
id: 58a25c98f9fc0f352b528e7f
title: Hashing Your Passwords
title: Hashing de contraseñas
challengeType: 2
forumTopicId: 301553
dashedName: hashing-your-passwords
@ -8,13 +8,13 @@ dashedName: hashing-your-passwords
# --description--
Going back to the information security section, you may remember that storing plaintext passwords is *never* okay. Now it is time to implement BCrypt to solve this issue.
Volviendo a la sección de seguridad de la información, puedes recordar que almacenar contraseñas en texto plano *nunca* está bien. Ahora es el momento de implementar BCrypt para resolver este problema.
Add `bcrypt@~5.0.0` as a dependency, and require it in your server. You will need to handle hashing in 2 key areas: where you handle registering/saving a new account, and when you check to see that a password is correct on login.
Agrega `bcrypt@~5.0.0` como dependencia, y requiérelo en tu servidor. Necesitarás manejar el hashing en 2 áreas clave: donde manejas el registro/guardado de una nueva cuenta, y cuando compruebas que una contraseña es correcta al iniciar sesión.
Currently on our registration route, you insert a user's password into the database like so: `password: req.body.password`. An easy way to implement saving a hash instead is to add the following before your database logic `const hash = bcrypt.hashSync(req.body.password, 12);`, and replacing the `req.body.password` in the database saving with just `password: hash`.
Actualmente en nuestra ruta de registro, se inserta la contraseña de un usuario en la base de datos así: `password: req.body.password`. Una forma sencilla de implementar el guardado de un hash en su lugar es agregar lo siguiente antes de tu lógica de base de datos `const hash = bcrypt.hashSync(req.body.password, 12);`, y sustituir el `req.body.password` en el guardado de la base de datos por sólo `password: hash`.
Finally, on our authentication strategy, we check for the following in our code before completing the process: `if (password !== user.password) { return done(null, false); }`. After making the previous changes, now `user.password` is a hash. Before making a change to the existing code, notice how the statement is checking if the password is **not** equal then return non-authenticated. With this in mind, your code could look as follows to properly check the password entered against the hash:
Finalmente, en nuestra estrategia de autenticación, comprobamos lo siguiente en nuestro código antes de completar el proceso: `if (password !== user.password) { return done(null, false); }`. Después de realizar los cambios anteriores, ahora `user.password` es un hash. Antes de hacer un cambio en el código existente, nota que la sentencia está comprobando si la contraseña **no** es igual entonces devuelve no autenticado. Con esto en mente, tu código podría verse como se muestra a continuación para verificar correctamente la contraseña introducida contra el hash:
```js
if (!bcrypt.compareSync(password, user.password)) {
@ -22,13 +22,13 @@ if (!bcrypt.compareSync(password, user.password)) {
}
```
That is all it takes to implement one of the most important security features when you have to store passwords!
¡Eso es todo lo que se necesita para implementar una de las características de seguridad más importantes cuando tienes que almacenar contraseñas!
Submit your page when you think you've got it right. If you're running into errors, you can check out the project completed up to this point [here](https://gist.github.com/camperbot/dc16cca09daea4d4151a9c36a1fab564).
Envía tu página cuando creas que lo has hecho bien. Si te encuentras con errores, puedes revisar el proyecto completado hasta este punto [aquí](https://gist.github.com/camperbot/dc16cca09daea4d4151a9c36a1fab564).
# --hints--
BCrypt should be a dependency.
BCrypt debe ser una dependencia.
```js
(getUserInput) =>
@ -47,7 +47,7 @@ BCrypt should be a dependency.
);
```
BCrypt should be correctly required and implemented.
BCrypt debe ser correctamente requerido e implementado.
```js
(getUserInput) =>

View File

@ -1,6 +1,6 @@
---
id: 5900f4fa1000cf542c51000d
title: 'Problem 398: Cutting rope'
title: 'Problema 398: Cortando cordas'
challengeType: 5
forumTopicId: 302063
dashedName: problem-398-cutting-rope
@ -8,18 +8,18 @@ dashedName: problem-398-cutting-rope
# --description--
Inside a rope of length n, n-1 points are placed with distance 1 from each other and from the endpoints. Among these points, we choose m-1 points at random and cut the rope at these points to create m segments.
Dentro de uma corda de comprimento $n$, $n - 1$ pontos são colocados com distância de 1 um do outro e das extremidades. Entre esses pontos, escolhemos $m - 1$ pontos aleatórios e cortamos as cordas nesses pontos para criar $m$ segmentos.
Let E(n, m) be the expected length of the second-shortest segment. For example, E(3, 2) = 2 and E(8, 3) = 16/7. Note that if multiple segments have the same shortest length the length of the second-shortest segment is defined as the same as the shortest length.
Considere $E(n, m)$ como o comprimento esperado do segundo segmento menor. Por exemplo, $E(3, 2) = 2$ e $E(8, 3) = \frac{16}{7}$. Observe que, se diversos segmentos tiverem o mesmo comprimento menor, o segundo segmento menor é definido como igual ao comprimento menor.
Find E(107, 100). Give your answer rounded to 5 decimal places behind the decimal point.
Encontre $E({10}^7, 100)$. Dê sua resposta arredondada para 5 casas depois da vírgula.
# --hints--
`euler398()` should return 2010.59096.
`cuttingRope()` deve retornar `2010.59096`.
```js
assert.strictEqual(euler398(), 2010.59096);
assert.strictEqual(cuttingRope(), 2010.59096);
```
# --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler398(), 2010.59096);
## --seed-contents--
```js
function euler398() {
function cuttingRope() {
return true;
}
euler398();
cuttingRope();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4fc1000cf542c51000e
title: 'Problem 399: Squarefree Fibonacci Numbers'
title: 'Problema 399: Números de Fibonacci livres de quadrados'
challengeType: 5
forumTopicId: 302064
dashedName: problem-399-squarefree-fibonacci-numbers
@ -8,30 +8,36 @@ dashedName: problem-399-squarefree-fibonacci-numbers
# --description--
The first 15 fibonacci numbers are:
Os primeiros 15 números de Fibonacci são:
1,1,2,3,5,8,13,21,34,55,89,144,233,377,610.
$$1,1,2,3,5,8,13,21,34,55,89,144,233,377,610.$$
It can be seen that 8 and 144 are not squarefree: 8 is divisible by 4 and 144 is divisible by 4 and by 9.
É possível ver que 8 e 144 não são livres de quadrados: 8 é divisível por 4 e 144 é divisível por 4 e por 9.
So the first 13 squarefree fibonacci numbers are:
Assim, os 13 primeiros números de Fibonacci livres de quadrados são:
1,1,2,3,5,13,21,34,55,89,233,377 and 610.
$$1,1,2,3,5,13,21,34,55,89,233,377 \text{ e } 610.$$
The 200th squarefree fibonacci number is: 971183874599339129547649988289594072811608739584170445. The last sixteen digits of this number are: 1608739584170445 and in scientific notation this number can be written as 9.7e53.
O $200$º número de Fibonacci livre de quadrados é: 971183874599339129547649988289594072811608739584170445. Os últimos dezesseis algarismos deste número são: 1608739584170445 e, em notação científica, este número pode ser escrito como `9.7e53`.
Find the 100 000 000th squarefree fibonacci number. Give as your answer its last sixteen digits followed by a comma followed by the number in scientific notation (rounded to one digit after the decimal point). For the 200th squarefree number the answer would have been: 1608739584170445,9.7e53
Encontre o $100.000.000$º número de Fibonacci livre de quadrados. Dê sua resposta como uma string com os últimos dezesseis algarismos seguidos de uma vírgula e de um número em notação científica (arredondado para uma casa depois da vírgula). Para o $200$º número livre de quadrados, a resposta seria: `1608739584170445,9.7e53`
Note: For this problem, assume that for every prime p, the first fibonacci number divisible by p is not divisible by p2 (this is part of Wall's conjecture). This has been verified for primes ≤ 3·1015, but has not been proven in general.
**Observação:** para este problema, assumiremos que, para cada número primo $p$, o primeiro número de Fibonacci divisível por $p$ não é divisível por $p^2$ (isso é parte da conjectura de Wall). Isso já foi verificado para números primos $≤ 3 \times {10}^{15}$, mas ainda não foi comprovado em geral.
If it happens that the conjecture is false, then the accepted answer to this problem isn't guaranteed to be the 100 000 000th squarefree fibonacci number, rather it represents only a lower bound for that number.
Se acontecer de a conjetura ser falsa, então a resposta aceita para este problema não é garantida para o $100.000.000$º número de Fibonacci livre de quadrados. Ao invés disso, representa apenas um limite menor para esse número.
# --hints--
`euler399()` should return 1508395636674243, 6.5e27330467.
`squarefreeFibonacciNumbers()` deve retornar uma string.
```js
assert.strictEqual(euler399(), 1508395636674243, 6.5e27330467);
assert(typeof squarefreeFibonacciNumbers() === 'string');
```
`squarefreeFibonacciNumbers()` deve retornar a string `1508395636674243,6.5e27330467`.
```js
assert.strictEqual(squarefreeFibonacciNumbers(), '1508395636674243,6.5e27330467');
```
# --seed--
@ -39,12 +45,12 @@ assert.strictEqual(euler399(), 1508395636674243, 6.5e27330467);
## --seed-contents--
```js
function euler399() {
function squarefreeFibonacciNumbers() {
return true;
}
euler399();
squarefreeFibonacciNumbers();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4fe1000cf542c510010
title: 'Problem 400: Fibonacci tree game'
title: 'Problema 400: Jogo da árvore de Fibonacci'
challengeType: 5
forumTopicId: 302067
dashedName: problem-400-fibonacci-tree-game
@ -8,28 +8,30 @@ dashedName: problem-400-fibonacci-tree-game
# --description--
A Fibonacci tree is a binary tree recursively defined as:T(0) is the empty tree.
Uma árvore de Fibonacci é uma árvore binária recursivamente definida como:
T(1) is the binary tree with only one node.
- $T(0)$ é a árvore vazia.
- $T(1)$ é a árvore binária com apenas um nó.
- $T(k)$ consiste em um nó raiz que tem $T(k - 1)$ e $T(k - 2)$ como filhos.
T(k) consists of a root node that has T(k-1) and T(k-2) as children.
Em uma árvore desse tipo, dois jogadores jogam um jogo de remoção de nós. Em cada turno, um jogador seleciona um nó e o remove, juntamente à subárvore que tem esse nó como raiz. O jogador que for forçado a pegar o nó raiz da árvore é o perdedor.
On such a tree two players play a take-away game. On each turn a player selects a node and removes that node along with the subtree rooted at that node. The player who is forced to take the root node of the entire tree loses.
Aqui estão os movimentos vencedores para o primeiro jogador no primeiro movimento para $T(k)$ de $k = 1$ a $k = 6$.
Here are the winning moves of the first player on the first turn for T(k) from k=1 to k=6.
<img class="img-responsive center-block" alt="movimentos vencedores do primeiro jogador, no primeiro movimento, para k = 1 a k = 6" src="https://cdn.freecodecamp.org/curriculum/project-euler/fibonacci-tree-game.png" style="background-color: white; padding: 10px;" />
Let f(k) be the number of winning moves of the first player (i.e. the moves for which the second player has no winning strategy) on the first turn of the game when this game is played on T(k).
Considere $f(k)$ como o número de movimentos vencedores do primeiro jogador (ou seja, movimentos para os quais o segundo jogador não pode ter uma estratégia vencedora) no primeiro movimento desse jogo quando ele é jogado em $T(k)$.
For example, f(5) = 1 and f(10) = 17.
Por exemplo, $f(5) = 1$ e $f(10) = 17$.
Find f(10000). Give the last 18 digits of your answer.
Encontre $f(10000)$. Dê os últimos 18 dígitos da sua resposta.
# --hints--
`euler400()` should return 438505383468410600.
`fibonacciTreeGame()` deve retornar `438505383468410600`.
```js
assert.strictEqual(euler400(), 438505383468410600);
assert.strictEqual(fibonacciTreeGame(), 438505383468410600);
```
# --seed--
@ -37,12 +39,12 @@ assert.strictEqual(euler400(), 438505383468410600);
## --seed-contents--
```js
function euler400() {
function fibonacciTreeGame() {
return true;
}
euler400();
fibonacciTreeGame();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4fd1000cf542c51000f
title: 'Problem 401: Sum of squares of divisors'
title: 'Problema 401: Soma dos quadrados dos divisores'
challengeType: 5
forumTopicId: 302069
dashedName: problem-401-sum-of-squares-of-divisors
@ -8,22 +8,22 @@ dashedName: problem-401-sum-of-squares-of-divisors
# --description--
The divisors of 6 are 1,2,3 and 6.
Os divisores de 6 são: 1, 2, 3 e 6.
The sum of the squares of these numbers is 1+4+9+36=50.
A soma dos quadrados desses números é $1 + 4 + 9 + 36 = 50$.
Let sigma2(n) represent the sum of the squares of the divisors of n. Thus sigma2(6)=50.
Considere $\sigma_2(n)$ como representante da soma dos quadrados dos divisores de $n$. Assim, $\sigma_2(6) = 50$.
Let SIGMA2 represent the summatory function of sigma2, that is SIGMA2(n)=∑sigma2(i) for i=1 to n. The first 6 values of SIGMA2 are: 1,6,16,37,63 and 113.
Considere $\Sigma_2$ como representando a função somatória de $\sigma_2$, ou seja, $\Sigma_2(n) = \sum \sigma_2(i)$ para $i=1$ a $n$. Os primeiros 6 valores de $\Sigma_2$ são: 1, 6, 16, 37, 63 e 113.
Find SIGMA2(1015) modulo 109.
Encontre $\Sigma_2({10}^{15})$ modulo ${10}^9$.
# --hints--
`euler401()` should return 281632621.
`sumOfSquaresDivisors()` deve retornar `281632621`.
```js
assert.strictEqual(euler401(), 281632621);
assert.strictEqual(sumOfSquaresDivisors(), 281632621);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler401(), 281632621);
## --seed-contents--
```js
function euler401() {
function sumOfSquaresDivisors() {
return true;
}
euler401();
sumOfSquaresDivisors();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f4ff1000cf542c510011
title: 'Problem 402: Integer-valued polynomials'
title: 'Problema 402: Polinômios com valores inteiros'
challengeType: 5
forumTopicId: 302070
dashedName: problem-402-integer-valued-polynomials
@ -8,24 +8,27 @@ dashedName: problem-402-integer-valued-polynomials
# --description--
It can be shown that the polynomial n4 + 4n3 + 2n2 + 5n is a multiple of 6 for every integer n. It can also be shown that 6 is the largest integer satisfying this property.
Pode-se demonstrar que o polinômio $n^4 + 4n^3 + 2n^2 + 5n$ é um múltiplo de 6 para qualquer número inteiro $n$. Também é possível demonstrar que 6 é o maior número inteiro que satisfaz esta propriedade.
Define M(a, b, c) as the maximum m such that n4 + an3 + bn2 + cn is a multiple of m for all integers n. For example, M(4, 2, 5) = 6.
Defina $M(a, b, c)$ como o $m$ máximo, tal que $n^4 + an^3 + bn^2 + cn$ seja um múltiplo de $m$ para todos os números inteiros $n$. Por exemplo, $M(4, 2, 5) = 6$.
Also, define S(N) as the sum of M(a, b, c) for all 0 &lt; a, b, c ≤ N.
Além disso, defina $S(N)$ como a soma de $M(a, b, c)$ para todo $0 &lt; a, b, c ≤ N$.
We can verify that S(10) = 1972 and S(10000) = 2024258331114.
Podemos verificar que $S(10) = 1.972$ e $S(10.000) = 2.024.258.331.114$.
Let Fk be the Fibonacci sequence: F0 = 0, F1 = 1 and Fk = Fk-1 + Fk-2 for k ≥ 2.
Considere $F_k$ como a sequência de Fibonacci:
Find the last 9 digits of Σ S(Fk) for 2 ≤ k ≤ 1234567890123.
- $F_0 = 0$, $F_1 = 1$ e
- $F_k = F_{k - 1} + F_{k - 2}$ para $k ≥ 2$.
Encontre os últimos 9 algarismos de $\sum S(F_k)$ para $2 ≤ k ≤ 1.234.567.890.123$.
# --hints--
`euler402()` should return 356019862.
`integerValuedPolynomials()` deve retornar `356019862`.
```js
assert.strictEqual(euler402(), 356019862);
assert.strictEqual(integerValuedPolynomials(), 356019862);
```
# --seed--
@ -33,12 +36,12 @@ assert.strictEqual(euler402(), 356019862);
## --seed-contents--
```js
function euler402() {
function integerValuedPolynomials() {
return true;
}
euler402();
integerValuedPolynomials();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5001000cf542c510013
title: 'Problem 403: Lattice points enclosed by parabola and line'
title: 'Problema 403: Pontos da rede contidos por uma parábola e linha'
challengeType: 5
forumTopicId: 302071
dashedName: problem-403-lattice-points-enclosed-by-parabola-and-line
@ -8,20 +8,22 @@ dashedName: problem-403-lattice-points-enclosed-by-parabola-and-line
# --description--
For integers a and b, we define D(a, b) as the domain enclosed by the parabola y = x2 and the line y = a·x + b:D(a, b) = { (x, y) | x2 ≤ y ≤ a·x + b }.
Para os números inteiros $a$ e $b$, definimos $D(a, b)$ como o domínio cercado pela parábola $y = x^2$ e pela linha $y = ax + b: D(a, b) = \\{ (x, y) | x^2 ≤ y ≤ ax + b \\}$.
L(a, b) is defined as the number of lattice points contained in D(a, b). For example, L(1, 2) = 8 and L(2, -1) = 1.
$L(a, b)$ é definido como o número de pontos da rede contidos em $D(a, b)$. Por exemplo, $L(1, 2) = 8$ e $L(2, -1) = 1$.
We also define S(N) as the sum of L(a, b) for all the pairs (a, b) such that the area of D(a, b) is a rational number and |a|,|b| ≤ N. We can verify that S(5) = 344 and S(100) = 26709528.
Também definimos $S(N)$ como a soma de $L(a, b)$ para todos os pares ($a$, $b$), tal que a área de $D(a, b)$ é um número racional e $|a|,|b| ≤ N$.
Find S(1012). Give your answer mod 108.
Podemos verificar que $S(5) = 344$ e que $S(100) = 26.709.528$.
Encontre $S({10}^{12})$. Dê sua resposta $\bmod {10}^8$.
# --hints--
`euler403()` should return 18224771.
`latticePoints()` deve retornar `18224771`.
```js
assert.strictEqual(euler403(), 18224771);
assert.strictEqual(latticePoints(), 18224771);
```
# --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler403(), 18224771);
## --seed-contents--
```js
function euler403() {
function latticePoints() {
return true;
}
euler403();
latticePoints();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5001000cf542c510012
title: 'Problem 404: Crisscross Ellipses'
title: 'Problema 404: Elipses cruzadas'
challengeType: 5
forumTopicId: 302072
dashedName: problem-404-crisscross-ellipses
@ -8,22 +8,30 @@ dashedName: problem-404-crisscross-ellipses
# --description--
Ea is an ellipse with an equation of the form x2 + 4y2 = 4a2.
$E_a$ é uma elipse com a equação na forma $x^2 + 4y^2 = 4a^2$.
Ea' is the rotated image of Ea by θ degrees counterclockwise around the origin O(0, 0) for &lt; θ &lt; 90°.
$E_a'$ é a imagem rodada de $E_a$ por $θ$ graus no sentido anti-horário ao redor da origem $O(0, 0)$ para $&lt; θ &lt; 90°$.
b is the distance to the origin of the two intersection points closest to the origin and c is the distance of the two other intersection points. We call an ordered triplet (a, b, c) a canonical ellipsoidal triplet if a, b and c are positive integers. For example, (209, 247, 286) is a canonical ellipsoidal triplet.
<img class="img-responsive center-block" alt="elipse E_a e elipse rodada por θ graus E_a'" src="https://cdn.freecodecamp.org/curriculum/project-euler/crisscross-ellipses.gif" style="background-color: white; padding: 10px;" />
Let C(N) be the number of distinct canonical ellipsoidal triplets (a, b, c) for a ≤ N. It can be verified that C(103) = 7, C(104) = 106 and C(106) = 11845.
$b$ é a distância da origem dos dois pontos de interseção mais próximos da origem e $c$ é a distância dos outros dois pontos de interseção.
Find C(1017).
Chamaremos um trio ordenado ($a$, $b$, $c$) de trio elipsoidal canônico se $a$, $b$ e $c$ forem números inteiros positivos.
Por exemplo, (209, 247, 286) é um trio elipsoidal canônico.
Considere $C(N)$ como o número de trios elipsoidais canônicos ($a$, $b$, $c$) distintos para $a ≤ N$.
Pode-se verificar que $C({10}^3) = 7$, $C({10}^4) = 106$ e $C({10}^6) = 11.845$.
Encontre $C({10}^{17})$.
# --hints--
`euler404()` should return 1199215615081353.
`crisscrossEllipses()` deve retornar `1199215615081353`.
```js
assert.strictEqual(euler404(), 1199215615081353);
assert.strictEqual(crisscrossEllipses(), 1199215615081353);
```
# --seed--
@ -31,12 +39,12 @@ assert.strictEqual(euler404(), 1199215615081353);
## --seed-contents--
```js
function euler404() {
function crisscrossEllipses() {
return true;
}
euler404();
crisscrossEllipses();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5021000cf542c510014
title: 'Problem 405: A rectangular tiling'
title: 'Problema 405: Colocação retangular de ladrilhos'
challengeType: 5
forumTopicId: 302073
dashedName: problem-405-a-rectangular-tiling
@ -8,24 +8,28 @@ dashedName: problem-405-a-rectangular-tiling
# --description--
We wish to tile a rectangle whose length is twice its width.
Queremos preencher com ladrilhos um retângulo cujo comprimento é o dobro de sua largura.
Let T(0) be the tiling consisting of a single rectangle.
Considere $T(0)$ como a área a ser ladrilhada, consistindo em um único retângulo.
For n > 0, let T(n) be obtained from T(n-1) by replacing all tiles in the following manner:
Para $n > 0$, considere $T(n)$ como tendo sido obtido a partir de $T( n- 1)$ substituindo todos os ladrilhos da seguinte maneira:
The following animation demonstrates the tilings T(n) for n from 0 to 5:
<img class="img-responsive center-block" alt="obtendo T(n) a partir de T(n - 1)" src="https://cdn.freecodecamp.org/curriculum/project-euler/a-rectangular-tiling-1.png" style="background-color: white; padding: 10px;" />
Let f(n) be the number of points where four tiles meet in T(n). For example, f(1) = 0, f(4) = 82 and f(109) mod 177 = 126897180.
A animação a seguir demonstra o preenchimento com ladrilhos de $T(n)$ para $n$ de 0 a 5:
Find f(10k) for k = 1018, give your answer modulo 177.
<img class="img-responsive center-block" alt="animação do ladrilhamento de T(n) para n de 0 a 5" src="https://cdn.freecodecamp.org/curriculum/project-euler/a-rectangular-tiling-2.gif" style="background-color: white; padding: 10px;" />
Considere $f(n)$ como o número de pontos em que quatro ladrilhos se encontram em $T(n)$. Por exemplo, $f(1) = 0$, $f(4) = 82$ e $f({10}^9)\bmod {17}^7 = 126.897.180$.
Encontre $f({10}^k)$ para $k = {10}^{18}$ e dê sua resposta modulo ${17}^7$.
# --hints--
`euler405()` should return 237696125.
`rectangularTiling()` deve retornar `237696125`.
```js
assert.strictEqual(euler405(), 237696125);
assert.strictEqual(rectangularTiling(), 237696125);
```
# --seed--
@ -33,12 +37,12 @@ assert.strictEqual(euler405(), 237696125);
## --seed-contents--
```js
function euler405() {
function rectangularTiling() {
return true;
}
euler405();
rectangularTiling();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5021000cf542c510015
title: 'Problem 406: Guessing Game'
title: 'Problema 406: Jogo de adivinhação'
challengeType: 5
forumTopicId: 302074
dashedName: problem-406-guessing-game
@ -8,32 +8,42 @@ dashedName: problem-406-guessing-game
# --description--
We are trying to find a hidden number selected from the set of integers {1, 2, ..., n} by asking questions.
Estamos tentando encontrar um número oculto selecionado do conjunto de inteiros {1, 2, ..., $n$} fazendo perguntas. Cada número (pergunta) que perguntamos, recebemos uma das três possíveis respostas:
Each number (question) we ask, we get one of three possible answers: "Your guess is lower than the hidden number" (and you incur a cost of a), or
- "Seu palpite é menor que o número oculto" (e você tem um custo de a) ou
- "Seu palpite é maior que o número oculto" (e você tem um custo de b), ou
- "Sim, é esse!" (e o jogo acaba).
"Your guess is higher than the hidden number" (and you incur a cost of b), or
Dado o valor de $n$, $a$, e $b$, uma estratégia ideal minimiza o custo total <u>para o pior caso possível</u>.
"Yes, that's it!" (and the game ends).
Por exemplo, se $n = 5$, $a = 2$, e $b = 3$, podemos começar perguntando "<strong>2</strong>" como a nossa primeira pergunta.
Given the value of n, a, and b, an optimal strategy minimizes the total cost for the worst possible case.
Se nos disserem que 2 é maior que o número oculto (para um custo de $b = 3$), então temos certeza de que "<strong>1</strong>" é o número oculto (para um custo total de <strong><span style="color: blue;">3</span></strong>).
For example, if n = 5, a = 2, and b = 3, then we may begin by asking "2" as our first question.
Se nos for dito que 2 é menor que o número oculto (para um custo de $a = 2$), então nossa próxima pergunta será <strong>4</strong>".
If we are told that 2 is higher than the hidden number (for a cost of b=3), then we are sure that "1" is the hidden number (for a total cost of 3). If we are told that 2 is lower than the hidden number (for a cost of a=2), then our next question will be "4". If we are told that 4 is higher than the hidden number (for a cost of b=3), then we are sure that "3" is the hidden number (for a total cost of 2+3=5). If we are told that 4 is lower than the hidden number (for a cost of a=2), then we are sure that "5" is the hidden number (for a total cost of 2+2=4). Thus, the worst-case cost achieved by this strategy is 5. It can also be shown that this is the lowest worst-case cost that can be achieved. So, in fact, we have just described an optimal strategy for the given values of n, a, and b.
Se nos for dito que 4 é maior que o número oculto (para um custo de $b = 3$), então temos certeza de que "<strong>3</strong>" é o número oculto (para um custo total de $2 + 3 = \color{blue}{\mathbf{5}}$).
Let C(n, a, b) be the worst-case cost achieved by an optimal strategy for the given values of n, a, and b.
Se nos for dito que 4 é menor que o número oculto (para um custo de $a = 2$), então temos a certeza de que "<strong>5</strong>" é o número oculto (para um custo total de $2 + 2 = \cor{blue}{\mathbf{4}}$).
Here are a few examples: C(5, 2, 3) = 5 C(500, √2, √3) = 13.22073197... C(20000, 5, 7) = 82 C(2000000, √5, √7) = 49.63755955...
Assim, o pior custo de caso alcançado por esta estratégia é <strong><span style="color: red">5</span></strong>. Também se pode demonstrar que este é o pior custo possível que pode ser alcançado. Então, de fato, acabamos de descrever uma estratégia ideal para os valores indicados de $n$, $a$e $b$.
Let Fk be the Fibonacci numbers: Fk = Fk-1 + Fk-2 with base cases F1 = F2 = 1.Find ∑1≤k≤30 C(1012, √k, √Fk), and give your answer rounded to 8 decimal places behind the decimal point.
Considere $C(n, a, b)$ como o pior caso de custo obtido por uma estratégia ideal para os valores dados de $n$, $a$, e $b$.
Aqui estão alguns exemplos:
$$\begin{align} & C(5, 2, 3) = 5 \\\\ & C(500, \sqrt{2}, \sqrt{3}) = 13.220\\,731\\,97\ldots \\\\ & C(20.000, 5, 7) = 82 \\\\ & C(2.000.000, √5, √7) = 49.637\\,559\\,55\ldots \\\\ \end{align}$$
Considere $F_k$ como sendo os números de Fibonacci: $F_k = F_{k - 1} + F_{k - 2}$ com casos base $F_1 = F_2 = 1$.
Encontre $\displaystyle\sum_{k = 1}^{30} C({10}^{12}, \sqrt{k}, \sqrt{F_k})$ e dê sua resposta arredondada para 8 casas decimais após o ponto decimal.
# --hints--
`euler406()` should return 36813.12757207.
`guessingGame()` deve retornar `36813.12757207`.
```js
assert.strictEqual(euler406(), 36813.12757207);
assert.strictEqual(guessingGame(), 36813.12757207);
```
# --seed--
@ -41,12 +51,12 @@ assert.strictEqual(euler406(), 36813.12757207);
## --seed-contents--
```js
function euler406() {
function guessingGame() {
return true;
}
euler406();
guessingGame();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5041000cf542c510016
title: 'Problem 407: Idempotents'
title: 'Problema 407: Idempotentes'
challengeType: 5
forumTopicId: 302075
dashedName: problem-407-idempotents
@ -8,18 +8,20 @@ dashedName: problem-407-idempotents
# --description--
If we calculate a2 mod 6 for 0 ≤ a ≤ 5 we get: 0,1,4,3,4,1.
Se calcularmos $a^2\bmod 6$ para $0 ≤ a ≤ 5$, obtemos: 0, 1, 4, 3, 4, 1.
The largest value of a such that a2 ≡ a mod 6 is 4. Let's call M(n) the largest value of a &lt; n such that a2 ≡ a (mod n). So M(6) = 4.
O maior valor do tipo, tal que $a^2 ≡ a\bmod 6$ é $4$.
Find ∑M(n) for 1 ≤ n ≤ 107.
Chamaremos $M(n)$ de o maior valor de $a &lt; n$, tal que $a^2 ≡ a (\text{mod } n)$. Assim, $M(6) = 4$.
Encontre $\sum M(n)$ para $1 ≤ n ≤ {10}^7$.
# --hints--
`euler407()` should return 39782849136421.
`idempotents()` deve retornar `39782849136421`.
```js
assert.strictEqual(euler407(), 39782849136421);
assert.strictEqual(idempotents(), 39782849136421);
```
# --seed--
@ -27,12 +29,12 @@ assert.strictEqual(euler407(), 39782849136421);
## --seed-contents--
```js
function euler407() {
function idempotents() {
return true;
}
euler407();
idempotents();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5091000cf542c51001b
title: 'Problem 408: Admissible paths through a grid'
title: 'Problema 408: Caminhos admissíveis através de uma grade'
challengeType: 5
forumTopicId: 302076
dashedName: problem-408-admissible-paths-through-a-grid
@ -8,22 +8,22 @@ dashedName: problem-408-admissible-paths-through-a-grid
# --description--
Let's call a lattice point (x, y) inadmissible if x, y and x + y are all positive perfect squares.
Vamos chamar um ponto da rede ($x$, $y$) de inadmissível se $x$, $y$ e $x + y$ forem todos quadrados positivos perfeitos.
For example, (9, 16) is inadmissible, while (0, 4), (3, 1) and (9, 4) are not.
Por exemplo, (9, 16) é inadmissível, mas (0, 4), (3, 1) e (9, 4) não são.
Consider a path from point (x1, y1) to point (x2, y2) using only unit steps north or east. Let's call such a path admissible if none of its intermediate points are inadmissible.
Considere um caminho do ponto ($x_1$, $y_1$) ao ponto ($x_2$, $y_2$) usando apenas movimentos unitários para o norte e para o leste. Chamaremos esse caminho de admissível se nenhum de seus pontos intermediários for inadmissível.
Let P(n) be the number of admissible paths from (0, 0) to (n, n). It can be verified that P(5) = 252, P(16) = 596994440 and P(1000) mod 1 000 000 007 = 341920854.
Considere $P(n)$ como o número de caminhos admissíveis de (0, 0) a ($n$, $n$). Pode-se verificar que $P(5) = 252$, $P(16) = 596.994.440$ e $P(1.000)\bmod 1.000.000.007 = 341.920.854$.
Find P(10 000 000) mod 1 000 000 007.
Encontre $P(10.000.000)\bmod 1.000.000.007$.
# --hints--
`euler408()` should return 299742733.
`admissiblePaths()` deve retornar `299742733`.
```js
assert.strictEqual(euler408(), 299742733);
assert.strictEqual(admissiblePaths(), 299742733);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler408(), 299742733);
## --seed-contents--
```js
function euler408() {
function admissiblePaths() {
return true;
}
euler408();
admissiblePaths();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5061000cf542c510017
title: 'Problem 409: Nim Extreme'
title: 'Problema 409: Nim extremos'
challengeType: 5
forumTopicId: 302077
dashedName: problem-409-nim-extreme
@ -8,24 +8,24 @@ dashedName: problem-409-nim-extreme
# --description--
Let n be a positive integer. Consider nim positions where:There are n non-empty piles.
Considere $n$ um inteiro positivo. Considere as posições nim onde:
Each pile has size less than 2n.
- Não existam $n$ pilhas não vazias.
- Cada pilha tenha um tamanho inferior a $2^n$.
- Não haja duas pilhas com o mesmo tamanho.
No two piles have the same size.
Considere $W(n)$ como o número de posições nim vencedoras que satisfazem as condições acima (uma posição é vencedora se o primeiro jogador tiver uma estratégia vencedora).
Let W(n) be the number of winning nim positions satisfying the above
Por exemplo, $W(1) = 1$, $W(2) = 6$, $W(3) = 168$, $W(5) = 19.764.360$ e $W(100)\bmod 1.000.000.007 = 384.777.056$.
conditions (a position is winning if the first player has a winning strategy). For example, W(1) = 1, W(2) = 6, W(3) = 168, W(5) = 19764360 and W(100) mod 1 000 000 007 = 384777056.
Find W(10 000 000) mod 1 000 000 007.
Encontre $W(10.000.000)\bmod 1.000.000.007$.
# --hints--
`euler409()` should return 253223948.
`nimExtreme()` deve retornar `253223948`.
```js
assert.strictEqual(euler409(), 253223948);
assert.strictEqual(nimExtreme(), 253223948);
```
# --seed--
@ -33,12 +33,12 @@ assert.strictEqual(euler409(), 253223948);
## --seed-contents--
```js
function euler409() {
function nimExtreme() {
return true;
}
euler409();
nimExtreme();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5071000cf542c510018
title: 'Problem 410: Circle and tangent line'
title: 'Problema 410: Círculo e linha tangente'
challengeType: 5
forumTopicId: 302079
dashedName: problem-410-circle-and-tangent-line
@ -8,20 +8,22 @@ dashedName: problem-410-circle-and-tangent-line
# --description--
Let C be the circle with radius r, x2 + y2 = r2. We choose two points P(a, b) and Q(-a, c) so that the line passing through P and Q is tangent to C.
Considere $C$ como o círculo de raio $r$, $x^2 + y^2 = r^2$. Selecionamos dois pontos $P(a, b)$ e $Q(-a, c)$, tal que a linha passando por $P$ e $Q$ seja tangente a $C$.
For example, the quadruplet (r, a, b, c) = (2, 6, 2, -7) satisfies this property.
Por exemplo, o quarteto $(r, a, b, c) = (2, 6, 2, -7)$ satisfaz essa propriedade.
Let F(R, X) be the number of the integer quadruplets (r, a, b, c) with this property, and with 0 &lt; r ≤ R and 0 &lt; a ≤ X.
Considere $F(R, X)$ como o número de quartetos de números inteiros $(r, a, b, c)$ com essa propriedade e com $0 &lt; r ≤ R$ e $0 &lt; a ≤ X$.
We can verify that F(1, 5) = 10, F(2, 10) = 52 and F(10, 100) = 3384. Find F(108, 109) + F(109, 108).
Podemos verificar que $F(1, 5) = 10$, $F(2, 10) = 52$ e $F(10, 100) = 3384$.
Encontre $F({10}^8, {10}^9) + F({10}^9, {10}^8)$.
# --hints--
`euler410()` should return 799999783589946600.
`circleAndTangentLine()` deve retornar `799999783589946600`.
```js
assert.strictEqual(euler410(), 799999783589946600);
assert.strictEqual(circleAndTangentLine(), 799999783589946600);
```
# --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler410(), 799999783589946600);
## --seed-contents--
```js
function euler410() {
function circleAndTangentLine() {
return true;
}
euler410();
circleAndTangentLine();
```
# --solutions--

View File

@ -1,6 +1,6 @@
---
id: 5900f5361000cf542c510048
title: 'Problem 457: A polynomial modulo the square of a prime'
title: 'Problema 457: Um módulo polinomial, o quadrado de um primo'
challengeType: 5
forumTopicId: 302131
dashedName: problem-457-a-polynomial-modulo-the-square-of-a-prime
@ -8,22 +8,22 @@ dashedName: problem-457-a-polynomial-modulo-the-square-of-a-prime
# --description--
Let f(n) = n2 - 3n - 1.
Considere $f(n) = n^2 - 3n - 1$.
Let p be a prime.
Considere que $p$ é um número primo.
Let R(p) be the smallest positive integer n such that f(n) mod p2 = 0 if such an integer n exists, otherwise R(p) = 0.
Considere $R(p)$ o menor número inteiro positivo $n$, tal que $f(n)\bmod p^2 = 0$, se um número inteiro $n$ existir. Do contrário, considere que $R(p) = 0$.
Let SR(L) be ∑R(p) for all primes not exceeding L.
Considere $SR(L)$ como a $\sum R(p)$ de todos os números primos que não exceda $L$.
Find SR(107).
Encontre $SR({10}^7)$.
# --hints--
`euler457()` should return 2647787126797397000.
`polynomialModuloSquareOfPrime()` deve retornar `2647787126797397000`.
```js
assert.strictEqual(euler457(), 2647787126797397000);
assert.strictEqual(polynomialModuloSquareOfPrime(), 2647787126797397000);
```
# --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler457(), 2647787126797397000);
## --seed-contents--
```js
function euler457() {
function polynomialModuloSquareOfPrime() {
return true;
}
euler457();
polynomialModuloSquareOfPrime();
```
# --solutions--