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

This commit is contained in:
camperbot
2021-11-11 08:02:39 -08:00
committed by GitHub
parent 48e44ddc05
commit 85359ed00a
21 changed files with 227 additions and 228 deletions

View File

@ -1,7 +1,7 @@
--- ---
id: 5900f4231000cf542c50ff34 id: 5900f4231000cf542c50ff34
title: >- title: >-
Problem 181: Investigating in how many ways objects of two different colours can be grouped Problema 181: Investigação de em quantas maneiras objetos de duas cores diferentes podem ser agrupados
challengeType: 5 challengeType: 5
forumTopicId: 301817 forumTopicId: 301817
dashedName: >- dashedName: >-
@ -10,20 +10,18 @@ dashedName: >-
# --description-- # --description--
Having three black objects B and one white object W they can be grouped in 7 ways like this: Quando temos três objetos pretos $B$ e um objeto branco $W$, eles podem ser agrupados de 7 maneiras assim:
(BBBW)(B,BBW)(B,B,BW)(B,B,B,W) $$(BBBW)\\;(B,BBW)\\;(B,B,BW)\\;(B,B,B,W)\\;(B,BB,W)\\;(BBB,W)\\;(BB,BW)$$
(B,BB,W)(BBB,W)(BB,BW) De quantas formas podem ser agrupados sessenta objetos pretos $B$ e quarenta objetos brancos $W$?
In how many ways can sixty black objects B and forty white objects W be thus grouped?
# --hints-- # --hints--
`euler181()` should return 83735848679360670. `colorsGrouping()` deve retornar `83735848679360670`.
```js ```js
assert.strictEqual(euler181(), 83735848679360670); assert.strictEqual(colorsGrouping(), 83735848679360670);
``` ```
# --seed-- # --seed--
@ -31,12 +29,12 @@ assert.strictEqual(euler181(), 83735848679360670);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler181() { function colorsGrouping() {
return true; return true;
} }
euler181(); colorsGrouping();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4231000cf542c50ff35 id: 5900f4231000cf542c50ff35
title: 'Problem 182: RSA encryption' title: 'Problema 182: Criptografia RSA'
challengeType: 5 challengeType: 5
forumTopicId: 301818 forumTopicId: 301818
dashedName: problem-182-rsa-encryption dashedName: problem-182-rsa-encryption
@ -8,47 +8,47 @@ dashedName: problem-182-rsa-encryption
# --description-- # --description--
The RSA encryption is based on the following procedure: A criptografia RSA baseia-se no seguinte procedimento:
Generate two distinct primes `p` and `q`. Compute `n=p*q` and `φ=(p-1)(q-1)`. Find an integer `e`, `1 < e < φ`, such that `gcd(e,φ) = 1` Gere dois números primos distintos `p` e `q`. Calcule `n=p*q` e `φ=(p-1)(q-1)`. Encontre um número inteiro `e`, sendo que `1 < e < φ`, de tal forma que `gcd(e,φ) = 1` (gcd é a sigla para máximo divisor comum, em inglês)
A message in this system is a number in the interval `[0,n-1]`. A text to be encrypted is then somehow converted to messages (numbers in the interval `[0,n-1]`). To encrypt the text, for each message, `m`, c=m<sup>e</sup> mod n is calculated. Uma mensagem neste sistema é um número no intervalo `[0,n-1]`. Um texto a ser criptografado é então convertido em mensagens (números no intervalo `[0,n-1]`). Para criptografar o texto, para cada mensagem, `m`, c=m<sup>e</sup> mod n é calculado.
To decrypt the text, the following procedure is needed: calculate `d` such that `ed=1 mod φ`, then for each encrypted message, `c`, calculate m=c<sup>d</sup> mod n. Para descriptografar o texto, é necessário o seguinte procedimento: calcular `d` tal que `ed=1 mod φ`. Depois, para cada mensagem criptografada, `c`, calcular m=c<sup>d</sup> mod n.
There exist values of `e` and `m` such that m<sup>e</sup> mod n = m. We call messages `m` for which m<sup>e</sup> mod n=m unconcealed messages. Existem valores de `e` e `m` tal que m<sup>e</sup> mod n = m. Chamamos de mensagens `m` aquelas para as quais m<sup>e</sup> mod n=m mensagens não ocultas.
An issue when choosing `e` is that there should not be too many unconcealed messages. For instance, let `p=19` and `q=37`. Then `n=19*37=703` and `φ=18*36=648`. If we choose `e=181`, then, although `gcd(181,648)=1` it turns out that all possible messages m `(0≤m≤n-1)` are unconcealed when calculating m<sup>e</sup> mod n. For any valid choice of `e` there exist some unconcealed messages. It's important that the number of unconcealed messages is at a minimum. Um problema ao escolher `e` é o fato de que não deve haver muitas mensagens não ocultas. Por exemplo, considere `p=19` e `q=37`. Então `n=19*37=703` e `φ=18*36=648`. Se escolhermos `e=181`, então, embora `gcd(181,648)=1` todas as mensagens possíveis m `(0≤m≤n-1)` são não ocultas ao calcular m<sup>e</sup> mod n. Para qualquer escolha válida de `e`, existem algumas mensagens não ocultas. É importante que o número de mensagens não ocultas seja o mínimo.
For any given `p` and `q`, find the sum of all values of `e`, `1 < e < φ(p,q)` and `gcd(e,φ)=1`, so that the number of unconcealed messages for this value of `e` is at a minimum. Para quaisquer `p` e `q` fornecidos, encontre a soma de todos os valores de `e`, `1 < e < φ(p,q)` e `gcd(e,φ)=1`, para que o número de mensagens não ocultas para esse valor de `e` seja o menor possível.
# --hints-- # --hints--
`RSAEncryption` should be a function. `RSAEncryption` deve ser uma função.
```js ```js
assert(typeof RSAEncryption === 'function') assert(typeof RSAEncryption === 'function')
``` ```
`RSAEncryption` should return a number. `RSAEncryption` deve retornar um número.
```js ```js
assert.strictEqual(typeof RSAEncryption(19, 37), 'number'); assert.strictEqual(typeof RSAEncryption(19, 37), 'number');
``` ```
`RSAEncryption(19, 37)` should return `17766`. `RSAEncryption(19, 37)` deve retornar `17766`.
```js ```js
assert.strictEqual(RSAEncryption(19, 37), 17766); assert.strictEqual(RSAEncryption(19, 37), 17766);
``` ```
`RSAEncryption(283, 409)` should return `466196580`. `RSAEncryption(283, 409)` deve retornar `466196580`.
```js ```js
assert.strictEqual(RSAEncryption(283, 409), 466196580); assert.strictEqual(RSAEncryption(283, 409), 466196580);
``` ```
`RSAEncryption(1009, 3643)` should return `399788195976`. `RSAEncryption(1009, 3643)` deve retornar `399788195976`.
```js ```js
assert.strictEqual(RSAEncryption(19, 37), 17766); assert.strictEqual(RSAEncryption(19, 37), 17766);

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4231000cf542c50ff36 id: 5900f4231000cf542c50ff36
title: 'Problem 183: Maximum product of parts' title: 'Problema 183: Produto máximo das partes'
challengeType: 5 challengeType: 5
forumTopicId: 301819 forumTopicId: 301819
dashedName: problem-183-maximum-product-of-parts dashedName: problem-183-maximum-product-of-parts
@ -8,30 +8,30 @@ dashedName: problem-183-maximum-product-of-parts
# --description-- # --description--
Let N be a positive integer and let N be split into k equal parts, r = N/k, so that N = r + r + ... + r. Considere $N$ um número inteiro positivo que pode ser dividido em $k$ partes iguais, $r = \frac{N}{k}$, de modo que $N = r + r + \cdots + r$.
Let P be the product of these parts, P = r × r × ... × r = rk. Considere $P$ o produto dessas partes, $P = r × r × \cdots × r = r^k$.
For example, if 11 is split into five equal parts, 11 = 2.2 + 2.2 + 2.2 + 2.2 + 2.2, then P = 2.25 = 51.53632. Por exemplo, se 11 for dividido em cinco partes iguais, 11 = 2,2 + 2,2 + 2,2 + 2,2 + 2,2, então $P = {2.2}^5 = 51,53632$.
Let M(N) = Pmax for a given value of N. Considere $M(N) = P_{max}$ para um valor dado de $N$.
It turns out that the maximum for N = 11 is found by splitting eleven into four equal parts which leads to Pmax = (11/4)4; that is, M(11) = 14641/256 = 57.19140625, which is a terminating decimal. Acontece que o máximo para $N = 11$ é encontrado ao dividirmos onze em quatro partes iguais, o que leva a $P_{max} = {(\frac{11}{4})}^4$; ou seja, $M(11) = \frac{14641}{256} = 57.19140625$, que é um número decimal finito.
However, for N = 8 the maximum is achieved by splitting it into three equal parts, so M(8) = 512/27, which is a non-terminating decimal. No entanto, para $N = 8$, o máximo é alcançado dividindo-o em três partes iguais, então $M(8) = \frac{512}{27}$, que é um decimal infinito.
Let D(N) = N if M(N) is a non-terminating decimal and D(N) = -N if M(N) is a terminating decimal. Considere $D(N) = N$ se $M(N)$ for um decimal infinito e $D(N) = -N$ se $M(N)$ for um decimal finito.
For example, ΣD(N) for 5 ≤ N ≤ 100 is 2438. Por exemplo, $\sum D(N)$ para $5 ≤ N ≤ 100$ é 2438.
Find ΣD(N) for 5 ≤ N ≤ 10000. Encontre $\sum D(N)$ para $5 ≤ N ≤ 10000$.
# --hints-- # --hints--
`euler183()` should return 48861552. `maximumProductOfParts()` deve retornar `48861552`.
```js ```js
assert.strictEqual(euler183(), 48861552); assert.strictEqual(maximumProductOfParts(), 48861552);
``` ```
# --seed-- # --seed--
@ -39,12 +39,12 @@ assert.strictEqual(euler183(), 48861552);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler183() { function maximumProductOfParts() {
return true; return true;
} }
euler183(); maximumProductOfParts();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4241000cf542c50ff37 id: 5900f4241000cf542c50ff37
title: 'Problem 184: Triangles containing the origin' title: 'Problema 184: Triângulos contendo a origem'
challengeType: 5 challengeType: 5
forumTopicId: 301820 forumTopicId: 301820
dashedName: problem-184-triangles-containing-the-origin dashedName: problem-184-triangles-containing-the-origin
@ -8,20 +8,22 @@ dashedName: problem-184-triangles-containing-the-origin
# --description-- # --description--
Consider the set Ir of points (x,y) with integer coordinates in the interior of the circle with radius r, centered at the origin, i.e. x2 + y2 &lt; r2. Considere o conjunto $I_r$ de pontos $(x,y)$ com coordenadas inteiras no interior do círculo com raio $r$, centralizado na origem, ou seja, $x^2 + y^2 &lt; r^2$.
For a radius of 2, I2 contains the nine points (0,0), (1,0), (1,1), (0,1), (-1,1), (-1,0), (-1,-1), (0,-1) and (1,-1). There are eight triangles having all three vertices in I2 which contain the origin in the interior. Two of them are shown below, the others are obtained from these by rotation. Para um raio de 2, $I_2$ contém os nove pontos (0,0), (1,0), (1,1), (0,1), (-1,1), (-1,0), (-1,-1), (0,-1) e (1,-1). Há oito triângulos com todos os três vértices em $I_2$ que contêm a origem no interior. Dois deles são mostrados abaixo. Os outros são obtidos por rotação.
For a radius of 3, there are 360 triangles containing the origin in the interior and having all vertices in I3 and for I5 the number is 10600. <img class="img-responsive center-block" alt="círculo com raio 2, centralizado na origem, com nove pontos marcados e dois triângulos - (-1,0), (0,1), (1,-1) e (-1,1), (0,-1), (1,1)" src="https://cdn.freecodecamp.org/curriculum/project-euler/triangles-containing-the-origin.gif" style="background-color: white; padding: 10px;" />
How many triangles are there containing the origin in the interior and having all three vertices in I105? Para um raio de 3, há 360 triângulos contendo a origem no interior e tendo todos os vértices em $I_3$. Para $I_5$, o número é 10600.
Quantos triângulos há contendo a origem no interior e tendo todos os três vértices em $I_{105}$?
# --hints-- # --hints--
`euler184()` should return 1725323624056. `trianglesConttainingOrigin()` deve retornar `1725323624056`.
```js ```js
assert.strictEqual(euler184(), 1725323624056); assert.strictEqual(trianglesConttainingOrigin(), 1725323624056);
``` ```
# --seed-- # --seed--
@ -29,12 +31,12 @@ assert.strictEqual(euler184(), 1725323624056);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler184() { function trianglesContainingOrigin() {
return true; return true;
} }
euler184(); trianglesContainingOrigin();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4251000cf542c50ff38 id: 5900f4251000cf542c50ff38
title: 'Problem 185: Number Mind' title: 'Problema 185: Senha de números'
challengeType: 5 challengeType: 5
forumTopicId: 301821 forumTopicId: 301821
dashedName: problem-185-number-mind dashedName: problem-185-number-mind
@ -8,24 +8,28 @@ dashedName: problem-185-number-mind
# --description-- # --description--
The game Number Mind is a variant of the well known game Master Mind. A mente dos Senha de números é uma variante do conhecido jogo Senha.
Instead of coloured pegs, you have to guess a secret sequence of digits. After each guess you're only told in how many places you've guessed the correct digit. So, if the sequence was 1234 and you guessed 2036, you'd be told that you have one correct digit; however, you would NOT be told that you also have another digit in the wrong place. Em vez de peças coloridas, você tem que adivinhar uma sequência secreta de algarismos. Depois de cada palpite você é informado apenas em quantos lugares você adivinhou o algarismo correto. Então, se a sequência for 1234 e seu palpite for 2036, você será informado de que tem um algarismo correto. No entanto, NÃO será informado se você tem outro algarismo correto, mas no lugar errado.
For instance, given the following guesses for a 5-digit secret sequence, 90342 ;2 correct 70794 ;0 correct 39458 ;2 correct 34109 ;1 correct 51545 ;2 correct 12531 ;1 correct The correct sequence 39542 is unique. Por exemplo, dados os seguintes palpites para uma sequência secreta de 5 algarismos
Based on the following guesses, $$\begin{align} & 90342 ;2\\;\text{correct}\\\\ & 70794 ;0\\;\text{correct}\\\\ & 39458 ;2\\;\text{correct}\\\\ & 34109 ;1\\;\text{correct}\\\\ & 51545 ;2\\;\text{correct}\\\\ & 12531 ;1\\;\text{correct} \end{align}$$
5616185650518293 ;2 correct 3847439647293047 ;1 correct 5855462940810587 ;3 correct 9742855507068353 ;3 correct 4296849643607543 ;3 correct 3174248439465858 ;1 correct 4513559094146117 ;2 correct 7890971548908067 ;3 correct 8157356344118483 ;1 correct 2615250744386899 ;2 correct 8690095851526254 ;3 correct 6375711915077050 ;1 correct 6913859173121360 ;1 correct 6442889055042768 ;2 correct 2321386104303845 ;0 correct 2326509471271448 ;2 correct 5251583379644322 ;2 correct 1748270476758276 ;3 correct 4895722652190306 ;1 correct 3041631117224635 ;3 correct 1841236454324589 ;3 correct 2659862637316867 ;2 correct A sequência correta 39542 é única.
Find the unique 16-digit secret sequence. Com base nos palpites abaixo
$$\begin{align} & 5616185650518293 ;2\\;\text{correct}\\\\ & 3847439647293047 ;1\\;\text{correct}\\\\ & 5855462940810587 ;3\\;\text{correct}\\\\ & 9742855507068353 ;3\\;\text{correct}\\\\ & 4296849643607543 ;3\\;\text{correct}\\\\ & 3174248439465858 ;1\\;\text{correct}\\\\ & 4513559094146117 ;2\\;\text{correct}\\\\ & 7890971548908067 ;3\\;\text{correct}\\\\ & 8157356344118483 ;1\\;\text{correct}\\\\ & 2615250744386899 ;2\\;\text{correct}\\\\ & 8690095851526254 ;3\\;\text{correct}\\\\ & 6375711915077050 ;1\\;\text{correct}\\\\ & 6913859173121360 ;1\\;\text{correct}\\\\ & 6442889055042768 ;2\\;\text{correct}\\\\ & 2321386104303845 ;0\\;\text{correct}\\\\ & 2326509471271448 ;2\\;\text{correct}\\\\ & 5251583379644322 ;2\\;\text{correct}\\\\ & 1748270476758276 ;3\\;\text{correct}\\\\ & 4895722652190306 ;1\\;\text{correct}\\\\ & 3041631117224635 ;3\\;\text{correct}\\\\ & 1841236454324589 ;3\\;\text{correct}\\\\ & 2659862637316867 ;2\\;\text{correct} \end{align}$$
Encontre a sequência secreta única de 16 dígitos.
# --hints-- # --hints--
`euler185()` should return 4640261571849533. `numberMind()` deve retornar `4640261571849533`.
```js ```js
assert.strictEqual(euler185(), 4640261571849533); assert.strictEqual(numberMind(), 4640261571849533);
``` ```
# --seed-- # --seed--
@ -33,12 +37,12 @@ assert.strictEqual(euler185(), 4640261571849533);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler185() { function numberMind() {
return true; return true;
} }
euler185(); numberMind();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4281000cf542c50ff39 id: 5900f4281000cf542c50ff39
title: 'Problem 186: Connectedness of a network' title: 'Problema 186: Conectividade de uma rede'
challengeType: 5 challengeType: 5
forumTopicId: 301822 forumTopicId: 301822
dashedName: problem-186-connectedness-of-a-network dashedName: problem-186-connectedness-of-a-network
@ -8,24 +8,33 @@ dashedName: problem-186-connectedness-of-a-network
# --description-- # --description--
Here are the records from a busy telephone system with one million users: Aqui estão os registros de um sistema de telefone bastante ativo com um milhão de usuários:
RecNrCallerCalled120000710005326001835004393600863701497......... The telephone number of the caller and the called number in record n are Caller(n) = S2n-1 and Called(n) = S2n where S1,2,3,... come from the "Lagged Fibonacci Generator": | RecNr | Caller | Called |
| ----- | ------ | ------ |
| 1 | 200007 | 100053 |
| 2 | 600183 | 500439 |
| 3 | 600863 | 701497 |
| ... | ... | ... |
For 1 ≤ k ≤ 55, Sk = \[100003 - 200003k + 300007k3] (modulo 1000000) For 56 ≤ k, Sk = \[Sk-24 + Sk-55] (modulo 1000000) O número de telefone de quem ligou e o número de quem recebeu a chamada no registro $n$ (RecNr) são $Caller(n) = S_{2n - 1}$ (quem ligou) e $Called(n) = S_{2n}$ (quem recebeu) em ${S}_{1,2,3,\ldots}$ veio de um "Gerador Fibonacci com atraso":
If Caller(n) = Called(n) then the user is assumed to have misdialled and the call fails; otherwise the call is successful. Para $1 ≤ k ≤ 55$, $S_k = [100003 - 200003k + 300007{k}^3]\\;(\text{modulo}\\;1000000)$
From the start of the records, we say that any pair of users X and Y are friends if X calls Y or vice-versa. Similarly, X is a friend of a friend of Z if X is a friend of Y and Y is a friend of Z; and so on for longer chains. Para $56 ≤ k$, $S_k = [S_{k - 24} + S_{k - 55}]\\;(\text{modulo}\\;1000000)$
The Prime Minister's phone number is 524287. After how many successful calls, not counting misdials, will 99% of the users (including the PM) be a friend, or a friend of a friend etc., of the Prime Minister? Se $Caller(n) = Called(n)$, diz-se que o usuário ligou errado e há uma falha na ligação; do contrário, a chamada foi um sucesso.
Desde o início dos registros, dizemos que qualquer par de usuários $X$ e $Y$ são amigos se $X$ ligar para $Y$ ou vice-versa. Do mesmo modo, $X$ é um amigo de um amigo de $Z$ se $X$ é um amigo de $Y$ e $Y$ é um amigo de $Z$. O mesmo vale para cadeias maiores.
O número de telefone do primeiro ministro é 524287. Após quantas chamadas bem-sucedidas, sem contar as falsas, 99% dos usuários (incluindo o próprio primeiro ministro) serão amigos ou amigos de amigos do primeiro ministro?
# --hints-- # --hints--
`euler186()` should return 2325629. `connectednessOfANetwork()` deve retornar `2325629`.
```js ```js
assert.strictEqual(euler186(), 2325629); assert.strictEqual(connectednessOfANetwork(), 2325629);
``` ```
# --seed-- # --seed--
@ -33,12 +42,12 @@ assert.strictEqual(euler186(), 2325629);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler186() { function connectednessOfANetwork() {
return true; return true;
} }
euler186(); connectednessOfANetwork();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4291000cf542c50ff3a id: 5900f4291000cf542c50ff3a
title: 'Problem 187: Semiprimes' title: 'Problema 187: Semiprimos'
challengeType: 5 challengeType: 5
forumTopicId: 301823 forumTopicId: 301823
dashedName: problem-187-semiprimes dashedName: problem-187-semiprimes
@ -8,15 +8,15 @@ dashedName: problem-187-semiprimes
# --description-- # --description--
A composite is a number containing at least two prime factors. For example, 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3. Um número composto é um número que contém pelo menos dois fatores primos. Por exemplo, $15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3$.
There are ten composites below thirty containing precisely two, not necessarily distinct, prime factors: 4, 6, 9, 10, 14, 15, 21, 22, 25, 26. Há dez compostos abaixo de trinta, contendo precisamente dois fatores primos, não necessariamente distintos: 4, 6, 9, 10, 14, 15, 21, 22, 25, 26.
How many composite integers, n &lt; 108, have precisely two, not necessarily distinct, prime factors? Quantos números compostos inteiros, $n &lt; {10}^8$, têm precisamente dois fatores primos, não necessariamente distintos?
# --hints-- # --hints--
`euler187()` should return 17427258. `semiPrimes()` deve retornar `17427258`.
```js ```js
assert.strictEqual(euler187(), 17427258); assert.strictEqual(euler187(), 17427258);
@ -27,12 +27,12 @@ assert.strictEqual(euler187(), 17427258);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler187() { function semiPrimes() {
return true; return true;
} }
euler187(); semiPrimes();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4291000cf542c50ff3b id: 5900f4291000cf542c50ff3b
title: 'Problem 188: The hyperexponentiation of a number' title: 'Problema 188: A hiperexponenciação de um número'
challengeType: 5 challengeType: 5
forumTopicId: 301824 forumTopicId: 301824
dashedName: problem-188-the-hyperexponentiation-of-a-number dashedName: problem-188-the-hyperexponentiation-of-a-number
@ -8,20 +8,20 @@ dashedName: problem-188-the-hyperexponentiation-of-a-number
# --description-- # --description--
The hyperexponentiation or tetration of a number a by a positive integer b, denoted by a↑↑b or ba, is recursively defined by: A hiperexponenciação ou tetração de um número $a$ por um número inteiro positivo $b$, denotada por $a↑↑b$ ou ${}^ba$, é recursivamente definida por:
a↑↑1 = a, $a↑↑1 = a$,
a↑↑(k+1) = a(a↑↑k). $a↑↑(k+1) = a^{(a↑↑k)}$.
Thus we have e.g. 3↑↑2 = 33 = 27, hence 3↑↑3 = 327 = 7625597484987 and 3↑↑4 is roughly 103.6383346400240996\*10^12. Find the last 8 digits of 1777↑↑1855. Assim, temos, por exemplo, que $3↑↑2 = 3^3 = 27$. Portanto $3↑↑3 = 3^{27} = 7625597484987$ e $3↑↑4$ é aproximadamente ${10}^{3.6383346400240996 \times {10}^{12}}$. Encontre os últimos 8 algarismos de $1777↑↑1855$.
# --hints-- # --hints--
`euler188()` should return 95962097. `hyperexponentation()` deve retornar `95962097`.
```js ```js
assert.strictEqual(euler188(), 95962097); assert.strictEqual(hyperexponentation(), 95962097);
``` ```
# --seed-- # --seed--
@ -29,12 +29,12 @@ assert.strictEqual(euler188(), 95962097);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler188() { function hyperexponentation() {
return true; return true;
} }
euler188(); hyperexponentation();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4291000cf542c50ff3c id: 5900f4291000cf542c50ff3c
title: 'Problem 189: Tri-colouring a triangular grid' title: 'Problema 189: Colorização tripla de uma grade triangular'
challengeType: 5 challengeType: 5
forumTopicId: 301825 forumTopicId: 301825
dashedName: problem-189-tri-colouring-a-triangular-grid dashedName: problem-189-tri-colouring-a-triangular-grid
@ -8,22 +8,26 @@ dashedName: problem-189-tri-colouring-a-triangular-grid
# --description-- # --description--
Consider the following configuration of 64 triangles: Considere a seguinte configuração de 64 triângulos:
We wish to colour the interior of each triangle with one of three colours: red, green or blue, so that no two neighbouring triangles have the same colour. Such a colouring shall be called valid. Here, two triangles are said to be neighbouring if they share an edge. Note: if they only share a vertex, then they are not neighbours. <img class="img-responsive center-block" alt="64 triângulos arranjados de modo a criar um triângulo maior com comprimento de lado de 8 triângulos" src="https://cdn.freecodecamp.org/curriculum/project-euler/tri-colouring-a-triangular-grid-1.gif" style="background-color: white; padding: 10px;" />
For example, here is a valid colouring of the above grid: Queremos colorir o interior de cada triângulo com uma de três cores: vermelho, verde ou azul, para que nenhum de dois triângulos vizinhos tenha a mesma cor. Essa colorização será considerada válida. Aqui, diz-se que dois triângulos são vizinhos se eles compartilharem uma aresta. Observação: se eles apenas compartilharem um vértice, então não são vizinhos.
A colouring C' which is obtained from a colouring C by rotation or reflection is considered distinct from C unless the two are identical. Por exemplo, aqui está uma colorização válida para a grade acima:
How many distinct valid colourings are there for the above configuration? <img class="img-responsive center-block" alt="grade colorida de 64 triângulos" src="https://cdn.freecodecamp.org/curriculum/project-euler/tri-colouring-a-triangular-grid-2.gif" style="background-color: white; padding: 10px;" />
Uma colorização C', que é obtida a partir de uma colorização C por rotação ou reflexão é considerada diferente de C, a menos que ambas sejam idênticas.
Quantas colorizações válidas distintas existem para a configuração acima?
# --hints-- # --hints--
`euler189()` should return 10834893628237824. `triangularGridColoring()` deve retornar `10834893628237824`.
```js ```js
assert.strictEqual(euler189(), 10834893628237824); assert.strictEqual(triangularGridColoring(), 10834893628237824);
``` ```
# --seed-- # --seed--
@ -31,12 +35,12 @@ assert.strictEqual(euler189(), 10834893628237824);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler189() { function triangularGridColoring() {
return true; return true;
} }
euler189(); triangularGridColoring();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f42b1000cf542c50ff3d id: 5900f42b1000cf542c50ff3d
title: 'Problem 190: Maximising a weighted product' title: 'Problema 190: Maximização de um produto ponderado'
challengeType: 5 challengeType: 5
forumTopicId: 301828 forumTopicId: 301828
dashedName: problem-190-maximising-a-weighted-product dashedName: problem-190-maximising-a-weighted-product
@ -8,18 +8,18 @@ dashedName: problem-190-maximising-a-weighted-product
# --description-- # --description--
Let Sm = (x1, x2, ... , xm) be the m-tuple of positive real numbers with x1 + x2 + ... + xm = m for which Pm = x1 \* x22 \* ... \* xmm is maximised. Considere $S_m = (x_1, x_2, \ldots, x_m)$ a $m$-ésima tupla de números reais positivos com $x_1 + x_2 + \cdots + x_m = m$ para a qual $P_m = x_1 \times {x_2}^2 \times \cdots \times {x_m}^m$ é maximizado.
For example, it can be verified that \[P10] = 4112 (\[ ] is the integer part function). Por exemplo, pode-se verificar que $[P_{10}] = 4112$ ([ ] é a parte inteira da função).
Find Σ\[Pm] for 2 ≤ m ≤ 15. Encontre $\sum {[P_m]}$ para $2 ≤ m ≤ 15$.
# --hints-- # --hints--
`euler190()` should return 371048281. `maximisingWeightedProduct()` deve retornar `371048281`.
```js ```js
assert.strictEqual(euler190(), 371048281); assert.strictEqual(maximisingWeightedProduct(), 371048281);
``` ```
# --seed-- # --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler190(), 371048281);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler190() { function maximisingWeightedProduct() {
return true; return true;
} }
euler190(); maximisingWeightedProduct();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f42b1000cf542c50ff3e id: 5900f42b1000cf542c50ff3e
title: 'Problem 191: Prize Strings' title: 'Problema 191: Strings de prêmios'
challengeType: 5 challengeType: 5
forumTopicId: 301829 forumTopicId: 301829
dashedName: problem-191-prize-strings dashedName: problem-191-prize-strings
@ -8,22 +8,28 @@ dashedName: problem-191-prize-strings
# --description-- # --description--
A particular school offers cash rewards to children with good attendance and punctuality. If they are absent for three consecutive days or late on more than one occasion then they forfeit their prize. Uma determinada escola oferece recompensas em dinheiro para crianças com boa frequência e pontualidade. Se não estiverem presentes por três dias consecutivos ou atrasadas mais de uma vez, então perdem o seu prêmio.
During an n-day period a trinary string is formed for each child consisting of L's (late), O's (on time), and A's (absent). Durante um período de n-dias, uma string ternária é formada para cada criança consistindo em L's (dias atrasado), O's (dias chegando na hora) e A's (dias ausente).
Although there are eighty-one trinary strings for a 4-day period that can be formed, exactly forty-three strings would lead to a prize: Embora existam oitenta e uma strings ternárias para um período de 4 dias que possam ser formadas, exatamente quarenta e três strings levariam a um prêmio:
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA LAOO LAOA LAAO ```
OOOO OOOA OOOL OOAO OOAA OOAL OOLO OOLA OAOO OAOA
OAOL OAAO OAAL OALO OALA OLOO OLOA OLAO OLAA AOOO
AOOA AOOL AOAO AOAA AOAL AOLO AOLA AAOO AAOA AAOL
AALO AALA ALOO ALOA ALAO ALAA LOOO LOOA LOAO LOAA
LAOO LAOA LAAO
```
How many "prize" strings exist over a 30-day period? Quantas strings de "prêmio" existem em um período de 30 dias?
# --hints-- # --hints--
`euler191()` should return 1918080160. `prizeStrings()` deve retornar `1918080160`.
```js ```js
assert.strictEqual(euler191(), 1918080160); assert.strictEqual(prizeStrings(), 1918080160);
``` ```
# --seed-- # --seed--
@ -31,12 +37,12 @@ assert.strictEqual(euler191(), 1918080160);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler191() { function prizeStrings() {
return true; return true;
} }
euler191(); prizeStrings();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f42c1000cf542c50ff3f id: 5900f42c1000cf542c50ff3f
title: 'Problem 192: Best Approximations' title: 'Problema 192: Melhores aproximações'
challengeType: 5 challengeType: 5
forumTopicId: 301830 forumTopicId: 301830
dashedName: problem-192-best-approximations dashedName: problem-192-best-approximations
@ -8,22 +8,22 @@ dashedName: problem-192-best-approximations
# --description-- # --description--
Let x be a real number. Considere $x$ um número real.
A best approximation to x for the denominator bound d is a rational number r/s in reduced form, with s ≤ d, such that any rational number which is closer to x than r/s has a denominator larger than d: Uma melhor aproximação de $x$ para o denominador vinculado a $d$ é um número racional $\frac{r}{s}$ na forma reduzida, com $s ≤ d$, tal que qualquer número racional que esteja mais próximo de $x$ do que $\frac{r}{s}$ tenha um denominador maior que $d$:
|p/q-x| &lt; |r/s-x| ⇒ q > d $$|\frac{p}{q} - x| &lt; |\frac{r}{s} - x| ⇒ q > d$$
For example, the best approximation to √13 for the denominator bound 20 is 18/5 and the best approximation to √13 for the denominator bound 30 is 101/28. Por exemplo, a melhor aproximação de $\sqrt{13}$ do denominador vinculado $20$ é $\frac{18}{5}$ e a melhor aproximação de $\sqrt{13}$ do denominador vinculado $30$ é $\frac{101}{28}$.
Find the sum of all denominators of the best approximations to √n for the denominator bound 1012, where n is not a perfect square and 1 &lt; n ≤ 100000. Encontre a soma de todos os denominadores das melhores aproximações de $\sqrt{n}$ para o denominador vinculado ${10}^{12}$, onde $n$ não é um quadrado perfeito e $1 &lt; n ≤ 100000$.
# --hints-- # --hints--
`euler192()` should return 57060635927998344. `bestApproximations()` deve retornar `57060635927998344`.
```js ```js
assert.strictEqual(euler192(), 57060635927998344); assert.strictEqual(bestApproximations(), 57060635927998344);
``` ```
# --seed-- # --seed--
@ -31,12 +31,12 @@ assert.strictEqual(euler192(), 57060635927998344);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler192() { function bestApproximations() {
return true; return true;
} }
euler192(); bestApproximations();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f42f1000cf542c50ff41 id: 5900f42f1000cf542c50ff41
title: 'Problem 193: Squarefree Numbers' title: 'Problema 193: Números livres de raízes quadradas'
challengeType: 5 challengeType: 5
forumTopicId: 301831 forumTopicId: 301831
dashedName: problem-193-squarefree-numbers dashedName: problem-193-squarefree-numbers
@ -8,16 +8,16 @@ dashedName: problem-193-squarefree-numbers
# --description-- # --description--
A positive integer n is called squarefree, if no square of a prime divides n, thus 1, 2, 3, 5, 6, 7, 10, 11 are squarefree, but not 4, 8, 9, 12. Um número inteiro positivo $n$ é chamado de livre de raiz quadrada, se nenhum quadrado de um número primo dividir $n$. Assim, 1, 2, 3, 5, 6, 7, 10, 11 são livres de raiz quadrada, mas 4, 8, 9, 12 não são.
How many squarefree numbers are there below 250? Quantos números livres de raiz quadrada existem abaixo de $2^{50}$?
# --hints-- # --hints--
`euler193()` should return 684465067343069. `squarefreeNumbers()` deve retornar `684465067343069`.
```js ```js
assert.strictEqual(euler193(), 684465067343069); assert.strictEqual(squarefreeNumbers(), 684465067343069);
``` ```
# --seed-- # --seed--
@ -25,12 +25,12 @@ assert.strictEqual(euler193(), 684465067343069);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler193() { function squarefreeNumbers() {
return true; return true;
} }
euler193(); squarefreeNumbers();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f42f1000cf542c50ff40 id: 5900f42f1000cf542c50ff40
title: 'Problem 194: Coloured Configurations' title: 'Problema 194: Configurações colorizadas'
challengeType: 5 challengeType: 5
forumTopicId: 301832 forumTopicId: 301832
dashedName: problem-194-coloured-configurations dashedName: problem-194-coloured-configurations
@ -8,24 +8,22 @@ dashedName: problem-194-coloured-configurations
# --description-- # --description--
Consider graphs built with the units A: Considere gráficos construídos com as unidades A:
<img class="img-responsive" alt="gráfico da unidade A" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-1.png" style="display: inline-block; background-color: white; padding: 10px;" />
e B: <img class="img-responsive" alt="gráfico da unidade B" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-2.png" style="display: inline-block; background-color: white; padding: 10px;" />, onde as unidades são grudadas ao longo das arestas verticais, como no desenho <img class="img-responsive" alt="gráfico com quatro unidades grudadas ao longo das arestas verticais" src="https://cdn.freecodecamp.org/curriculum/project-euler/coloured-configurations-3.png" style="display: inline-block; background-color: white; padding: 10px;" />.
and B: , where the units are glued along Uma configuração do tipo $(a,b,c)$ é um gráfico que faz parte de $a$ unidades A e $b$ unidades B, onde os vértices do gráfico são colorizados usando até $c$ cores, de modo que nenhum dois vértices adjacentes tenham a mesma cor. O gráfico composto acima é um exemplo de configuração do tipo $(2,2,6)$. De fato, é do tipo $(2,2,c)$ para todos os $c ≥ 4$
the vertical edges as in the graph . Considere $N(a,b,c)$ o número de configurações do tipo $(a,b,c)$. Por exemplo, $N(1,0,3) = 24$, $N(0,2,4) = 92928$ e $N(2,2,3) = 20736$.
A configuration of type (a,b,c) is a graph thus built of a units A and b units B, where the graph's vertices are coloured using up to c colours, so that no two adjacent vertices have the same colour. The compound graph above is an example of a configuration of type (2,2,6), in fact of type (2,2,c) for all c ≥ 4. Encontre os últimos 8 dígitos de $N(25,75,1984)$.
Let N(a,b,c) be the number of configurations of type (a,b,c). For example, N(1,0,3) = 24, N(0,2,4) = 92928 and N(2,2,3) = 20736.
Find the last 8 digits of N(25,75,1984).
# --hints-- # --hints--
`euler194()` should return 61190912. `coloredConfigurations()` deve retornar `61190912`.
```js ```js
assert.strictEqual(euler194(), 61190912); assert.strictEqual(coloredConfigurations(), 61190912);
``` ```
# --seed-- # --seed--
@ -33,12 +31,12 @@ assert.strictEqual(euler194(), 61190912);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler194() { function coloredConfigurations() {
return true; return true;
} }
euler194(); coloredConfigurations();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4311000cf542c50ff43 id: 5900f4311000cf542c50ff43
title: 'Problem 195: Inscribed circles of triangles with one angle of 60 degrees' title: 'Problema 195: Círculos inscritos de triângulos com um ângulo de 60 graus'
challengeType: 5 challengeType: 5
forumTopicId: 301833 forumTopicId: 301833
dashedName: problem-195-inscribed-circles-of-triangles-with-one-angle-of-60-degrees dashedName: problem-195-inscribed-circles-of-triangles-with-one-angle-of-60-degrees
@ -8,24 +8,22 @@ dashedName: problem-195-inscribed-circles-of-triangles-with-one-angle-of-60-degr
# --description-- # --description--
Let's call an integer sided triangle with exactly one angle of 60 degrees a 60-degree triangle. Vamos chamar um triângulo de lado inteiro com exatamente um ângulo de 60° de um triângulo de 60°.
Let r be the radius of the inscribed circle of such a 60-degree triangle. Considere $r$ o raio do círculo inscrito de um triângulo de 60°.
There are 1234 60-degree triangles for which r ≤ 100. Há 1234 triângulos de 60° para os quais $r ≤ 100$.
Let T(n) be the number of 60-degree triangles for which r ≤ n, so Considere $T(n)$ o número de triângulos de 60° para os quais $r ≤ n$. Assim, $T(100) = 1234$, $T(1000) = 22767$ e $T(10000) = 359912$.
T(100) = 1234, T(1000) = 22767, and T(10000) = 359912. Encontre $T(1053779)$.
Find T(1053779).
# --hints-- # --hints--
`euler195()` should return 75085391. `inscribedCirclesOfTriangles()` deve retornar `75085391`.
```js ```js
assert.strictEqual(euler195(), 75085391); assert.strictEqual(inscribedCirclesOfTriangles(), 75085391);
``` ```
# --seed-- # --seed--
@ -33,12 +31,12 @@ assert.strictEqual(euler195(), 75085391);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler195() { function inscribedCirclesOfTriangles() {
return true; return true;
} }
euler195(); inscribedCirclesOfTriangles();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4301000cf542c50ff42 id: 5900f4301000cf542c50ff42
title: 'Problem 196: Prime triplets' title: 'Problema 196: Trios de números primos'
challengeType: 5 challengeType: 5
forumTopicId: 301834 forumTopicId: 301834
dashedName: problem-196-prime-triplets dashedName: problem-196-prime-triplets
@ -8,30 +8,30 @@ dashedName: problem-196-prime-triplets
# --description-- # --description--
Build a triangle from all positive integers in the following way: Construa um triângulo com todos os números inteiros positivos da seguinte maneira:
1 2 3 4 5 6 7 8 9 1011 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 2829 30 31 32 33 34 35 3637 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 . . . $$\begin{array}{rrr} & 1 \\\\ & \color{red}{2} & \color{red}{3} \\\\ & 4 & \color{red}{5} & 6 \\\\ & \color{red}{7} & 8 & 9 & 10 \\\\ & \color{red}{11} & 12 & \color{red}{13} & 14 & 15 \\\\ & 16 & \color{red}{17} & 18 & \color{red}{19} & 20 & 21 \\\\ & 22 & \color{red}{23} & 24 & 25 & 26 & 27 & 28 \\\\ & \color{red}{29} & 30 & \color{red}{31} & 32 & 33 & 34 & 35 & 36 \\\\ & \color{red}{37} & 38 & 39 & 40 & \color{red}{41} & 42 & \color{red}{43} & 44 & 45 \\\\ & 46 & \color{red}{47} & 48 & 49 & 50 & 51 & 52 & \color{red}{53} & 54 & 55 \\\\ & 56 & 57 & 58 & \color{red}{59} & 60 & \color{red}{61} & 62 & 63 & 64 & 65 & 66 \\\\ & \cdots \end{array}$$
Each positive integer has up to eight neighbours in the triangle. Cada número inteiro positivo tem até oito vizinhos no triângulo.
A set of three primes is called a prime triplet if one of the three primes has the other two as neighbours in the triangle. Um conjunto de três números primos é chamado de trio de números primos se um dos três primos tiver outros dois números primos como vizinhos do triângulo.
For example, in the second row, the prime numbers 2 and 3 are elements of some prime triplet. Por exemplo, na segunda linha, os números primos 2 e 3 são elementos de um trio de números primos.
If row 8 is considered, it contains two primes which are elements of some prime triplet, i.e. 29 and 31. If row 9 is considered, it contains only one prime which is an element of some prime triplet: 37. Se considerarmos a linha 8, ela contém dois primos, que são elementos de algum trio de números primos, 29 e 31. Se considerarmos a linha 9, ela contém apenas um número primo que é elemento de um trio de números primos: 37.
Define S(n) as the sum of the primes in row n which are elements of any prime triplet. Then S(8)=60 and S(9)=37. Defina $S(n)$ como a soma de números primos em uma linha $n$ que são elementos de qualquer trio de números primos. Então, $S(8) = 60$ e $S(9) = 37$.
You are given that S(10000)=950007619. Você é informado de que $S(10000) = 950007619$.
Find S(5678027) + S(7208785). Encontre $S(5678027) + S(7208785)$.
# --hints-- # --hints--
`euler196()` should return 322303240771079940. `primeTriplets()` deve retornar `322303240771079940`.
```js ```js
assert.strictEqual(euler196(), 322303240771079940); assert.strictEqual(primeTriplets(), 322303240771079940);
``` ```
# --seed-- # --seed--
@ -39,12 +39,12 @@ assert.strictEqual(euler196(), 322303240771079940);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler196() { function primeTriplets() {
return true; return true;
} }
euler196(); primeTriplets();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4311000cf542c50ff44 id: 5900f4311000cf542c50ff44
title: 'Problem 197: Investigating the behaviour of a recursively defined sequence' title: 'Problema 197: Investigação do comportamento de uma sequência definida recursivamente'
challengeType: 5 challengeType: 5
forumTopicId: 301835 forumTopicId: 301835
dashedName: problem-197-investigating-the-behaviour-of-a-recursively-defined-sequence dashedName: problem-197-investigating-the-behaviour-of-a-recursively-defined-sequence
@ -8,18 +8,16 @@ dashedName: problem-197-investigating-the-behaviour-of-a-recursively-defined-seq
# --description-- # --description--
Given is the function f(x) = ⌊230.403243784-x2× 10-9 ( ⌊ ⌋ is the floor-function), Dada a função $f(x) = ⌊{2}^{30.403243784 - x^2}× {10}^{-9}$ (onde ⌊ ⌋ é a função de base), a sequência $u_n$ é definida por $u_0 = -1$ e $u_{n + 1} = f(u_n)$.
the sequence un is defined by u0 = -1 and un+1 = f(un). Encontre $u_n + u_{n + 1}$ para $n = {10}^{12}$. Dê sua resposta com 9 algarismos após o ponto (9 casas depois da vírgula).
Find un + un+1 for n = 1012. Give your answer with 9 digits after the decimal point.
# --hints-- # --hints--
`euler197()` should return 1.710637717. `recursivelyDefinedSequence()` deve retornar `1.710637717`.
```js ```js
assert.strictEqual(euler197(), 1.710637717); assert.strictEqual(recursivelyDefinedSequence(), 1.710637717);
``` ```
# --seed-- # --seed--
@ -27,12 +25,12 @@ assert.strictEqual(euler197(), 1.710637717);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler197() { function recursivelyDefinedSequence() {
return true; return true;
} }
euler197(); recursivelyDefinedSequence();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4331000cf542c50ff45 id: 5900f4331000cf542c50ff45
title: 'Problem 198: Ambiguous Numbers' title: 'Problema 198: Números ambíguos'
challengeType: 5 challengeType: 5
forumTopicId: 301836 forumTopicId: 301836
dashedName: problem-198-ambiguous-numbers dashedName: problem-198-ambiguous-numbers
@ -8,18 +8,18 @@ dashedName: problem-198-ambiguous-numbers
# --description-- # --description--
A best approximation to a real number x for the denominator bound d is a rational number r/s (in reduced form) with s ≤ d, so that any rational number p/q which is closer to x than r/s has q > d. Uma melhor aproximação de um número real $x$ para o denominador vinculado $d$ é um número racional $\frac{r}{s}$ (na forma reduzida), com $s ≤ d$, tal que qualquer número racional $\frac{p}{q}$ que esteja mais próximo de $x$ do que de $\frac{r}{s}$ tenha $q > d$.
Usually the best approximation to a real number is uniquely determined for all denominator bounds. However, there are some exceptions, e.g. 9/40 has the two best approximations 1/4 and 1/5 for the denominator bound 6. We shall call a real number x ambiguous, if there is at least one denominator bound for which x possesses two best approximations. Clearly, an ambiguous number is necessarily rational. Geralmente, a melhor aproximação de um número real é determinada exclusivamente para todos os denominadores vinculados. No entanto, há algumas exceções. Por exemplo, $\frac{9}{40}$ tem as duas melhores aproximações $\frac{1}{4}$ e $\frac{1}{5}$ para o denominador vinculado $6$. Chamaremos um número real $x$ de ambíguo se houver pelo menos um denominador vinculado para o qual $x$ possui duas melhores aproximações. Claramente, um número ambíguo é necessariamente racional.
How many ambiguous numbers x = p/q, 0 &lt; x &lt; 1/100, are there whose denominator q does not exceed 108? Quantos números ambíguos $x = \frac{p}{q}$, $0 &lt; x &lt; \frac{1}{100}$, existem cujo denominador $q$ não exceda ${10}^8$?
# --hints-- # --hints--
`euler198()` should return 52374425. `ambiguousNumbers()` deve retornar `52374425`.
```js ```js
assert.strictEqual(euler198(), 52374425); assert.strictEqual(ambiguousNumbers(), 52374425);
``` ```
# --seed-- # --seed--
@ -27,12 +27,12 @@ assert.strictEqual(euler198(), 52374425);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler198() { function ambiguousNumbers() {
return true; return true;
} }
euler198(); ambiguousNumbers();
``` ```
# --solutions-- # --solutions--

View File

@ -1,6 +1,6 @@
--- ---
id: 5900f4341000cf542c50ff46 id: 5900f4341000cf542c50ff46
title: 'Problem 199: Iterative Circle Packing' title: 'Problema 199: Embalagem de círculos iterativa'
challengeType: 5 challengeType: 5
forumTopicId: 301837 forumTopicId: 301837
dashedName: problem-199-iterative-circle-packing dashedName: problem-199-iterative-circle-packing
@ -8,29 +8,29 @@ dashedName: problem-199-iterative-circle-packing
# --description-- # --description--
Three circles of equal radius are placed inside a larger circle such that each pair of circles is tangent to one another and the inner circles do not overlap. There are four uncovered "gaps" which are to be filled iteratively with more tangent circles. Três círculos de raio igual são colocados dentro de um círculo maior, de tal forma que cada par de círculos é tangente entre si e os círculos internos não se sobrepõem. Há quatro "lacunas" descobertas que devem ser preenchidas iterativamente com mais círculos tangentes.
<img class="img-responsive center-block" alt="a diagram of non-overlapping concentric circles" src="https://cdn-media-1.freecodecamp.org/project-euler/199-circles-in-circles.gif" style="background-color: white; padding: 10px;" /> <img class="img-responsive center-block" alt="um diagrama de círculos concêntricos não sobrepostos" src="https://cdn-media-1.freecodecamp.org/project-euler/199-circles-in-circles.gif" style="background-color: white; padding: 10px;" />
At each iteration, a maximally sized circle is placed in each gap, which creates more gaps for the next iteration. After 3 iterations (pictured), there are 108 gaps and the fraction of the area which is not covered by circles is 0.06790342, rounded to eight decimal places. A cada iteração, um círculo de tamanho máximo é colocado em cada lacuna, o que cria mais lacunas para a próxima iteração. Após 3 iterações (na figura), há 108 lacunas e a fração da área que não é coberta pelos círculos é de 0, 6790342, arredondado para oito casas decimais.
What fraction of the area is not covered by circles after `n` iterations? Give your answer rounded to eight decimal places using the format x.xxxxxxxx . Qual fração da área não é coberta pelos círculos depois de `n` iterações? Arredonde sua resposta para até oito casas decimais usando o formato x.xxxxxxxx.
# --hints-- # --hints--
`iterativeCirclePacking(10)` should return a number. `iterativeCirclePacking(10)` deve retornar um número.
```js ```js
assert(typeof iterativeCirclePacking(10) === 'number'); assert(typeof iterativeCirclePacking(10) === 'number');
``` ```
`iterativeCirclePacking(10)` should return 0.00396087. `iterativeCirclePacking(10)` deve retornar `0.00396087`.
```js ```js
assert.strictEqual(iterativeCirclePacking(10), 0.00396087); assert.strictEqual(iterativeCirclePacking(10), 0.00396087);
``` ```
`iterativeCirclePacking(3)` should return 0.06790342. `iterativeCirclePacking(3)` deve retornar `0.06790342`.
```js ```js
assert.strictEqual(iterativeCirclePacking(3), 0.06790342); assert.strictEqual(iterativeCirclePacking(3), 0.06790342);

View File

@ -1,7 +1,7 @@
--- ---
id: 5900f4351000cf542c50ff47 id: 5900f4351000cf542c50ff47
title: >- title: >-
Problem 200: Find the 200th prime-proof sqube containing the contiguous sub-string "200" Problema 200: Encontre o 200º sqube à prova de primos contendo a substring contígua "200"
challengeType: 5 challengeType: 5
forumTopicId: 301840 forumTopicId: 301840
dashedName: >- dashedName: >-
@ -10,22 +10,22 @@ dashedName: >-
# --description-- # --description--
We shall define a sqube to be a number of the form, p2q3, where p and q are distinct primes. Definiremos um sqube como um número na forma ${p^2}{q^3}$, onde $p$ e $q$ são números primos distintos.
For example, 200 = 5223 or 120072949 = 232613. Por exemplo, $200 = {5^2}{2^3}$ ou $120072949 = {{23}^2}{{61}^3}$.
The first five squbes are 72, 108, 200, 392, and 500. Os primeiros cinco squbes são 72, 108, 200, 392 e 500.
Interestingly, 200 is also the first number for which you cannot change any single digit to make a prime; we shall call such numbers, prime-proof. The next prime-proof sqube which contains the contiguous sub-string "200" is 1992008. Curiosamente, 200 também é o primeiro número para o qual não se pode alterar qualquer algarismo para torná-lo um número primo. Chamaremos esses números de à prova de primos. O próximo sqube a prova de primos que contém a substring contígua `200` é 1992008.
Find the 200th prime-proof sqube containing the contiguous sub-string "200". Encontre o 200º sqube à prova de primos contendo a substring contígua `200`.
# --hints-- # --hints--
`euler200()` should return 229161792008. `primeProofSqubeWithSubString()` deve retornar `229161792008`.
```js ```js
assert.strictEqual(euler200(), 229161792008); assert.strictEqual(primeProofSqubeWithSubString(), 229161792008);
``` ```
# --seed-- # --seed--
@ -33,12 +33,12 @@ assert.strictEqual(euler200(), 229161792008);
## --seed-contents-- ## --seed-contents--
```js ```js
function euler200() { function primeProofSqubeWithSubString() {
return true; return true;
} }
euler200(); primeProofSqubeWithSubString();
``` ```
# --solutions-- # --solutions--

View File

@ -10,28 +10,20 @@ dashedName: subleq
O [Subleq](https://rosettacode.org/wiki/eso:Subleq) é um exemplo de um [One-Instruction Set Computer (OISC)](https://en.wikipedia.org/wiki/One_instruction_set_computer). O [Subleq](https://rosettacode.org/wiki/eso:Subleq) é um exemplo de um [One-Instruction Set Computer (OISC)](https://en.wikipedia.org/wiki/One_instruction_set_computer).
Seu nome vem de sua única instrução, que é **SU**btract and **B**ranch if **L**ess than or **EQ**ual (subtraia e ramifique se for menor ou igual) Seu nome vem de sua única instrução, que é **SU**btract and **B**ranch if **L**ess than or **EQ**ual (subtraia e ramifique se for menor ou igual) a zero.
a zero.
Sua tarefa é criar um interpretador que emule esse tipo de máquina. Sua tarefa é criar um interpretador que emule esse tipo de máquina.
A memória da máquina consiste em um array de números inteiros com sinal. Qualquer tamanho razoável de palavra serve, mas a memória deve ser A memória da máquina consiste em um array de números inteiros com sinal. Qualquer tamanho razoável de palavra é bom, mas a memória deve ser capaz de manter números negativos e positivos.
capaz de conter números negativos e positivos.
A execução começa com o ponteiro de instrução mirando a primeira palavra, que é o endereço 0. Ela prossegue da seguinte forma: A execução começa com o ponteiro de instrução mirando a primeira palavra, que é o endereço 0. Ela prossegue da seguinte forma:
<ol> <ol>
<li>Permita que A, B e C sejam valores armazenado nas três palavras consecutivas na memória, começando no ponteiro de instrução.</li> <li>Permita que A, B e C sejam valores armazenado nas três palavras consecutivas na memória, começando no ponteiro de instrução.</li>
<li>Avance o ponteiro de instrução 3 palavras para apontar para o endereço após o que contém C.</li> <li>Avance o ponteiro de instrução 3 palavras para apontar para o endereço após o que contém C.</li>
<li>Se A é -1, então um caractere é lido a partir da entrada padrão e seu ponto de código armazenado no endereço fornecido por B. C <li>Se A é -1, então um caractere é lido a partir da entrada padrão e seu ponto de código armazenado no endereço fornecido por B. C não é usado.</li>
não é usado.</li> <li>Se B é -1, então o número contido no endereço dado por A é interpretado como um ponto de código e a saída de caractere correspondente. C, mais uma vez, não é utilizado.</li>
<li>Se B é -1, então o número contido no endereço dado por A é interpretado como um ponto de código e a <li>Caso contrário, tanto A quanto B são tratados como endereços de locais de memória. O número contido no endereço fornecido por A é subtraído do número do endereço fornecido por B (e o resultado é armazenado de volta no endereço B). Se o resultado for zero ou negativo, o valor C se torna o novo ponteiro da instrução.</li>
saída de caractere correspondente. C, mais uma vez, não é utilizado.</li>
<li>Caso contrário, tanto A quanto B são tratados como endereços de locais de memória. O número contido no endereço
fornecido por A é subtraído do número do endereço fornecido por B (e o resultado é armazenado de volta no endereço B). Se
o resultado for zero ou negativo, o valor C se torna o novo ponteiro da instrução.</li>
<li>Se o ponteiro da instrução se tornar negativo, a execução para.</li> <li>Se o ponteiro da instrução se tornar negativo, a execução para.</li>
</ol> </ol>
@ -39,15 +31,7 @@ Outros endereços negativos além de -1 podem ser tratados como equivalentes a -
A solução deve aceitar um programa que será executado na máquina, separadamente da entrada alimentado no programa em si. A solução deve aceitar um programa que será executado na máquina, separadamente da entrada alimentado no programa em si.
Este programa deve estar em "código de máquina" bruto de subleq - números decimais separados por espaços em branco, sem nomes simbólicos ou Este programa deve estar em "código de máquina" subleq puro - números decimais separados por espaços em branco, sem nomes simbólicos ou outras extensões de nível de assembly, a serem carregadas na memória começando no endereço 0. Mostre o resultado de sua solução quando receber o programa "Olá, mundo!". (Observe que o exemplo assume ASCII ou um superconjunto dele, como qualquer um dos conjuntos de caracteres Latin-N ou Unicode. Você pode traduzi-lo para outro conjunto de caracteres se a implementação estiver em um ambiente não compatível com ASCII.)
outras extensões de nível de assembly, a serem carregadas na memória iniciando no endereço 0. Mostre a saída da solução quando
recebe esse programa "Hello, world!". (Observe que o exemplo assume ASCII ou um superconjunto dele, como qualquer um dos conjuntos
de caracteres N-latinos ou Unicode. Você pode traduzi-lo para outro conjunto de caracteres se a implementação estiver em um
ambiente não ASCII compatível.)
<pre>15 17 -1 17 -1 -1 16 1 -1 16 3 -1 15 15 0 0 -1 72 101 108 108 111 44 32 119 111 114 108 100 33 10 0</pre> <pre>15 17 -1 17 -1 -1 16 1 -1 16 3 -1 15 15 0 0 -1 72 101 108 108 111 44 32 119 111 114 108 100 33 10 0</pre>
@ -66,9 +50,7 @@ message: "Hello, world!\n\0"
# --instructions-- # --instructions--
Escreva uma função que receba um array de números inteiros como parâmetro. Ele representa os elementos da memória. A função Escreva uma função que receba um array de números inteiros como parâmetro. Ele representa os elementos da memória. A função deve interpretar a sequência e retornar a string de saída. Para esta tarefa, considere que não há uma entrada padrão.
deve interpretar a sequência e retornar a string de saída. Para esta tarefa, considere que não há uma entrada padrão.
# --hints-- # --hints--