chore(i18n,curriculum): update translations (#44186)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ef1000cf542c50ff01
|
||||
title: 'Problem 129: Repunit divisibility'
|
||||
title: '問題 129:純元數可分性'
|
||||
challengeType: 5
|
||||
forumTopicId: 301756
|
||||
dashedName: problem-129-repunit-divisibility
|
||||
@ -8,20 +8,20 @@ dashedName: problem-129-repunit-divisibility
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
|
||||
完全由 1 組成的數字稱爲純元數(repunit)。 我們定義 $R(k)$ 爲長度爲 $k$ 的純元數;例如,$R(6) = 111111$。
|
||||
|
||||
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5.
|
||||
定義正整數 $n$ 滿足 $GCD(n, 10) = 1$,可以證明總是存在 $k$,使 $R(k)$ 可以被 $n$ 整除,記 $A(n)$ 爲滿足條件的 $k$ 的最小值;例如,$A(7) = 6$ 而 $A(41) = 5$。
|
||||
|
||||
The least value of n for which A(n) first exceeds ten is 17.
|
||||
使得 $A(n)$ 第一次超過 10 的 $n$ 的值是 17。
|
||||
|
||||
Find the least value of n for which A(n) first exceeds one-million.
|
||||
找到使得 $A(n)$ 第一次超過 100 萬的 $n$ 的值。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler129()` should return 1000023.
|
||||
`repunitDivisibility()` 應該返回 `1000023`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler129(), 1000023);
|
||||
assert.strictEqual(repunitDivisibility(), 1000023);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler129(), 1000023);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler129() {
|
||||
function repunitDivisibility() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler129();
|
||||
repunitDivisibility();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ee1000cf542c50ff00
|
||||
title: 'Problem 130: Composites with prime repunit property'
|
||||
title: '問題 130:具有素數純元數特性的合數'
|
||||
challengeType: 5
|
||||
forumTopicId: 301758
|
||||
dashedName: problem-130-composites-with-prime-repunit-property
|
||||
@ -8,22 +8,22 @@ dashedName: problem-130-composites-with-prime-repunit-property
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
|
||||
完全由 1 組成的數字稱爲純元數(repunit)。 我們定義 $R(k)$ 爲長度爲 $k$ 的純元數;例如, $R(6) = 111111$。
|
||||
|
||||
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5.
|
||||
定義正整數 $n$ 滿足 $GCD(n, 10) = 1$,可以證明總是存在 $k$,使 $R(k)$ 可以被 $n$ 整除,記 $A(n)$ 爲滿足條件的 $k$ 的最小值;例如,$A(7) = 6$ 而 $A(41) = 5$。
|
||||
|
||||
You are given that for all primes, p > 5, that p − 1 is divisible by A(p). For example, when p = 41, A(41) = 5, and 40 is divisible by 5.
|
||||
已知,對於所有的素數 $p > 5$,$p − 1$ 可以被 $A(p)$ 整除。 例如,當 $p = 41, A(41) = 5$,而 40 可以被 5 整除。
|
||||
|
||||
However, there are rare composite values for which this is also true; the first five examples being 91, 259, 451, 481, and 703.
|
||||
然而,也有一些罕見的複合值也是如此。前五個示例是 91、259、451、481 和 703。
|
||||
|
||||
Find the sum of the first twenty-five composite values of n for whichGCD(n, 10) = 1 and n − 1 is divisible by A(n).
|
||||
找出 $n$ 的前 25 個複合值的總和,其中 $GCD(n, 10) = 1$ 且 $n − 1$ 可被 $A(n)$ 整除。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler130()` should return 149253.
|
||||
`compositeRepunit()` 應該返回 `149253`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler130(), 149253);
|
||||
assert.strictEqual(compositeRepunit(), 149253);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler130(), 149253);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler130() {
|
||||
function compositeRepunit() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler130();
|
||||
compositeRepunit();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ef1000cf542c50ff02
|
||||
title: 'Problem 131: Prime cube partnership'
|
||||
title: '問題 131:立方夥伴素數'
|
||||
challengeType: 5
|
||||
forumTopicId: 301759
|
||||
dashedName: problem-131-prime-cube-partnership
|
||||
@ -8,20 +8,20 @@ dashedName: problem-131-prime-cube-partnership
|
||||
|
||||
# --description--
|
||||
|
||||
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
|
||||
存在一些素數 $p$,使得存在正整數 $n$,讓算式 $n^3 + n^{2}p$ 得到一個立方數。
|
||||
|
||||
For example, when p = 19, 83 + 82×19 = 123.
|
||||
例如當 $p = 19,\\ 8^3 + 8^2 × 19 = {12}^3$。
|
||||
|
||||
What is perhaps most surprising is that for each prime with this property the value of n is unique, and there are only four such primes below one-hundred.
|
||||
最奇特的是 $n$ 的值對於這個素數具有唯一性,100 以內只有四個這種素數。
|
||||
|
||||
How many primes below one million have this remarkable property?
|
||||
一百萬以下的素數有多少具有這種非凡特性?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler131()` should return 173.
|
||||
`primeCubePartnership()` 應該返回 `173`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler131(), 173);
|
||||
assert.strictEqual(primeCubePartnership(), 173);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler131(), 173);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler131() {
|
||||
function primeCubePartnership() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler131();
|
||||
primeCubePartnership();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f11000cf542c50ff03
|
||||
title: 'Problem 132: Large repunit factors'
|
||||
title: '問題 132:大純元數因子'
|
||||
challengeType: 5
|
||||
forumTopicId: 301760
|
||||
dashedName: problem-132-large-repunit-factors
|
||||
@ -8,18 +8,18 @@ dashedName: problem-132-large-repunit-factors
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k.
|
||||
完全由 1 組成的數字稱爲純元數(repunit)。 我們定義 $R(k)$ 爲長度 $k$ 的純元數。
|
||||
|
||||
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime factors is 9414.
|
||||
例如 $R(10) = 1111111111 = 11 × 41 × 271 × 9091$,則其素數因子的和爲 9414。
|
||||
|
||||
Find the sum of the first forty prime factors of R(109).
|
||||
求 $R({10}^9)$ 的前 40 個素數因子的和。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler132()` should return 843296.
|
||||
`largeRepunitFactors()` 應該返回 `843296`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler132(), 843296);
|
||||
assert.strictEqual(largeRepunitFactors(), 843296);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler132(), 843296);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler132() {
|
||||
function largeRepunitFactors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler132();
|
||||
largeRepunitFactors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f21000cf542c50ff04
|
||||
title: 'Problem 133: Repunit nonfactors'
|
||||
title: '問題 133:純元數非因子'
|
||||
challengeType: 5
|
||||
forumTopicId: 301761
|
||||
dashedName: problem-133-repunit-nonfactors
|
||||
@ -8,20 +8,20 @@ dashedName: problem-133-repunit-nonfactors
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
|
||||
完全由 1 組成的數字稱爲純元數。 定義 $R(k)$ 爲長度爲 $k$ 的純元數;例如,$R(6) = 111111$。
|
||||
|
||||
Let us consider repunits of the form R(10n).
|
||||
讓我們考慮形式爲 $R({10}^n)$ 的純元數。
|
||||
|
||||
Although R(10), R(100), or R(1000) are not divisible by 17, R(10000) is divisible by 17. Yet there is no value of n for which R(10n) will divide by 19. In fact, it is remarkable that 11, 17, 41, and 73 are the only four primes below one-hundred that can be a factor of R(10n).
|
||||
儘管 $R(10)$、$R(100)$ 或 $R(1000)$ 不能被 17 整除,但 $R(10000)$ 可以被 17 整除。 然而沒有 $R({10}^n)$ 可以被 19 整除。 值得注意的是,11、17、41 和 73 是僅有的四個小於 100 的質數可以是 $R({10}^n)$ 的因數。
|
||||
|
||||
Find the sum of all the primes below one-hundred thousand that will never be a factor of R(10n).
|
||||
求十萬以內不能成爲 $R({10}^n)$ 因子的素數的和。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler133()` should return 453647705.
|
||||
`repunitNonfactors()` 應該返回 `453647705`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler133(), 453647705);
|
||||
assert.strictEqual(repunitNonfactors(), 453647705);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler133(), 453647705);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler133() {
|
||||
function repunitNonfactors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler133();
|
||||
repunitNonfactors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f21000cf542c50ff05
|
||||
title: 'Problem 134: Prime pair connection'
|
||||
title: '問題 134:素數對連接'
|
||||
challengeType: 5
|
||||
forumTopicId: 301762
|
||||
dashedName: problem-134-prime-pair-connection
|
||||
@ -8,18 +8,18 @@ dashedName: problem-134-prime-pair-connection
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the consecutive primes p1 = 19 and p2 = 23. It can be verified that 1219 is the smallest number such that the last digits are formed by p1 whilst also being divisible by p2.
|
||||
考慮連續的素數 $p_1 = 19$ 和 $p_2 = 23$。 可以驗證 1219 是最小的以數字 $p_1$ 形成低位部分,而又能夠被 $p_2$ 整除的數字。
|
||||
|
||||
In fact, with the exception of p1 = 3 and p2 = 5, for every pair of consecutive primes, p2 > p1, there exist values of n for which the last digits are formed by p1 and n is divisible by p2. Let S be the smallest of these values of n.
|
||||
事實上,除了 $p_1 = 3$ 和 $p_2 = 5$ 之外,對於每對連續的素數,$p_2 > p_1$,都存在 $n$ 的值,其最後一位數字由 $p_1$ 組成而 $n$ 可以被 $p_2$ 整除。 記 $S$ 爲這種 $n$ 中的最小值。
|
||||
|
||||
Find ∑ S for every pair of consecutive primes with 5 ≤ p1 ≤ 1000000.
|
||||
對連續素數對 $5 ≤ p_1 ≤ 1000000$ 求 $\sum{S}$。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler134()` should return 18613426663617120.
|
||||
`primePairConnection()` 應得 `18613426663617120`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler134(), 18613426663617120);
|
||||
assert.strictEqual(primePairConnection(), 18613426663617120);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler134(), 18613426663617120);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler134() {
|
||||
function primePairConnection() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler134();
|
||||
primePairConnection();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f61000cf542c50ff09
|
||||
title: 'Problem 138: Special isosceles triangles'
|
||||
title: '問題 138:特殊的等腰三角形'
|
||||
challengeType: 5
|
||||
forumTopicId: 301766
|
||||
dashedName: problem-138-special-isosceles-triangles
|
||||
@ -8,16 +8,22 @@ dashedName: problem-138-special-isosceles-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the isosceles triangle with base length, b = 16, and legs, L = 17.
|
||||
考慮一個底邊長爲 $b = 16$,腰長爲 $L = 17$ 的等腰三角形。
|
||||
|
||||
By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 − 82) = 15, which is one less than the base length. With b = 272 and L = 305, we get h = 273, which is one more than the base length, and this is the second smallest isosceles triangle with the property that h = b ± 1. Find ∑ L for the twelve smallest isosceles triangles for which h = b ± 1 and b, L are positive integers.
|
||||
<img class="img-responsive center-block" alt="等腰三角形有兩條長度相等記爲 L 的腰,和一條記爲 b 底;則該三角形的高 h 爲從底邊作高至兩條腰的夾角。" src="https://cdn.freecodecamp.org/curriculum/project-euler/special-isosceles-triangles.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
使用畢達哥拉斯定理,可以求出三角形的高爲 $h = \sqrt{{17}^2 − 8^2} = 15$,恰好比底邊長度小 1。
|
||||
|
||||
當等腰三角形底邊長爲 $b = 272$,腰長爲 $L = 305$ 時,計算可得高爲 $h = 273$,恰好比底邊長度大 1,並且這是第二小的滿足性質 $h = b ± 1$ 的等腰三角形。
|
||||
|
||||
找到最小的 12 個滿足 $h = b ± 1$ 且 $b$,$L$ 均爲正整數的等腰三角形,求 $\sum{L}$。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler138()` should return 1118049290473932.
|
||||
`isoscelesTriangles()` 應該返回 `1118049290473932`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler138(), 1118049290473932);
|
||||
assert.strictEqual(isoscelesTriangles(), 1118049290473932);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +31,12 @@ assert.strictEqual(euler138(), 1118049290473932);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler138() {
|
||||
function isoscelesTriangles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler138();
|
||||
isoscelesTriangles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fd1000cf542c50ff10
|
||||
title: 'Problem 145: How many reversible numbers are there below one-billion?'
|
||||
title: '問題 145:有多少個小於十億的可逆數?'
|
||||
challengeType: 5
|
||||
forumTopicId: 301774
|
||||
dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||
@ -8,18 +8,18 @@ dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||
|
||||
# --description--
|
||||
|
||||
Some positive integers n have the property that the sum \[ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n).
|
||||
一些正整數 $n$ 滿足如下性質:該數與其逆序數之和 [ $n + reverse(n)$ ] 全部由奇數(十進制)組成。 例如,$36 + 63 = 99$ 和 $409 + 904 = 1313$。 我們稱這些數字是可逆的;所以 36、63、409 和 904 均爲可逆的。 無論是 $n$ 還是 $reverse(n)$ 均不允許出現前導零。
|
||||
|
||||
There are 120 reversible numbers below one-thousand.
|
||||
小於一千的可逆數有 120 個。
|
||||
|
||||
How many reversible numbers are there below one-billion (109)?
|
||||
請求出有多少個小於十億(${10}^9$)的可逆數?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler145()` should return 608720.
|
||||
`reversibleNumbers()` 應該返回 `608720`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler145(), 608720);
|
||||
assert.strictEqual(reversibleNumbers(), 608720);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler145(), 608720);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler145() {
|
||||
function reversibleNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler145();
|
||||
reversibleNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f36f1000cf542c50fe82
|
||||
title: 'Problem 3: Largest prime factor'
|
||||
title: '問題 3:最大素數因子'
|
||||
challengeType: 5
|
||||
forumTopicId: 301952
|
||||
dashedName: problem-3-largest-prime-factor
|
||||
@ -8,55 +8,55 @@ dashedName: problem-3-largest-prime-factor
|
||||
|
||||
# --description--
|
||||
|
||||
The prime factors of 13195 are 5, 7, 13 and 29.
|
||||
13195 的素數因子是 5、7、13 和 29。
|
||||
|
||||
What is the largest prime factor of the given `number`?
|
||||
求給出數 `number` 的最大素數因子是多少?
|
||||
|
||||
# --hints--
|
||||
|
||||
`largestPrimeFactor(2)` should return a number.
|
||||
`largestPrimeFactor(2)` 應該返回一個數字。
|
||||
|
||||
```js
|
||||
assert(typeof largestPrimeFactor(2) === 'number');
|
||||
```
|
||||
|
||||
`largestPrimeFactor(2)` should return 2.
|
||||
`largestPrimeFactor(2)` 應該返回 2。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(2), 2);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(3)` should return 3.
|
||||
`largestPrimeFactor(3)` 應該返回 3。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(3), 3);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(5)` should return 5.
|
||||
`largestPrimeFactor(5)` 應該返回 5。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(5), 5);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(7)` should return 7.
|
||||
`largestPrimeFactor(7)` 應該返回 7。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(7), 7);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(8)` should return 2.
|
||||
`largestPrimeFactor(8)` 應該返回 2。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(8), 2);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(13195)` should return 29.
|
||||
`largestPrimeFactor(13195)` 應該返回 29。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(13195), 29);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(600851475143)` should return 6857.
|
||||
`largestPrimeFactor(600851475143)` 應該返回 6857。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(600851475143), 6857);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 59669d08d75b60482359409f
|
||||
title: Date format
|
||||
title: 日期格式
|
||||
challengeType: 5
|
||||
forumTopicId: 302243
|
||||
dashedName: date-format
|
||||
@ -8,15 +8,15 @@ dashedName: date-format
|
||||
|
||||
# --description--
|
||||
|
||||
Return an array with two date strings of the current date with the following specifications:
|
||||
返回一個包含兩個當前日期字符串的數組,要求如下:
|
||||
|
||||
- The first string's date order should be the year number, month number, and day number separated by dashes (`-`).
|
||||
- The first string's year should be four digits in length.
|
||||
- The first string's month and day should not contain any leading zeros.
|
||||
- The second string's weekday and month names should not be abbreviated.
|
||||
- The second string's day should not contain any leading zeros.
|
||||
- 第一個字符串的日期順序爲年、月、日,中間用破折號 (`-`) 隔開。
|
||||
- 第一個字符串的年份長度爲四位數。
|
||||
- 第一個字符串的月份和日期不能包含任何前導零。
|
||||
- 第二個字符串的星期名稱和月份名稱不能縮寫。
|
||||
- 第二個字符串的日期不能包含任何前導零。
|
||||
|
||||
Example outputs:
|
||||
示例輸出:
|
||||
|
||||
```js
|
||||
['2007-11-23', 'Friday, November 23, 2007']
|
||||
@ -25,25 +25,25 @@ Example outputs:
|
||||
|
||||
# --hints--
|
||||
|
||||
`getDateFormats` should be a function.
|
||||
`getDateFormats` 應該是一個函數。
|
||||
|
||||
```js
|
||||
assert(typeof getDateFormats === 'function');
|
||||
```
|
||||
|
||||
`getDateFormats` should return an object.
|
||||
`getDateFormats` 應該返回一個對象。
|
||||
|
||||
```js
|
||||
assert(typeof getDateFormats() === 'object');
|
||||
```
|
||||
|
||||
`getDateFormats` should return an array with 2 elements.
|
||||
`getDateFormats` 應該返回一個包含兩個元素的數組。
|
||||
|
||||
```js
|
||||
assert(getDateFormats().length === 2);
|
||||
```
|
||||
|
||||
`getDateFormats` should return the correct date in the right format
|
||||
`getDateFormats` 應該返回格式無誤的正確日期。
|
||||
|
||||
```js
|
||||
assert.deepEqual(getDateFormats(), dates, equalsMessage);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ef1000cf542c50ff01
|
||||
title: 'Problem 129: Repunit divisibility'
|
||||
title: '问题 129:纯元数可分性'
|
||||
challengeType: 5
|
||||
forumTopicId: 301756
|
||||
dashedName: problem-129-repunit-divisibility
|
||||
@ -8,20 +8,20 @@ dashedName: problem-129-repunit-divisibility
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
|
||||
完全由 1 组成的数字称为纯元数(repunit)。 我们定义 $R(k)$ 为长度为 $k$ 的纯元数;例如,$R(6) = 111111$。
|
||||
|
||||
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5.
|
||||
定义正整数 $n$ 满足 $GCD(n, 10) = 1$,可以证明总是存在 $k$,使 $R(k)$ 可以被 $n$ 整除,记 $A(n)$ 为满足条件的 $k$ 的最小值;例如,$A(7) = 6$ 而 $A(41) = 5$。
|
||||
|
||||
The least value of n for which A(n) first exceeds ten is 17.
|
||||
使得 $A(n)$ 第一次超过 10 的 $n$ 的值是 17。
|
||||
|
||||
Find the least value of n for which A(n) first exceeds one-million.
|
||||
找到使得 $A(n)$ 第一次超过 100 万的 $n$ 的值。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler129()` should return 1000023.
|
||||
`repunitDivisibility()` 应该返回 `1000023`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler129(), 1000023);
|
||||
assert.strictEqual(repunitDivisibility(), 1000023);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler129(), 1000023);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler129() {
|
||||
function repunitDivisibility() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler129();
|
||||
repunitDivisibility();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ee1000cf542c50ff00
|
||||
title: 'Problem 130: Composites with prime repunit property'
|
||||
title: '问题 130:具有素数纯元数特性的合数'
|
||||
challengeType: 5
|
||||
forumTopicId: 301758
|
||||
dashedName: problem-130-composites-with-prime-repunit-property
|
||||
@ -8,22 +8,22 @@ dashedName: problem-130-composites-with-prime-repunit-property
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
|
||||
完全由 1 组成的数字称为纯元数(repunit)。 我们定义 $R(k)$ 为长度为 $k$ 的纯元数;例如, $R(6) = 111111$。
|
||||
|
||||
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n, and let A(n) be the least such value of k; for example, A(7) = 6 and A(41) = 5.
|
||||
定义正整数 $n$ 满足 $GCD(n, 10) = 1$,可以证明总是存在 $k$,使 $R(k)$ 可以被 $n$ 整除,记 $A(n)$ 为满足条件的 $k$ 的最小值;例如,$A(7) = 6$ 而 $A(41) = 5$。
|
||||
|
||||
You are given that for all primes, p > 5, that p − 1 is divisible by A(p). For example, when p = 41, A(41) = 5, and 40 is divisible by 5.
|
||||
已知,对于所有的素数 $p > 5$,$p − 1$ 可以被 $A(p)$ 整除。 例如,当 $p = 41, A(41) = 5$,而 40 可以被 5 整除。
|
||||
|
||||
However, there are rare composite values for which this is also true; the first five examples being 91, 259, 451, 481, and 703.
|
||||
然而,也有一些罕见的复合值也是如此。前五个示例是 91、259、451、481 和 703。
|
||||
|
||||
Find the sum of the first twenty-five composite values of n for whichGCD(n, 10) = 1 and n − 1 is divisible by A(n).
|
||||
找出 $n$ 的前 25 个复合值的总和,其中 $GCD(n, 10) = 1$ 且 $n − 1$ 可被 $A(n)$ 整除。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler130()` should return 149253.
|
||||
`compositeRepunit()` 应该返回 `149253`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler130(), 149253);
|
||||
assert.strictEqual(compositeRepunit(), 149253);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler130(), 149253);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler130() {
|
||||
function compositeRepunit() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler130();
|
||||
compositeRepunit();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3ef1000cf542c50ff02
|
||||
title: 'Problem 131: Prime cube partnership'
|
||||
title: '问题 131:立方伙伴素数'
|
||||
challengeType: 5
|
||||
forumTopicId: 301759
|
||||
dashedName: problem-131-prime-cube-partnership
|
||||
@ -8,20 +8,20 @@ dashedName: problem-131-prime-cube-partnership
|
||||
|
||||
# --description--
|
||||
|
||||
There are some prime values, p, for which there exists a positive integer, n, such that the expression n3 + n2p is a perfect cube.
|
||||
存在一些素数 $p$,使得存在正整数 $n$,让算式 $n^3 + n^{2}p$ 得到一个立方数。
|
||||
|
||||
For example, when p = 19, 83 + 82×19 = 123.
|
||||
例如当 $p = 19,\\ 8^3 + 8^2 × 19 = {12}^3$。
|
||||
|
||||
What is perhaps most surprising is that for each prime with this property the value of n is unique, and there are only four such primes below one-hundred.
|
||||
最奇特的是 $n$ 的值对于这个素数具有唯一性,100 以内只有四个这种素数。
|
||||
|
||||
How many primes below one million have this remarkable property?
|
||||
一百万以下的素数有多少具有这种非凡特性?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler131()` should return 173.
|
||||
`primeCubePartnership()` 应该返回 `173`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler131(), 173);
|
||||
assert.strictEqual(primeCubePartnership(), 173);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler131(), 173);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler131() {
|
||||
function primeCubePartnership() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler131();
|
||||
primeCubePartnership();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f11000cf542c50ff03
|
||||
title: 'Problem 132: Large repunit factors'
|
||||
title: '问题 132:大纯元数因子'
|
||||
challengeType: 5
|
||||
forumTopicId: 301760
|
||||
dashedName: problem-132-large-repunit-factors
|
||||
@ -8,18 +8,18 @@ dashedName: problem-132-large-repunit-factors
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k.
|
||||
完全由 1 组成的数字称为纯元数(repunit)。 我们定义 $R(k)$ 为长度 $k$ 的纯元数。
|
||||
|
||||
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime factors is 9414.
|
||||
例如 $R(10) = 1111111111 = 11 × 41 × 271 × 9091$,则其素数因子的和为 9414。
|
||||
|
||||
Find the sum of the first forty prime factors of R(109).
|
||||
求 $R({10}^9)$ 的前 40 个素数因子的和。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler132()` should return 843296.
|
||||
`largeRepunitFactors()` 应该返回 `843296`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler132(), 843296);
|
||||
assert.strictEqual(largeRepunitFactors(), 843296);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler132(), 843296);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler132() {
|
||||
function largeRepunitFactors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler132();
|
||||
largeRepunitFactors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f21000cf542c50ff04
|
||||
title: 'Problem 133: Repunit nonfactors'
|
||||
title: '问题 133:纯元数非因子'
|
||||
challengeType: 5
|
||||
forumTopicId: 301761
|
||||
dashedName: problem-133-repunit-nonfactors
|
||||
@ -8,20 +8,20 @@ dashedName: problem-133-repunit-nonfactors
|
||||
|
||||
# --description--
|
||||
|
||||
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k; for example, R(6) = 111111.
|
||||
完全由 1 组成的数字称为纯元数。 定义 $R(k)$ 为长度为 $k$ 的纯元数;例如,$R(6) = 111111$。
|
||||
|
||||
Let us consider repunits of the form R(10n).
|
||||
让我们考虑形式为 $R({10}^n)$ 的纯元数。
|
||||
|
||||
Although R(10), R(100), or R(1000) are not divisible by 17, R(10000) is divisible by 17. Yet there is no value of n for which R(10n) will divide by 19. In fact, it is remarkable that 11, 17, 41, and 73 are the only four primes below one-hundred that can be a factor of R(10n).
|
||||
尽管 $R(10)$、$R(100)$ 或 $R(1000)$ 不能被 17 整除,但 $R(10000)$ 可以被 17 整除。 然而没有 $R({10}^n)$ 可以被 19 整除。 值得注意的是,11、17、41 和 73 是仅有的四个小于 100 的质数可以是 $R({10}^n)$ 的因数。
|
||||
|
||||
Find the sum of all the primes below one-hundred thousand that will never be a factor of R(10n).
|
||||
求十万以内不能成为 $R({10}^n)$ 因子的素数的和。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler133()` should return 453647705.
|
||||
`repunitNonfactors()` 应该返回 `453647705`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler133(), 453647705);
|
||||
assert.strictEqual(repunitNonfactors(), 453647705);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler133(), 453647705);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler133() {
|
||||
function repunitNonfactors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler133();
|
||||
repunitNonfactors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f21000cf542c50ff05
|
||||
title: 'Problem 134: Prime pair connection'
|
||||
title: '问题 134:素数对连接'
|
||||
challengeType: 5
|
||||
forumTopicId: 301762
|
||||
dashedName: problem-134-prime-pair-connection
|
||||
@ -8,18 +8,18 @@ dashedName: problem-134-prime-pair-connection
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the consecutive primes p1 = 19 and p2 = 23. It can be verified that 1219 is the smallest number such that the last digits are formed by p1 whilst also being divisible by p2.
|
||||
考虑连续的素数 $p_1 = 19$ 和 $p_2 = 23$。 可以验证 1219 是最小的以数字 $p_1$ 形成低位部分,而又能够被 $p_2$ 整除的数字。
|
||||
|
||||
In fact, with the exception of p1 = 3 and p2 = 5, for every pair of consecutive primes, p2 > p1, there exist values of n for which the last digits are formed by p1 and n is divisible by p2. Let S be the smallest of these values of n.
|
||||
事实上,除了 $p_1 = 3$ 和 $p_2 = 5$ 之外,对于每对连续的素数,$p_2 > p_1$,都存在 $n$ 的值,其最后一位数字由 $p_1$ 组成而 $n$ 可以被 $p_2$ 整除。 记 $S$ 为这种 $n$ 中的最小值。
|
||||
|
||||
Find ∑ S for every pair of consecutive primes with 5 ≤ p1 ≤ 1000000.
|
||||
对连续素数对 $5 ≤ p_1 ≤ 1000000$ 求 $\sum{S}$。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler134()` should return 18613426663617120.
|
||||
`primePairConnection()` 应得 `18613426663617120`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler134(), 18613426663617120);
|
||||
assert.strictEqual(primePairConnection(), 18613426663617120);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler134(), 18613426663617120);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler134() {
|
||||
function primePairConnection() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler134();
|
||||
primePairConnection();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3f61000cf542c50ff09
|
||||
title: 'Problem 138: Special isosceles triangles'
|
||||
title: '问题 138:特殊的等腰三角形'
|
||||
challengeType: 5
|
||||
forumTopicId: 301766
|
||||
dashedName: problem-138-special-isosceles-triangles
|
||||
@ -8,16 +8,22 @@ dashedName: problem-138-special-isosceles-triangles
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the isosceles triangle with base length, b = 16, and legs, L = 17.
|
||||
考虑一个底边长为 $b = 16$,腰长为 $L = 17$ 的等腰三角形。
|
||||
|
||||
By using the Pythagorean theorem it can be seen that the height of the triangle, h = √(172 − 82) = 15, which is one less than the base length. With b = 272 and L = 305, we get h = 273, which is one more than the base length, and this is the second smallest isosceles triangle with the property that h = b ± 1. Find ∑ L for the twelve smallest isosceles triangles for which h = b ± 1 and b, L are positive integers.
|
||||
<img class="img-responsive center-block" alt="等腰三角形有两条长度相等记为 L 的腰,和一条记为 b 底;则该三角形的高 h 为从底边作高至两条腰的夹角。" src="https://cdn.freecodecamp.org/curriculum/project-euler/special-isosceles-triangles.png" style="background-color: white; padding: 10px;" />
|
||||
|
||||
使用毕达哥拉斯定理,可以求出三角形的高为 $h = \sqrt{{17}^2 − 8^2} = 15$,恰好比底边长度小 1。
|
||||
|
||||
当等腰三角形底边长为 $b = 272$,腰长为 $L = 305$ 时,计算可得高为 $h = 273$,恰好比底边长度大 1,并且这是第二小的满足性质 $h = b ± 1$ 的等腰三角形。
|
||||
|
||||
找到最小的 12 个满足 $h = b ± 1$ 且 $b$,$L$ 均为正整数的等腰三角形,求 $\sum{L}$。
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler138()` should return 1118049290473932.
|
||||
`isoscelesTriangles()` 应该返回 `1118049290473932`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler138(), 1118049290473932);
|
||||
assert.strictEqual(isoscelesTriangles(), 1118049290473932);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +31,12 @@ assert.strictEqual(euler138(), 1118049290473932);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler138() {
|
||||
function isoscelesTriangles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler138();
|
||||
isoscelesTriangles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f3fd1000cf542c50ff10
|
||||
title: 'Problem 145: How many reversible numbers are there below one-billion?'
|
||||
title: '问题 145:有多少个小于十亿的可逆数?'
|
||||
challengeType: 5
|
||||
forumTopicId: 301774
|
||||
dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||
@ -8,18 +8,18 @@ dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
||||
|
||||
# --description--
|
||||
|
||||
Some positive integers n have the property that the sum \[ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n).
|
||||
一些正整数 $n$ 满足如下性质:该数与其逆序数之和 [ $n + reverse(n)$ ] 全部由奇数(十进制)组成。 例如,$36 + 63 = 99$ 和 $409 + 904 = 1313$。 我们称这些数字是可逆的;所以 36、63、409 和 904 均为可逆的。 无论是 $n$ 还是 $reverse(n)$ 均不允许出现前导零。
|
||||
|
||||
There are 120 reversible numbers below one-thousand.
|
||||
小于一千的可逆数有 120 个。
|
||||
|
||||
How many reversible numbers are there below one-billion (109)?
|
||||
请求出有多少个小于十亿(${10}^9$)的可逆数?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler145()` should return 608720.
|
||||
`reversibleNumbers()` 应该返回 `608720`。
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler145(), 608720);
|
||||
assert.strictEqual(reversibleNumbers(), 608720);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler145(), 608720);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler145() {
|
||||
function reversibleNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler145();
|
||||
reversibleNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f36f1000cf542c50fe82
|
||||
title: 'Problem 3: Largest prime factor'
|
||||
title: '问题 3:最大素数因子'
|
||||
challengeType: 5
|
||||
forumTopicId: 301952
|
||||
dashedName: problem-3-largest-prime-factor
|
||||
@ -8,55 +8,55 @@ dashedName: problem-3-largest-prime-factor
|
||||
|
||||
# --description--
|
||||
|
||||
The prime factors of 13195 are 5, 7, 13 and 29.
|
||||
13195 的素数因子是 5、7、13 和 29。
|
||||
|
||||
What is the largest prime factor of the given `number`?
|
||||
求给出数 `number` 的最大素数因子是多少?
|
||||
|
||||
# --hints--
|
||||
|
||||
`largestPrimeFactor(2)` should return a number.
|
||||
`largestPrimeFactor(2)` 应该返回一个数字。
|
||||
|
||||
```js
|
||||
assert(typeof largestPrimeFactor(2) === 'number');
|
||||
```
|
||||
|
||||
`largestPrimeFactor(2)` should return 2.
|
||||
`largestPrimeFactor(2)` 应该返回 2。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(2), 2);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(3)` should return 3.
|
||||
`largestPrimeFactor(3)` 应该返回 3。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(3), 3);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(5)` should return 5.
|
||||
`largestPrimeFactor(5)` 应该返回 5。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(5), 5);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(7)` should return 7.
|
||||
`largestPrimeFactor(7)` 应该返回 7。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(7), 7);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(8)` should return 2.
|
||||
`largestPrimeFactor(8)` 应该返回 2。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(8), 2);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(13195)` should return 29.
|
||||
`largestPrimeFactor(13195)` 应该返回 29。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(13195), 29);
|
||||
```
|
||||
|
||||
`largestPrimeFactor(600851475143)` should return 6857.
|
||||
`largestPrimeFactor(600851475143)` 应该返回 6857。
|
||||
|
||||
```js
|
||||
assert.strictEqual(largestPrimeFactor(600851475143), 6857);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 59669d08d75b60482359409f
|
||||
title: Date format
|
||||
title: 日期格式
|
||||
challengeType: 5
|
||||
forumTopicId: 302243
|
||||
dashedName: date-format
|
||||
@ -8,15 +8,15 @@ dashedName: date-format
|
||||
|
||||
# --description--
|
||||
|
||||
Return an array with two date strings of the current date with the following specifications:
|
||||
返回一个包含两个当前日期字符串的数组,要求如下:
|
||||
|
||||
- The first string's date order should be the year number, month number, and day number separated by dashes (`-`).
|
||||
- The first string's year should be four digits in length.
|
||||
- The first string's month and day should not contain any leading zeros.
|
||||
- The second string's weekday and month names should not be abbreviated.
|
||||
- The second string's day should not contain any leading zeros.
|
||||
- 第一个字符串的日期顺序为年、月、日,中间用破折号 (`-`) 隔开。
|
||||
- 第一个字符串的年份长度为四位数。
|
||||
- 第一个字符串的月份和日期不能包含任何前导零。
|
||||
- 第二个字符串的星期名称和月份名称不能缩写。
|
||||
- 第二个字符串的日期不能包含任何前导零。
|
||||
|
||||
Example outputs:
|
||||
示例输出:
|
||||
|
||||
```js
|
||||
['2007-11-23', 'Friday, November 23, 2007']
|
||||
@ -25,25 +25,25 @@ Example outputs:
|
||||
|
||||
# --hints--
|
||||
|
||||
`getDateFormats` should be a function.
|
||||
`getDateFormats` 应该是一个函数。
|
||||
|
||||
```js
|
||||
assert(typeof getDateFormats === 'function');
|
||||
```
|
||||
|
||||
`getDateFormats` should return an object.
|
||||
`getDateFormats` 应该返回一个对象。
|
||||
|
||||
```js
|
||||
assert(typeof getDateFormats() === 'object');
|
||||
```
|
||||
|
||||
`getDateFormats` should return an array with 2 elements.
|
||||
`getDateFormats` 应该返回一个包含两个元素的数组。
|
||||
|
||||
```js
|
||||
assert(getDateFormats().length === 2);
|
||||
```
|
||||
|
||||
`getDateFormats` should return the correct date in the right format
|
||||
`getDateFormats` 应该返回格式无误的正确日期。
|
||||
|
||||
```js
|
||||
assert.deepEqual(getDateFormats(), dates, equalsMessage);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45d1000cf542c50ff70
|
||||
title: 'Problem 241: Perfection Quotients'
|
||||
title: 'Problema 241: Quociente de perfeição'
|
||||
challengeType: 5
|
||||
forumTopicId: 301888
|
||||
dashedName: problem-241-perfection-quotients
|
||||
@ -8,18 +8,20 @@ dashedName: problem-241-perfection-quotients
|
||||
|
||||
# --description--
|
||||
|
||||
For a positive integer n, let σ(n) be the sum of all divisors of n, so e.g. σ(6) = 1 + 2 + 3 + 6 = 12.
|
||||
Para um inteiro positivo $n$, considere $σ(n)$ como a soma de todos os divisores de $n$, por exemplo $σ(6) = 1 + 2 + 3 + 6 = 12$.
|
||||
|
||||
A perfect number, as you probably know, is a number with σ(n) = 2n.
|
||||
Um número perfeito, como você provavelmente já sabe, é um número com $σ(n) = 2n$.
|
||||
|
||||
Let us define the perfection quotient of a positive integer asp(n)= σ(n)n . Find the sum of all positive integers n ≤ 1018 for which p(n) has the form k + 1⁄2, where k is an integer.
|
||||
Vamos definir o quociente de perfeição de um inteiro positivo como $p(n) = \frac{σ(n)}{n}$.
|
||||
|
||||
Encontre a soma de todos os números inteiros positivos $n ≤ {10}^{18}$ para os quais $p(n)$ tem o formato $k + \frac{1}{2}$, onde $k$ é um número inteiro.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler241()` should return 482316491800641150.
|
||||
`perfectionQuotients()` deve retornar `482316491800641150`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler241(), 482316491800641150);
|
||||
assert.strictEqual(perfectionQuotients(), 482316491800641150);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +29,12 @@ assert.strictEqual(euler241(), 482316491800641150);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler241() {
|
||||
function perfectionQuotients() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler241();
|
||||
perfectionQuotients();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f45f1000cf542c50ff71
|
||||
title: 'Problem 242: Odd Triplets'
|
||||
title: 'Problema 242: Trios de números ímpares'
|
||||
challengeType: 5
|
||||
forumTopicId: 301889
|
||||
dashedName: problem-242-odd-triplets
|
||||
@ -8,20 +8,20 @@ dashedName: problem-242-odd-triplets
|
||||
|
||||
# --description--
|
||||
|
||||
Given the set {1,2,...,n}, we define f(n,k) as the number of its k-element subsets with an odd sum of elements. For example, f(5,3) = 4, since the set {1,2,3,4,5} has four 3-element subsets having an odd sum of elements, i.e.: {1,2,4}, {1,3,5}, {2,3,4} and {2,4,5}.
|
||||
Dado o conjunto {1,2,..., $n$}, definimos $f(n, k)$ como o número de seus subconjuntos de $k$ elementos com uma soma ímpar de elementos. Por exemplo, $f(5,3) = 4$, já que o conjunto {1,2,3,4,5} tem quatro subconjuntos de 3 elementos com uma soma ímpar de elementos, sejam eles: {1,2,4}, {1,3,5}, {2,3,4} e {2,4,5}.
|
||||
|
||||
When all three values n, k and f(n,k) are odd, we say that they make an odd-triplet \[n,k,f(n,k)].
|
||||
Quando todos os três valores de $n$, $k$ e $f(n, k)$ são ímpares, dizemos que eles fazem um trio de ímpares $[n, k, f(n, k)]$.
|
||||
|
||||
There are exactly five odd-triplets with n ≤ 10, namely: \[1,1,f(1,1) = 1], \[5,1,f(5,1) = 3], \[5,5,f(5,5) = 1], \[9,1,f(9,1) = 5] and \[9,9,f(9,9) = 1].
|
||||
Há exatamente cinco trios de ímpares com $n ≤ 10$. São eles: $[1, 1, f(1, 1) = 1]$, $[5, 1, f(5, 1) = 3]$, $[5, 5, f(5, 5) = 1]$, $[9, 1, f(9, 1) = 5]$ e $[9, 9, f(9, 9) = 1]$.
|
||||
|
||||
How many odd-triplets are there with n ≤ 1012 ?
|
||||
Quantos trios de ímpares existem com $n ≤ {10}^{12}$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler242()` should return 997104142249036700.
|
||||
`oddTriplets()` deve retornar `997104142249036700`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler242(), 997104142249036700);
|
||||
assert.strictEqual(oddTriplets(), 997104142249036700);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +29,12 @@ assert.strictEqual(euler242(), 997104142249036700);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler242() {
|
||||
function oddTriplets() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler242();
|
||||
oddTriplets();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4601000cf542c50ff73
|
||||
title: 'Problem 243: Resilience'
|
||||
title: 'Problema 243: Resiliência'
|
||||
challengeType: 5
|
||||
forumTopicId: 301890
|
||||
dashedName: problem-243-resilience
|
||||
@ -8,20 +8,26 @@ dashedName: problem-243-resilience
|
||||
|
||||
# --description--
|
||||
|
||||
A positive fraction whose numerator is less than its denominator is called a proper fraction.
|
||||
Uma fração positiva cujo numerador é menor do que o seu denominador é chamada de fração adequada.
|
||||
|
||||
For any denominator, d, there will be d−1 proper fractions; for example, with d = 12:1/12 , 2/12 , 3/12 , 4/12 , 5/12 , 6/12 , 7/12 , 8/12 , 9/12 , 10/12 , 11/12 .
|
||||
Para qualquer denominador, $d$, haverá $d−1$ frações adequadas; por exemplo, com $d = 12$:
|
||||
|
||||
We shall call a fraction that cannot be cancelled down a resilient fraction. Furthermore we shall define the resilience of a denominator, R(d), to be the ratio of its proper fractions that are resilient; for example, R(12) = 4/11 . In fact, d = 12 is the smallest denominator having a resilience R(d) < 4/10 .
|
||||
$$\frac{1}{12}, \frac{2}{12}, \frac{3}{12}, \frac{4}{12}, \frac{5}{12}, \frac{6}{12}, \frac{7}{12}, \frac{8}{12}, \frac{9}{12}, \frac{10}{12}, \frac{11}{12}$$
|
||||
|
||||
Find the smallest denominator d, having a resilience R(d) < 15499/94744 .
|
||||
Chamaremos uma fração que não pode ser anulada de uma fração resiliente.
|
||||
|
||||
Além disso, definiremos a resiliência de um denominador, $R(d)$, como a razão entre suas frações adequadas que são resilientes; por exemplo, $R(12) = \frac{4}{11}$.
|
||||
|
||||
De fato, $d = 12$ é o menor denominador que tem uma resiliência $R(d) < \frac{4}{10}$.
|
||||
|
||||
Encontre o menor denominador $d$, tendo uma resiliência $R(d) < \frac{15.499}{94.744}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler243()` should return 892371480.
|
||||
`resilience()` deve retornar `892371480`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler243(), 892371480);
|
||||
assert.strictEqual(resilience(), 892371480);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +35,12 @@ assert.strictEqual(euler243(), 892371480);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler243() {
|
||||
function resilience() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler243();
|
||||
resilience();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4601000cf542c50ff72
|
||||
title: 'Problem 244: Sliders'
|
||||
title: 'Problema 244: Blocos deslizantes'
|
||||
challengeType: 5
|
||||
forumTopicId: 301891
|
||||
dashedName: problem-244-sliders
|
||||
@ -8,30 +8,32 @@ dashedName: problem-244-sliders
|
||||
|
||||
# --description--
|
||||
|
||||
You probably know the game Fifteen Puzzle. Here, instead of numbered tiles, we have seven red tiles and eight blue tiles.
|
||||
Você provavelmente conhece o Jogo do Quinze. Aqui, em vez de blocos numerados, temos sete blocos vermelhos e oito blocos azuis.
|
||||
|
||||
A move is denoted by the uppercase initial of the direction (Left, Right, Up, Down) in which the tile is slid, e.g. starting from configuration (S), by the sequence LULUR we reach the configuration (E):
|
||||
Um movimento é indicado pela primeira letra maiúscula da direção (Left - Esquerda, Right - Direita, Up - Acima e Down - Abaixo) na qual o bloco é deslizado, ou seja, a partir da configuração ($S$), pela sequência $LULUR$ que chegamos à configuração ($E$):
|
||||
|
||||
(S), (E)
|
||||
($S$) <img class="img-responsive" alt="configuration S" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-1.gif" style="display: inline-block; background-color: white; padding: 10px;" />, ($E$) <img class="img-responsive" alt="configuração E" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-2.gif" style="display: inline-block; background-color: white; padding: 10px;" />
|
||||
|
||||
For each path, its checksum is calculated by (pseudocode):
|
||||
Para cada caminho, seu valor de verificação é calculado por (pseudocódigo):
|
||||
|
||||
checksum = 0 checksum = (checksum × 243 + m1) mod 100 000 007 checksum = (checksum × 243 + m2) mod 100 000 007 … checksum = (checksum × 243 + mn) mod 100 000 007 where mk is the ASCII value of the kth letter in the move sequence and the ASCII values for the moves are:
|
||||
$$\begin{align} & \text{checksum} = 0 \\\\ & \text{checksum} = (\text{checksum} × 243 + m_1) \\; \text{mod} \\; 100\\,000\\,007 \\\\ & \text{checksum} = (\text{checksum} × 243 + m_2) \\; \text{mod} \\; 100\\,000\\,007 \\\\ & \ldots \\\\ & \text{checksum} = (\text{checksum} × 243 + m_n) \\; \text{mod} \\; 100\\,000\\,007 \end{align}$$
|
||||
|
||||
L76R82U85D68
|
||||
onde $m_k$ é o valor ASCII da $k^{\text{a}}$ letra na sequência de movimento e os valores ASCII dos movimentos são:
|
||||
|
||||
For the sequence LULUR given above, the checksum would be 19761398. Now, starting from configuration (S), find all shortest ways to reach configuration (T).
|
||||
$$\begin{array}{|c|c|} \hline L & 76 \\\\ \hline R & 82 \\\\ \hline U & 85 \\\\ \hline D & 68 \\\\ \hline \end{array}$$
|
||||
|
||||
(S), (T)
|
||||
Para a sequência $LULUR$ dada acima, o checksum seria 19761398. Agora, começando pela configuração ($S$), encontre todas as formas mais curtas para chegar à configuração ($T$).
|
||||
|
||||
What is the sum of all checksums for the paths having the minimal length?
|
||||
($S$) <img class="img-responsive center-block" alt="configuration S" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-3.gif" style="display: inline-block; background-color: white; padding: 10px;" />, ($T$) <img class="img-responsive center-block" alt="configuração T" src="https://cdn.freecodecamp.org/curriculum/project-euler/sliders-4.gif" style="display: inline-block; background-color: white; padding: 10px;" />
|
||||
|
||||
Qual é a soma de todas as somas de checksums para os percursos de menor comprimento?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler244()` should return 96356848.
|
||||
`sliders()` deve retornar `96356848`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler244(), 96356848);
|
||||
assert.strictEqual(sliders(), 96356848);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +41,12 @@ assert.strictEqual(euler244(), 96356848);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler244() {
|
||||
function sliders() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler244();
|
||||
sliders();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4621000cf542c50ff74
|
||||
title: 'Problem 245: Coresilience'
|
||||
title: 'Problema 245: Corresiliência'
|
||||
challengeType: 5
|
||||
forumTopicId: 301892
|
||||
dashedName: problem-245-coresilience
|
||||
@ -8,16 +8,24 @@ dashedName: problem-245-coresilience
|
||||
|
||||
# --description--
|
||||
|
||||
We shall call a fraction that cannot be cancelled down a resilient fraction. Furthermore we shall define the resilience of a denominator, R(d), to be the ratio of its proper fractions that are resilient; for example, R(12) = 4⁄11.
|
||||
Chamaremos uma fração que não pode ser anulada de uma fração resiliente.
|
||||
|
||||
The resilience of a number d > 1 is then φ(d)d − 1 , where φ is Euler's totient function. We further define the coresilience of a number n > 1 as C(n)= n − φ(n)n − 1. The coresilience of a prime p is C(p) = 1p − 1. Find the sum of all composite integers 1 < n ≤ 2×1011, for which C(n) is a unit fraction.
|
||||
Além disso, definiremos a resiliência de um denominador, $R(d)$, como a razão entre suas frações adequadas que são resilientes; por exemplo, $R(12) = \frac{4}{11}$.
|
||||
|
||||
A resiliência de um número $d > 1$ é então $\frac{φ(d)}{d − 1}$, onde $φ$ é a função tociente de Euler.
|
||||
|
||||
Também definiremos a corresiliência de um número $n > 1$ como $C(n) = \frac{n − φ(n)}{n − 1}$.
|
||||
|
||||
A corresiliência de um número primo $p$ é $C(p) = \frac{1}{p − 1}$.
|
||||
|
||||
Encontre a soma de todos os números inteiros compostos $1 < n ≤ 2 × {10}^{11}$, para os quais $C(n)$ é uma fração unitária.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler245()` should return 288084712410001.
|
||||
`coresilience()` deve retornar `288084712410001`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler245(), 288084712410001);
|
||||
assert.strictEqual(coresilience(), 288084712410001);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +33,12 @@ assert.strictEqual(euler245(), 288084712410001);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler245() {
|
||||
function coresilience() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler245();
|
||||
coresilience();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4621000cf542c50ff75
|
||||
title: 'Problem 246: Tangents to an ellipse'
|
||||
title: 'Problema 246: Tangentes de uma elipse'
|
||||
challengeType: 5
|
||||
forumTopicId: 301893
|
||||
dashedName: problem-246-tangents-to-an-ellipse
|
||||
@ -8,22 +8,34 @@ dashedName: problem-246-tangents-to-an-ellipse
|
||||
|
||||
# --description--
|
||||
|
||||
A definition for an ellipse is:
|
||||
Uma definição para uma elipse é:
|
||||
|
||||
Given a circle c with centre M and radius r and a point G such that d(G,M)
|
||||
Dado um círculo $c$ com centro $M$ e raio $r$, além de um ponto $G$ tal que $d(G, M) < r$, o local dos pontos que estão equidistantes de $c$ e $G$ formam uma elipse.
|
||||
|
||||
The construction of the points of the ellipse is shown below.
|
||||
A construção dos pontos da elipse é mostrada abaixo.
|
||||
|
||||
Given are the points M(-2000,1500) and G(8000,1500). Given is also the circle c with centre M and radius 15000. The locus of the points that are equidistant from G and c form an ellipse e. From a point P outside e the two tangents t1 and t2 to the ellipse are drawn. Let the points where t1 and t2 touch the ellipse be R and S.
|
||||
<img class="img-responsive center-block" alt="animação de construção da elipse" src="https://cdn.freecodecamp.org/curriculum/project-euler/tangents-to-an-ellipse-1.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
For how many lattice points P is angle RPS greater than 45 degrees?
|
||||
São dados os pontos $M(-2000, 1500)$ e $G(8000, 1500)$.
|
||||
|
||||
Também é dado o círculo $c$ com centro $M$ e raio $15.000$.
|
||||
|
||||
A localidade dos pontos que estão equidistantes de $G$ e $c$ forma uma elipse $e$.
|
||||
|
||||
De um ponto $P$ fora de $e$ as duas tangentes $t_1$ e $t_2$ da elipse são desenhadas.
|
||||
|
||||
Considere os pontos em que $t_1$ e $t_2$ tocam a elipse como $R$ e $S$.
|
||||
|
||||
<img class="img-responsive center-block" alt="círculo c com o centro M, raio 15000 e ponto P fora da elipse; do ponto P, duas tangentes t_1 e t_2 são desenhadas para a elipse, com pontos que a tocam chamados R e S" src="https://cdn.freecodecamp.org/curriculum/project-euler/tangents-to-an-ellipse-2.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Para quantos pontos da rede $P$ é um ângulo $RPS$ maior que 45°?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler246()` should return 810834388.
|
||||
`tangentsToAnEllipse()` deve retornar `810834388`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler246(), 810834388);
|
||||
assert.strictEqual(tangentsToAnEllipse(), 810834388);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +43,12 @@ assert.strictEqual(euler246(), 810834388);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler246() {
|
||||
function tangentsToAnEllipse() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler246();
|
||||
tangentsToAnEllipse();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4641000cf542c50ff76
|
||||
title: 'Problem 247: Squares under a hyperbola'
|
||||
title: 'Problema 247: Quadrados sob uma hipérbole'
|
||||
challengeType: 5
|
||||
forumTopicId: 301894
|
||||
dashedName: problem-247-squares-under-a-hyperbola
|
||||
@ -8,20 +8,32 @@ dashedName: problem-247-squares-under-a-hyperbola
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the region constrained by 1 ≤ x and 0 ≤ y ≤ 1/x.
|
||||
Considere a região restringida por $1 ≤ x$ e $0 ≤ y ≤ \frac{1}{x}$.
|
||||
|
||||
Let S1 be the largest square that can fit under the curve. Let S2 be the largest square that fits in the remaining area, and so on. Let the index of Sn be the pair (left, below) indicating the number of squares to the left of Sn and the number of squares below Sn.
|
||||
Considere $S_1$ como o maior quadrado que pode caber sob a curva.
|
||||
|
||||
The diagram shows some such squares labelled by number. S2 has one square to its left and none below, so the index of S2 is (1,0). It can be seen that the index of S32 is (1,1) as is the index of S50. 50 is the largest n for which the index of Sn is (1,1).
|
||||
Considere $S_2$ como o maior quadrado que cabe na área restante, e assim por diante.
|
||||
|
||||
What is the largest n for which the index of Sn is (3,3)?
|
||||
Considere o índice de $S_n$ como o par (esquerda, abaixo) indicando o número de quadrados à esquerda de $S_n$ e o número de quadrados abaixo de $S_n$.
|
||||
|
||||
<img class="img-responsive center-block" alt="diagrama com quadrados sob a hipérbole" src="https://cdn.freecodecamp.org/curriculum/project-euler/squares-under-a-hyperbola.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
O diagrama mostra alguns desses quadrados rotulados por número.
|
||||
|
||||
$S_2$ tem um quadrado à sua esquerda e nenhum abaixo, então o índice de $S_2$ é (1, 0).
|
||||
|
||||
Podemos ver que o índice de $S_{32}$ é (1,1) como é o índice de $S_{50}$.
|
||||
|
||||
50 é o maior $n$ para o qual o índice de $S_n$ é (1, 1).
|
||||
|
||||
3 é o maior $n$ para o qual o índice de $S_n$ é (3, 3)?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler247()` should return 782252.
|
||||
`squaresUnderAHyperbola()` deve retornar `782252`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler247(), 782252);
|
||||
assert.strictEqual(squaresUnderAHyperbola(), 782252);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +41,12 @@ assert.strictEqual(euler247(), 782252);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler247() {
|
||||
function squaresUnderAHyperbola() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler247();
|
||||
squaresUnderAHyperbola();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4651000cf542c50ff77
|
||||
title: 'Problem 248: Numbers for which Euler’s totient function equals 13!'
|
||||
title: 'Problema 248: Números para os quais a função tociente de Euler é igual a 13!'
|
||||
challengeType: 5
|
||||
forumTopicId: 301895
|
||||
dashedName: problem-248-numbers-for-which-eulers-totient-function-equals-13
|
||||
@ -8,16 +8,16 @@ dashedName: problem-248-numbers-for-which-eulers-totient-function-equals-13
|
||||
|
||||
# --description--
|
||||
|
||||
The first number n for which φ(n)=13! is 6227180929.
|
||||
O primeiro número $n$ para o qual $φ(n) = 13!$ é $6.227.180.929$.
|
||||
|
||||
Find the 150,000th such number.
|
||||
Encontre o ${150.000}^{\text{o}}$ número desse tipo.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler248()` should return 23507044290.
|
||||
`eulersTotientFunctionEquals()` deve retornar `23507044290`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler248(), 23507044290);
|
||||
assert.strictEqual(eulersTotientFunctionEquals(), 23507044290);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +25,12 @@ assert.strictEqual(euler248(), 23507044290);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler248() {
|
||||
function eulersTotientFunctionEquals() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler248();
|
||||
eulersTotientFunctionEquals();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4671000cf542c50ff79
|
||||
title: 'Problem 249: Prime Subset Sums'
|
||||
title: 'Problema 249: Soma de subconjuntos de números primos'
|
||||
challengeType: 5
|
||||
forumTopicId: 301896
|
||||
dashedName: problem-249-prime-subset-sums
|
||||
@ -8,18 +8,18 @@ dashedName: problem-249-prime-subset-sums
|
||||
|
||||
# --description--
|
||||
|
||||
Let S = {2, 3, 5, ..., 4999} be the set of prime numbers less than 5000.
|
||||
Considere $S = \\{2, 3, 5, \ldots, 4999\\}$ como o conjunto de números primos menores que 5000.
|
||||
|
||||
Find the number of subsets of S, the sum of whose elements is a prime number.
|
||||
Encontre o número de subconjuntos de $S$, cuja soma dos elementos é um número primo.
|
||||
|
||||
Enter the rightmost 16 digits as your answer.
|
||||
Insira os 16 algarismos mais à direita para sua resposta.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler249()` should return 9275262564250418.
|
||||
`primeSubsetSums()` deve retornar `9275262564250418`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler249(), 9275262564250418);
|
||||
assert.strictEqual(primeSubsetSums(), 9275262564250418);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +27,12 @@ assert.strictEqual(euler249(), 9275262564250418);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler249() {
|
||||
function primeSubsetSums() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler249();
|
||||
primeSubsetSums();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4661000cf542c50ff78
|
||||
title: 'Problem 250: 250250'
|
||||
title: 'Problema 250: 250250'
|
||||
challengeType: 5
|
||||
forumTopicId: 301898
|
||||
dashedName: problem-250-250250
|
||||
@ -8,14 +8,14 @@ dashedName: problem-250-250250
|
||||
|
||||
# --description--
|
||||
|
||||
Find the number of non-empty subsets of {11, 22, 33,..., 250250250250}, the sum of whose elements is divisible by 250. Enter the rightmost 16 digits as your answer.
|
||||
Encontre o número de subconjuntos não vazios de $\\{11, 22, 33, \ldots, {250250}^{250250}\\}$, cuja soma de elementos é divisível por 250. Insira os 16 algarismos mais à direita para sua resposta.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler250()` should return 1425480602091519.
|
||||
`twoHundredFifty()` deve retornar `1425480602091519`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler250(), 1425480602091519);
|
||||
assert.strictEqual(twoHundredFifty(), 1425480602091519);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -23,12 +23,12 @@ assert.strictEqual(euler250(), 1425480602091519);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler250() {
|
||||
function twoHundredFifty() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler250();
|
||||
twoHundredFifty();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4671000cf542c50ff7a
|
||||
title: 'Problem 251: Cardano Triplets'
|
||||
title: 'Problema 251: Trios de Cardano'
|
||||
challengeType: 5
|
||||
forumTopicId: 301899
|
||||
dashedName: problem-251-cardano-triplets
|
||||
@ -8,20 +8,22 @@ dashedName: problem-251-cardano-triplets
|
||||
|
||||
# --description--
|
||||
|
||||
A triplet of positive integers (a,b,c) is called a Cardano Triplet if it satisfies the condition:
|
||||
Um triplo de números inteiros positivos ($a$,$b$,$c$) é chamado de trio de Cardano se satisfizer a condição:
|
||||
|
||||
For example, (2,1,5) is a Cardano Triplet.
|
||||
$$\sqrt[3]{a + b \sqrt{c}} + \sqrt[3]{a - b \sqrt{c}} = 1$$
|
||||
|
||||
There exist 149 Cardano Triplets for which a+b+c ≤ 1000.
|
||||
Por exemplo, (2,1,5) é um trio de Cardano.
|
||||
|
||||
Find how many Cardano Triplets exist such that a+b+c ≤ 110,000,000.
|
||||
Há 149 trios de Cardano para os quais $a + b + c ≤ 1000$.
|
||||
|
||||
Encontre quantos trios de Cardano existem tal que $a + b + c ≤ 110.000.000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler251()` should return 18946051.
|
||||
`cardanoTriplets()` deve retornar `18946051`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler251(), 18946051);
|
||||
assert.strictEqual(cardanoTriplets(), 18946051);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -29,12 +31,12 @@ assert.strictEqual(euler251(), 18946051);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler251() {
|
||||
function cardanoTriplets() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler251();
|
||||
cardanoTriplets();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4691000cf542c50ff7b
|
||||
title: 'Problem 252: Convex Holes'
|
||||
title: 'Problema 252: Orifícios convexos'
|
||||
challengeType: 5
|
||||
forumTopicId: 301900
|
||||
dashedName: problem-252-convex-holes
|
||||
@ -8,24 +8,26 @@ dashedName: problem-252-convex-holes
|
||||
|
||||
# --description--
|
||||
|
||||
Given a set of points on a plane, we define a convex hole to be a convex polygon having as vertices any of the given points and not containing any of the given points in its interior (in addition to the vertices, other given points may lie on the perimeter of the polygon).
|
||||
Dado um conjunto de pontos em um plano, definimos um orifício convexo como um polígono convexo que tenha como vértices qualquer um dos pontos dados e não contenha nenhum dos pontos dados em seu interior (além dos vértices, outros pontos dados podem estar no perímetro do polígono).
|
||||
|
||||
As an example, the image below shows a set of twenty points and a few such convex holes. The convex hole shown as a red heptagon has an area equal to 1049694.5 square units, which is the highest possible area for a convex hole on the given set of points.
|
||||
Como exemplo, a imagem abaixo apresenta um conjunto de vinte pontos e alguns desses orifícios convexos. O orifício convexo mostrado como um heptágono vermelho tem uma área igual a 1049694,5 unidades quadradas, que é a maior área possível para um orifício convexo no conjunto de pontos fornecido.
|
||||
|
||||
For our example, we used the first 20 points (T2k−1, T2k), for k = 1,2,…,20, produced with the pseudo-random number generator:
|
||||
<img class="img-responsive center-block" alt="conjunto de vinte pontos e orifícios convexos no plano" src="https://cdn.freecodecamp.org/curriculum/project-euler/convex-holes.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
S0 = 290797 Sn+1 = Sn2 mod 50515093 Tn = ( Sn mod 2000 ) − 1000
|
||||
Para nosso exemplo, usamos os primeiros 20 pontos ($T_{2k − 1}$, $T_{2k}$), para $k = 1, 2, \ldots, 20$, produzido com o gerador de números pseudoaleatório:
|
||||
|
||||
i.e. (527, 144), (−488, 732), (−454, −947), …
|
||||
$$\begin{align} S_0 & = 290.797 \\\\ S_{n+1} & = {S_n}^2 \\; \text{mod} \\; 50.515.093 \\\\ T_n & = (S_n \\; \text{mod} \\; 2000) − 1000 \end{align}$$
|
||||
|
||||
What is the maximum area for a convex hole on the set containing the first 500 points in the pseudo-random sequence? Specify your answer including one digit after the decimal point.
|
||||
por exemplo: (527, 144), (-488, 732), (-454, − 947), …
|
||||
|
||||
Qual é a área máxima para um orifício convexo no conjunto que contém os primeiros 500 pontos da sequência pseudoaleatória? Dê sua resposta com 1 algarismo após o ponto (1 casa depois da vírgula).
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler252()` should return 104924.
|
||||
`convexHoles()` deve retornar `104924`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler252(), 104924);
|
||||
assert.strictEqual(convexHoles(), 104924);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +35,12 @@ assert.strictEqual(euler252(), 104924);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler252() {
|
||||
function convexHoles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler252();
|
||||
convexHoles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4691000cf542c50ff7c
|
||||
title: 'Problem 253: Tidying up'
|
||||
title: 'Problema 253: Organização'
|
||||
challengeType: 5
|
||||
forumTopicId: 301901
|
||||
dashedName: problem-253-tidying-up
|
||||
@ -8,28 +8,45 @@ dashedName: problem-253-tidying-up
|
||||
|
||||
# --description--
|
||||
|
||||
A small child has a “number caterpillar” consisting of forty jigsaw pieces, each with one number on it, which, when connected together in a line, reveal the numbers 1 to 40 in order.
|
||||
Uma criança tem uma "lagarta numérica", composta por quarenta pedaços de quebra-cabeça, cada um com um número, que, quando ligados em uma linha, revelam os números de 1 a 40 em ordem.
|
||||
|
||||
Every night, the child's father has to pick up the pieces of the caterpillar that have been scattered across the play room. He picks up the pieces at random and places them in the correct order. As the caterpillar is built up in this way, it forms distinct segments that gradually merge together. The number of segments starts at zero (no pieces placed), generally increases up to about eleven or twelve, then tends to drop again before finishing at a single segment (all pieces placed).
|
||||
Todas as noites, o pai da criança tem de pegar os pedaços da lagarta que estão espalhados pela sala. Ele pega as peças aleatoriamente e as coloca na ordem correta.
|
||||
|
||||
For example:
|
||||
Ao ser construída desta forma, a lagarta forma segmentos distintos que gradualmente se fundem juntos. O número de segmentos começa em zero (sem pedaços colocados), e vai aumentando até cerca de onze ou doze, então tende a diminuir novamente antes de terminar em um único segmento (todas as partes colocadas).
|
||||
|
||||
Piece Placed Segments So Far121422936434554354……
|
||||
Por exemplo:
|
||||
|
||||
Let M be the maximum number of segments encountered during a random tidy-up of the caterpillar. For a caterpillar of ten pieces, the number of possibilities for each M is
|
||||
| Peça colocada | Segmentos até então |
|
||||
| ------------- | ------------------- |
|
||||
| 12 | 1 |
|
||||
| 4 | 2 |
|
||||
| 29 | 3 |
|
||||
| 6 | 4 |
|
||||
| 34 | 5 |
|
||||
| 5 | 4 |
|
||||
| 35 | 4 |
|
||||
| … | … |
|
||||
|
||||
M Possibilities1512 2250912 31815264 41418112 5144000
|
||||
Considere $M$ como o número máximo de segmentos encontrados durante uma organização aleatória da lagarta. Para uma lagarta de dez peças, o número de possibilidades para cada $M$ é
|
||||
|
||||
so the most likely value of M is 3 and the average value is 385643⁄113400 = 3.400732, rounded to six decimal places.
|
||||
| M | Possibilidades |
|
||||
| - | -------------- |
|
||||
| 1 | 512 |
|
||||
| 2 | 250912 |
|
||||
| 3 | 1815264 |
|
||||
| 4 | 1418112 |
|
||||
| 5 | 144000 |
|
||||
|
||||
The most likely value of M for a forty-piece caterpillar is 11; but what is the average value of M? Give your answer rounded to six decimal places.
|
||||
então o valor mais provável de $M$ é 3 e o valor médio é $\frac{385.643}{113.400} = 3,400732$, arredondado para seis casas decimais.
|
||||
|
||||
O valor mais provável de $M$ para uma lagarta de quarenta peças é de 11, mas qual é o valor médio de $M$? Dê sua resposta arredondada para seis casas decimais.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler253()` should return 11.492847.
|
||||
`tidyingUp()` deve retornar `11.492847`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler253(), 11.492847);
|
||||
assert.strictEqual(tidyingUp(), 11.492847);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -37,12 +54,12 @@ assert.strictEqual(euler253(), 11.492847);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler253() {
|
||||
function tidyingUp() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler253();
|
||||
tidyingUp();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46b1000cf542c50ff7d
|
||||
title: 'Problem 254: Sums of Digit Factorials'
|
||||
title: 'Problema 254: Soma de dígitos fatoriais'
|
||||
challengeType: 5
|
||||
forumTopicId: 301902
|
||||
dashedName: problem-254-sums-of-digit-factorials
|
||||
@ -8,24 +8,24 @@ dashedName: problem-254-sums-of-digit-factorials
|
||||
|
||||
# --description--
|
||||
|
||||
Define f(n) as the sum of the factorials of the digits of n. For example, f(342) = 3! + 4! + 2! = 32.
|
||||
Defina $f(n)$ como a soma dos fatoriais dos algarismos de $n$. Por exemplo, $f(342) = 3! + 4! + 2! = 32$.
|
||||
|
||||
Define sf(n) as the sum of the digits of f(n). So sf(342) = 3 + 2 = 5.
|
||||
Defina $sf(n)$ como a soma dos algarismos de $f(n)$. Então, $sf(342) = 3 + 2 = 5$.
|
||||
|
||||
Define g(i) to be the smallest positive integer n such that sf(n) = i. Though sf(342) is 5, sf(25) is also 5, and it can be verified that g(5) is 25.
|
||||
Defina $g(i)$ como o menor número inteiro positivo $n$, tal que $sf(n) = i$. Embora $sf(342)$ seja 5, $sf(25)$ também é 5. Além disso, pode-se verificar que $g(5)$ é 25.
|
||||
|
||||
Define sg(i) as the sum of the digits of g(i). So sg(5) = 2 + 5 = 7.
|
||||
Defina $sg(i)$ como a soma dos algarismos de $g(i)$. Então, $sg(5) = 2 + 5 = 7$.
|
||||
|
||||
Further, it can be verified that g(20) is 267 and ∑ sg(i) for 1 ≤ i ≤ 20 is 156.
|
||||
Além disso, pode ser verificado que $g(20)$ é 267 e $\sum sg(i)$ para $1 ≤ i ≤ 20$ é 156.
|
||||
|
||||
What is ∑ sg(i) for 1 ≤ i ≤ 150?
|
||||
Qual é a $\sum sg(i)$ para $1 ≤ n ≤ 150$?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler254()` should return 8184523820510.
|
||||
`sumsOfDigitFactorials()` deve retornar `8184523820510`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler254(), 8184523820510);
|
||||
assert.strictEqual(sumsOfDigitFactorials(), 8184523820510);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +33,12 @@ assert.strictEqual(euler254(), 8184523820510);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler254() {
|
||||
function sumsOfDigitFactorials() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler254();
|
||||
sumsOfDigitFactorials();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46d1000cf542c50ff7f
|
||||
title: 'Problem 255: Rounded Square Roots'
|
||||
title: 'Problema 255: Raízes quadradas arredondadas'
|
||||
challengeType: 5
|
||||
forumTopicId: 301903
|
||||
dashedName: problem-255-rounded-square-roots
|
||||
@ -8,26 +8,42 @@ dashedName: problem-255-rounded-square-roots
|
||||
|
||||
# --description--
|
||||
|
||||
We define the rounded-square-root of a positive integer n as the square root of n rounded to the nearest integer.
|
||||
Definimos a raiz quadrada arredondada de um número inteiro positivo $n$ como a raiz quadrada de $n$ arredondada para o número inteiro mais próximo.
|
||||
|
||||
The following procedure (essentially Heron's method adapted to integer arithmetic) finds the rounded-square-root of n: Let d be the number of digits of the number n. If d is odd, set x0 = 2×10(d-1)⁄2. If d is even, set x0 = 7×10(d-2)⁄2. Repeat:
|
||||
O procedimento a seguir (essencialmente, o método de Heron adaptado para a aritmética de números inteiros) encontra a raiz arredondada de $n$:
|
||||
|
||||
until xk+1 = xk.
|
||||
Considere $d$ como o número de algarismos do número $n$.
|
||||
|
||||
As an example, let us find the rounded-square-root of n = 4321.n has 4 digits, so x0 = 7×10(4-2)⁄2 = 70. Since x2 = x1, we stop here. So, after just two iterations, we have found that the rounded-square-root of 4321 is 66 (the actual square root is 65.7343137…).
|
||||
Se $d$ for ímpar, defina $x_0 = 2 × {10}^{\frac{d - 1}{2}}$.
|
||||
|
||||
The number of iterations required when using this method is surprisingly low. For example, we can find the rounded-square-root of a 5-digit integer (10,000 ≤ n ≤ 99,999) with an average of 3.2102888889 iterations (the average value was rounded to 10 decimal places).
|
||||
Se $d$ for par, defina $x_0 = 7 × {10}^{\frac{d - 2}{2}}$.
|
||||
|
||||
Using the procedure described above, what is the average number of iterations required to find the rounded-square-root of a 14-digit number (1013 ≤ n < 1014)? Give your answer rounded to 10 decimal places.
|
||||
Repita:
|
||||
|
||||
Note: The symbols ⌊x⌋ and ⌈x⌉ represent the floor function and ceiling function respectively.
|
||||
$$x_{k + 1} = \left\lfloor\frac{x_k + \left\lceil\frac{n}{x_k}\right\rceil}{2}\right\rfloor$$
|
||||
|
||||
até $x_{k + 1} = x_k$.
|
||||
|
||||
Como exemplo, vamos encontrar a raiz quadrada arredondada de $n = 4321$.
|
||||
|
||||
$n$ tem 4 dígitos, então $x_0 = 7 × {10}^{\frac{4-2}{2}} = 70$.
|
||||
|
||||
$$x_1 = \left\lfloor\frac{70 + \left\lceil\frac{4321}{70}\right\rceil}{2}\right\rfloor = 66 \\\\ x_2 = \left\lfloor\frac{66 + \left\lceil\frac{4321}{66}\right\rceil}{2}\right\rfloor = 66$$
|
||||
|
||||
Como $x_2 = x_1$, paramos aqui. Então, depois de apenas duas iterações, descobrimos que a raiz arredondada de 4321 é 66 (a raiz quadrada real é 65.7343137…).
|
||||
|
||||
O número de iterações necessárias ao usar este método é surpreendentemente baixo. Por exemplo, podemos encontrar a raiz quadrada arredondada de um inteiro de 5 algarismos ($10.000 ≤ n ≤ 99.999$) com uma média de 3,2102888889 iterações (o valor médio foi arredondado para 10 casas decimais).
|
||||
|
||||
Usando o procedimento descrito acima, qual é o número médio de iterações necessárias para encontrar a raiz quadrada arredondada de um número de 14 algarismos (${10}^{13} ≤ n < {10}^{14}$)? Dê sua resposta arredondada para 10 casas decimais.
|
||||
|
||||
**Observação:** os símbolos $⌊x⌋$ e $⌈x⌉$ representam a função floor (piso) e ceiling (teto), respectivamente.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler255()` should return 4.447401118.
|
||||
`roundedSquareRoots()` deve retornar `4.447401118`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler255(), 4.447401118);
|
||||
assert.strictEqual(roundedSquareRoots(), 4.447401118);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +51,12 @@ assert.strictEqual(euler255(), 4.447401118);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler255() {
|
||||
function roundedSquareRoots() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler255();
|
||||
roundedSquareRoots();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46c1000cf542c50ff7e
|
||||
title: 'Problem 256: Tatami-Free Rooms'
|
||||
title: 'Problema 256: Cômodos sem tatami'
|
||||
challengeType: 5
|
||||
forumTopicId: 301904
|
||||
dashedName: problem-256-tatami-free-rooms
|
||||
@ -8,30 +8,32 @@ dashedName: problem-256-tatami-free-rooms
|
||||
|
||||
# --description--
|
||||
|
||||
Tatami are rectangular mats, used to completely cover the floor of a room, without overlap.
|
||||
Tatamis são tapetes retangulares, usados para cobrir completamente o piso de um cômodo, sem sobreposição.
|
||||
|
||||
Assuming that the only type of available tatami has dimensions 1×2, there are obviously some limitations for the shape and size of the rooms that can be covered.
|
||||
Assumindo que o único tipo de tatami disponível tem dimensões de 1×2, existem, obviamente, algumas limitações quanto à forma e tamanho dos cômodos que podem ser cobertos.
|
||||
|
||||
For this problem, we consider only rectangular rooms with integer dimensions a, b and even size s = a·b. We use the term 'size' to denote the floor surface area of the room, and — without loss of generality — we add the condition a ≤ b.
|
||||
Para esse problema, consideramos apenas cômodos retangulares com dimensões inteiras $a$, $b$ e tamanho $s = a \times b$. Usamos o termo 'tamanho' para indicar a área de superfície do chão do cômodo, e — sem perda de generalidade — adicionamos a condição de que $a ≤ b$.
|
||||
|
||||
There is one rule to follow when laying out tatami: there must be no points where corners of four different mats meet. For example, consider the two arrangements below for a 4×4 room:
|
||||
Há uma regra a seguir quando se monta o tatami: não pode haver pontos onde se encontrem cantos de quatro tapetes diferentes. Por exemplo, considere as duas disposições abaixo para um cômodo de 4×4:
|
||||
|
||||
The arrangement on the left is acceptable, whereas the one on the right is not: a red "X" in the middle, marks the point where four tatami meet.
|
||||
<img class="img-responsive center-block" alt="dois arranjos de tapetes em um cômodo de 4x4" src="https://cdn.freecodecamp.org/curriculum/project-euler/tatami-free-rooms.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Because of this rule, certain even-sized rooms cannot be covered with tatami: we call them tatami-free rooms. Further, we define T(s) as the number of tatami-free rooms of size s.
|
||||
O arranjo da esquerda é aceitável, enquanto o da direita não é: um "<strong><span style="color: red;">X</span></strong>" vermelho no meio, marca o ponto onde quatro tatamis se encontram.
|
||||
|
||||
The smallest tatami-free room has size s = 70 and dimensions 7×10. All the other rooms of size s = 70 can be covered with tatami; they are: 1×70, 2×35 and 5×14. Hence, T(70) = 1.
|
||||
Devido a esta regra, alguns cômodos de mesmo tamanho não podem ser cobertos por tatami: damos a eles o nome de cômodos sem tatami. Além disso, definimos $T(s)$ como o número de cômodos sem tatami no tamanho $s$.
|
||||
|
||||
Similarly, we can verify that T(1320) = 5 because there are exactly 5 tatami-free rooms of size s = 1320: 20×66, 22×60, 24×55, 30×44 and 33×40. In fact, s = 1320 is the smallest room-size s for which T(s) = 5.
|
||||
O menor cômodo sem tatami tem tamanho $s = 70$ e dimensões de 7×10. Todos os outros cômodos do tamanho $s = 70$ podem ser cobertos com tatami; eles são: 1×70, 2×35 e 5×14. Portanto, $T(70) = 1$.
|
||||
|
||||
Find the smallest room-size s for which T(s) = 200.
|
||||
Da mesma forma, podemos verificar que $T(1320) = 5$ porque há exatamente 5 cômodos sem tatami $s = 1320$: 20×66, 22×60, 24×55, 30×44 e 33×40. Na verdade, $s = 1320$ é o menor tamanho de cômodo $s$ para o qual $T(s) = 5$.
|
||||
|
||||
Encontre o menor tamanho de cômodo $s$ para o qual $T(s) = 200$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler256()` should return 85765680.
|
||||
`tatamiFreeRooms()` deve retornar `85765680`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler256(), 85765680);
|
||||
assert.strictEqual(tatamiFreeRooms(), 85765680);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +41,12 @@ assert.strictEqual(euler256(), 85765680);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler256() {
|
||||
function tatamiFreeRooms() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler256();
|
||||
tatamiFreeRooms();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46e1000cf542c50ff80
|
||||
title: 'Problem 257: Angular Bisectors'
|
||||
title: 'Problema 257: Bissetores angulares'
|
||||
challengeType: 5
|
||||
forumTopicId: 301905
|
||||
dashedName: problem-257-angular-bisectors
|
||||
@ -8,22 +8,22 @@ dashedName: problem-257-angular-bisectors
|
||||
|
||||
# --description--
|
||||
|
||||
Given is an integer sided triangle ABC with sides a ≤ b ≤ c.
|
||||
Você recebe um triângulo com o comprimento dos lados de números inteiros $ABC$ com lados $a ≤ b ≤ c$. ($AB = c$, $BC = a$ e $AC = b$).
|
||||
|
||||
(AB = c, BC = a and AC = b).
|
||||
Os bissetores angulares do triângulo cruzam os lados nos pontos $E$, $F$ e $G$ (veja a imagem abaixo).
|
||||
|
||||
The angular bisectors of the triangle intersect the sides at points E, F and G (see picture below).
|
||||
<img class="img-responsive center-block" alt="triângulo ABC, com bissetores angulares que se cruzam com os lados nos pontos E, F e G" src="https://cdn.freecodecamp.org/curriculum/project-euler/angular-bisectors.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
The segments EF, EG and FG partition the triangle ABC into four smaller triangles: AEG, BFE, CGF and EFG. It can be proven that for each of these four triangles the ratio area(ABC)/area(subtriangle) is rational. However, there exist triangles for which some or all of these ratios are integral.
|
||||
Os segmentos $EF$, $EG$ e $FG$ particionam o triângulo $ABC$ em quatro triângulos menores: $AEG$, $BFE$, $CGF$ e $EFG$. Pode ser provado que, para cada um desses quatro triângulos, a razão $\frac{\text{área}(ABC)}{\text{área}(\text{subtriângulo})}$ é racional. No entanto, existem triângulos para os quais algumas ou todas estas razões são inteiras.
|
||||
|
||||
How many triangles ABC with perimeter≤100,000,000 exist so that the ratio area(ABC)/area(AEG) is integral?
|
||||
Quantos triângulos $ABC$ com o perímetro $^\\100.000.000$ existem para que a razão $\frac{\text{área}(ABC)}{\text{área}(AEG)}$ seja integral?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler257()` should return 139012411.
|
||||
`angularBisectors()` deve retornar `139012411`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler257(), 139012411);
|
||||
assert.strictEqual(angularBisectors(), 139012411);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -31,12 +31,12 @@ assert.strictEqual(euler257(), 139012411);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler257() {
|
||||
function angularBisectors() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler257();
|
||||
angularBisectors();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f46e1000cf542c50ff81
|
||||
title: 'Problem 258: A lagged Fibonacci sequence'
|
||||
title: 'Problema 258: Uma sequência de Fibonacci com atraso'
|
||||
challengeType: 5
|
||||
forumTopicId: 301906
|
||||
dashedName: problem-258-a-lagged-fibonacci-sequence
|
||||
@ -8,16 +8,19 @@ dashedName: problem-258-a-lagged-fibonacci-sequence
|
||||
|
||||
# --description--
|
||||
|
||||
A sequence is defined as:
|
||||
Uma sequência é definida como:
|
||||
|
||||
gk = 1, for 0 ≤ k ≤ 1999 gk = gk-2000 + gk-1999, for k ≥ 2000. Find gk mod 20092010 for k = 1018.
|
||||
- $g_k = 1$, para $0 ≤ k ≤ 1999$
|
||||
- $g_k = g_{k - 2000} + g_{k - 1999}$, para $k ≥ 2000$.
|
||||
|
||||
Encontre $g_k$ mod 20092010 para $k = {10}^{18}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler258()` should return 12747994.
|
||||
`laggedFibonacciSequence()` deve retornar `12747994`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler258(), 12747994);
|
||||
assert.strictEqual(laggedFibonacciSequence(), 12747994);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -25,12 +28,12 @@ assert.strictEqual(euler258(), 12747994);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler258() {
|
||||
function laggedFibonacciSequence() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler258();
|
||||
laggedFibonacciSequence();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4701000cf542c50ff82
|
||||
title: 'Problem 259: Reachable Numbers'
|
||||
title: 'Problema 259: Números alcançáveis'
|
||||
challengeType: 5
|
||||
forumTopicId: 301907
|
||||
dashedName: problem-259-reachable-numbers
|
||||
@ -8,18 +8,25 @@ dashedName: problem-259-reachable-numbers
|
||||
|
||||
# --description--
|
||||
|
||||
A positive integer will be called reachable if it can result from an arithmetic expression obeying the following rules:
|
||||
Um número inteiro positivo será chamado de acessível se puder resultar de uma expressão aritmética obedecendo às seguintes regras:
|
||||
|
||||
Uses the digits 1 through 9, in that order and exactly once each. Any successive digits can be concatenated (for example, using the digits 2, 3 and 4 we obtain the number 234). Only the four usual binary arithmetic operations (addition, subtraction, multiplication and division) are allowed. Each operation can be used any number of times, or not at all. Unary minus is not allowed. Any number of (possibly nested) parentheses may be used to define the order of operations. For example, 42 is reachable, since (1/23) *((4*5)-6) \* (78-9) = 42.
|
||||
- Usa os algarismos de 1 a 9, nessa ordem e exatamente uma vez cada.
|
||||
- Quaisquer algarismos sucessivos podem ser concatenados (por exemplo, usando os algarismos 2, 3 e 4 obtemos o número 234).
|
||||
- Apenas as quatro operações aritméticas binárias habituais (adição, subtração, multiplicação e divisão) são permitidas.
|
||||
- Cada operação pode ser usada qualquer número de vezes, ou mesmo não usada.
|
||||
- Não é permitido o menos unário.
|
||||
- Qualquer número de parênteses (possivelmente aninhados) podem ser usados para definir a ordem das operações.
|
||||
|
||||
What is the sum of all positive reachable integers?
|
||||
Por exemplo, 42 é acessível, já que $\frac{1}{23} \times ((4 \times 5) - 6) \times (78 - 9) = 42$.
|
||||
|
||||
Qual é a soma de todos os números inteiros positivos acessíveis?
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler259()` should return 20101196798.
|
||||
`reachableNumbers()` deve retornar `20101196798`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler259(), 20101196798);
|
||||
assert.strictEqual(reachableNumbers(), 20101196798);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +34,12 @@ assert.strictEqual(euler259(), 20101196798);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler259() {
|
||||
function reachableNumbers() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler259();
|
||||
reachableNumbers();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4701000cf542c50ff83
|
||||
title: 'Problem 260: Stone Game'
|
||||
title: 'Problema 260: Jogo da pedra'
|
||||
challengeType: 5
|
||||
forumTopicId: 301909
|
||||
dashedName: problem-260-stone-game
|
||||
@ -8,26 +8,36 @@ dashedName: problem-260-stone-game
|
||||
|
||||
# --description--
|
||||
|
||||
A game is played with three piles of stones and two players.
|
||||
Uma partida é jogada com três pilhas de pedras e dois jogadores.
|
||||
|
||||
At her turn, a player removes one or more stones from the piles. However, if she takes stones from more than one pile, she must remove the same number of stones from each of the selected piles.
|
||||
No turno de cada jogador, ele remove uma ou mais pedras das pilhas. No entanto, se o jogador recebe pedras de mais de uma pilha, o mesmo número de pedras deve ser removido de cada uma das pilhas selecionadas.
|
||||
|
||||
In other words, the player chooses some N>0 and removes: N stones from any single pile; or N stones from each of any two piles (2N total); or N stones from each of the three piles (3N total). The player taking the last stone(s) wins the game.
|
||||
Em outras palavras, o jogador escolhe algumas $N > 0$ e as remove:
|
||||
|
||||
A winning configuration is one where the first player can force a win. For example, (0,0,13), (0,11,11) and (5,5,5) are winning configurations because the first player can immediately remove all stones.
|
||||
- $N$ pedras de qualquer pilha; ou
|
||||
- $N$ pedras de duas pilhas (total de $2N$); ou
|
||||
- $N$ pedras de três pilhas (total de $3N$).
|
||||
|
||||
A losing configuration is one where the second player can force a win, no matter what the first player does. For example, (0,1,2) and (1,3,3) are losing configurations: any legal move leaves a winning configuration for the second player.
|
||||
O jogador que ficar com a(s) última(s) pedra(s) ganha o jogo.
|
||||
|
||||
Consider all losing configurations (xi,yi,zi) where xi ≤ yi ≤ zi ≤ 100. We can verify that Σ(xi+yi+zi) = 173895 for these.
|
||||
Uma configuração vencedora é aquela onde o primeiro jogador pode forçar uma vitória.
|
||||
|
||||
Find Σ(xi+yi+zi) where (xi,yi,zi) ranges over the losing configurations with xi ≤ yi ≤ zi ≤ 1000.
|
||||
Por exemplo, (0,0,13), (0,11,11) e (5,5,5) são configurações vencedores porque o primeiro jogador pode remover imediatamente todas as pedras.
|
||||
|
||||
Uma configuração perdedora é aquela onde o segundo jogador pode forçar uma vitória, não importa o que o primeiro jogador faça.
|
||||
|
||||
Por exemplo, (0,1,2) e (1,3,3) são configurações perdedoras: qualquer movimento legal deixa uma configuração vencedora para o segundo jogador.
|
||||
|
||||
Considere todas as configurações perdedoras ($x_i$,$y_i$,$z_i$) onde $x_i ≤ y_i ≤ z_i ≤ 100$. Podemos verificar que $\sum (x_i + y_i + z_i) = 173.895$ para elas.
|
||||
|
||||
Encontre $\sum (x_i + y_i + z_i)$ onde ($x_i$,$y_i$,$z_i$) passa pelas configurações perdedoras com $x_i ≤ y_i ≤ z_i ≤ 1000$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler260()` should return 167542057.
|
||||
`stoneGame()` deve retornar `167542057`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler260(), 167542057);
|
||||
assert.strictEqual(stoneGame(), 167542057);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -35,12 +45,12 @@ assert.strictEqual(euler260(), 167542057);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler260() {
|
||||
function stoneGame() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler260();
|
||||
stoneGame();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4711000cf542c50ff84
|
||||
title: 'Problem 261: Pivotal Square Sums'
|
||||
title: 'Problema 261: Soma dos quadrados pivotais'
|
||||
challengeType: 5
|
||||
forumTopicId: 301910
|
||||
dashedName: problem-261-pivotal-square-sums
|
||||
@ -8,18 +8,22 @@ dashedName: problem-261-pivotal-square-sums
|
||||
|
||||
# --description--
|
||||
|
||||
Let us call a positive integer k a square-pivot, if there is a pair of integers m > 0 and n ≥ k, such that the sum of the (m+1) consecutive squares up to k equals the sum of the m consecutive squares from (n+1) on:
|
||||
Vamos chamar um número inteiro positivo $k$ de um quadrado pivotal se houver um par de números inteiros $m > 0$ e $n ≥ k$, tal que a soma dos quadrados consecutivos ($m + 1$) até $k$ é igual a soma dos $m$ quadrados consecutivos de ($n + 1$) em:
|
||||
|
||||
(k-m)2 + ... + k2 = (n+1)2 + ... + (n+m)2.
|
||||
$${(k - m)}^2 + \ldots + k^2 = {(n + 1)}^2 + \ldots + {(n + m)}^2$$
|
||||
|
||||
Some small square-pivots are 4: 32 + 42 = 52 21: 202 + 212 = 292 24: 212 + 222 + 232 + 242 = 252 + 262 + 272 110: 1082 + 1092 + 1102 = 1332 + 1342Find the sum of all distinct square-pivots ≤ 1010.
|
||||
Alguns quadrados pivotais pequenos são
|
||||
|
||||
$$\begin{align} & \mathbf{4}: 3^2 + \mathbf{4}^2 = 5^2 \\\\ & \mathbf{21}: {20}^2 + \mathbf{21}^2 = {29}^2 \\\\ & \mathbf{24}: {21}^2 + {22}^2 + {23}^2 + \mathbf{24}^2 = {25}^2 + {26}^2 + {27}^2 \\\\ & \mathbf{110}: {108}^2 + {109}^2 + \mathbf{110}^2 = {133}^2 + {134}^2 \\\\ \end{align}$$
|
||||
|
||||
Encontre a soma de todos os quadrados pivotais distintos $≤ {10}^{10}$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler261()` should return 238890850232021.
|
||||
`pivotalSquareSums()` deve retornar `238890850232021`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler261(), 238890850232021);
|
||||
assert.strictEqual(pivotalSquareSums(), 238890850232021);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -27,12 +31,12 @@ assert.strictEqual(euler261(), 238890850232021);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler261() {
|
||||
function pivotalSquareSums() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler261();
|
||||
pivotalSquareSums();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4731000cf542c50ff85
|
||||
title: 'Problem 262: Mountain Range'
|
||||
title: 'Problema 262: Cadeia de montanhas'
|
||||
challengeType: 5
|
||||
forumTopicId: 301911
|
||||
dashedName: problem-262-mountain-range
|
||||
@ -8,24 +8,26 @@ dashedName: problem-262-mountain-range
|
||||
|
||||
# --description--
|
||||
|
||||
The following equation represents the continuous topography of a mountainous region, giving the elevation h at any point (x,y):
|
||||
A seguinte equação representa a topografia contínua de uma região montanhosa, dando a elevação $h$ em qualquer ponto ($x$,$y$):
|
||||
|
||||
A mosquito intends to fly from A(200,200) to B(1400,1400), without leaving the area given by 0 ≤ x, y ≤ 1600.
|
||||
$$h = \left(5000 - \frac{x^2 + y^2 + xy}{200} + \frac{25(x + y)}{2}\right) \times e^{-\left|\frac{x^2 + y^2}{1\\,000\\,000} - \frac{3(x + y)}{2000} + \frac{7}{10}\right|}$$
|
||||
|
||||
Because of the intervening mountains, it first rises straight up to a point A', having elevation f. Then, while remaining at the same elevation f, it flies around any obstacles until it arrives at a point B' directly above B.
|
||||
Um mosquito pretende voar de A(200,200) para B(1400,1400), sem sair da área dada por $0 ≤ x$, $y ≤ 1600$.
|
||||
|
||||
First, determine fmin which is the minimum constant elevation allowing such a trip from A to B, while remaining in the specified area. Then, find the length of the shortest path between A' and B', while flying at that constant elevation fmin.
|
||||
Por causa das montanhas no caminho, primeiro ele sobe em linha reta até um ponto A', tendo a elevação $f$. Então, enquanto permanece na mesma elevação $f$, ele voa em torno de quaisquer obstáculos até chegar em um ponto B' diretamente acima de B.
|
||||
|
||||
Give that length as your answer, rounded to three decimal places.
|
||||
Primeiro, determine $f_{min}$, que é a elevação mínima constante que permite esse percurso de A a B, enquanto permanece na área especificada. Depois, encontre o comprimento do caminho mais curto entre A' e B', enquanto ele voa naquela elevação constante de $f_{min}$.
|
||||
|
||||
Note: For convenience, the elevation function shown above is repeated below, in a form suitable for most programming languages: h=( 5000-0.005*(x*x+y*y+x*y)+12.5*(x+y) )* exp( -abs(0.000001*(x*x+y*y)-0.0015*(x+y)+0.7) )
|
||||
Dê esse comprimento como sua resposta, arredondado para três casas decimais.
|
||||
|
||||
**Observação:** por conveniência, a função de elevação mostrada acima é repetida abaixo, em uma forma adequada para a maioria das linguagens de programação: `h=( 5000-0.005*(x*x+y*y+x*y)+12.5*(x+y) )* exp( -abs(0.000001*(x*x+y*y)-0.0015*(x+y)+0.7) )`.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler262()` should return 2531.205.
|
||||
`mountainRange()` deve retornar `2531.205`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler262(), 2531.205);
|
||||
assert.strictEqual(mountainRange(), 2531.205);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +35,12 @@ assert.strictEqual(euler262(), 2531.205);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler262() {
|
||||
function mountainRange() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler262();
|
||||
mountainRange();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4741000cf542c50ff86
|
||||
title: 'Problem 263: An engineers'' dream come true'
|
||||
title: 'Problema 263: O sonho de um engenheiro se torna realidade'
|
||||
challengeType: 5
|
||||
forumTopicId: 301912
|
||||
dashedName: problem-263-an-engineers-dream-come-true
|
||||
@ -8,30 +8,33 @@ dashedName: problem-263-an-engineers-dream-come-true
|
||||
|
||||
# --description--
|
||||
|
||||
Consider the number 6. The divisors of 6 are: 1,2,3 and 6.
|
||||
Considere o número 6. Os divisores de 6 são: 1, 2, 3 e 6.
|
||||
|
||||
Every number from 1 up to and including 6 can be written as a sum of distinct divisors of 6:
|
||||
Cada número de 1 até 6 pode ser escrito como uma soma de divisores distintos de 6:
|
||||
|
||||
1=1, 2=2, 3=1+2, 4=1+3, 5=2+3, 6=6.
|
||||
$1 = 1$, $2 = 2$, $3 = 1 + 2$, $4 = 1 + 3$, $5 = 2 + 3$, $6 = 6$.
|
||||
|
||||
A number n is called a practical number if every number from 1 up to and including n can be expressed as a sum of distinct divisors of n.
|
||||
Um número $n$ é chamado de número prático se cada número de 1 até $n$ puder ser expresso como uma soma dos divisores distintos de $n$.
|
||||
|
||||
A pair of consecutive prime numbers with a difference of six is called a sexy pair (since "sex" is the Latin word for "six"). The first sexy pair is (23, 29).
|
||||
Um par de números primos consecutivos com uma diferença de seis é chamado de par sexy (já que "sex" é a palavra latina para "seis"). O primeiro par sexy é (23, 29).
|
||||
|
||||
We may occasionally find a triple-pair, which means three consecutive sexy prime pairs, such that the second member of each pair is the first member of the next pair.
|
||||
Podemos ocasionalmente encontrar um trio de pares, o que significa três pares sexy de números primos consecutivos, de modo que o segundo membro de cada par seja o primeiro membro do próximo par.
|
||||
|
||||
We shall call a number n such that : (n-9, n-3), (n-3,n+3), (n+3, n+9) form a triple-pair, and the numbers n-8, n-4, n, n+4 and n+8 are all practical,
|
||||
Chamaremos um número $n$ com as seguintes configurações:
|
||||
|
||||
an engineers’ paradise.
|
||||
- ($n - 9$, $n - 3$), ($n - 3$, $n + 3$), ($n + 3$, $n + 9$) formam um trio de pares, e
|
||||
- os números $n - 8$, $n - 4$, $n$, $n + 4$ e $n + 8$ sejam todos práticos,
|
||||
|
||||
Find the sum of the first four engineers’ paradises.
|
||||
de paraíso do engenheiro.
|
||||
|
||||
Encontre a soma dos primeiros quatro paraísos do engenheiro.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler263()` should return 2039506520.
|
||||
`engineersDreamComeTrue()` deve retornar `2039506520`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler263(), 2039506520);
|
||||
assert.strictEqual(engineersDreamComeTrue(), 2039506520);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +42,12 @@ assert.strictEqual(euler263(), 2039506520);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler263() {
|
||||
function engineersDreamComeTrue() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler263();
|
||||
engineersDreamComeTrue();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4751000cf542c50ff87
|
||||
title: 'Problem 264: Triangle Centres'
|
||||
title: 'Problema 264: Centros dos triângulos'
|
||||
challengeType: 5
|
||||
forumTopicId: 301913
|
||||
dashedName: problem-264-triangle-centres
|
||||
@ -8,30 +8,47 @@ dashedName: problem-264-triangle-centres
|
||||
|
||||
# --description--
|
||||
|
||||
Consider all the triangles having:
|
||||
Considere todos os triângulos que têm:
|
||||
|
||||
All their vertices on lattice points.
|
||||
- Todos os seus vértices em pontos da rede.
|
||||
- Circuncentro na origem O.
|
||||
- Ortocentro no ponto H(5, 0).
|
||||
|
||||
Circumcentre at the origin O.
|
||||
Há nove triângulos desse tipo tendo um $\text{perímetro} ≤ 50$.
|
||||
|
||||
Orthocentre at the point H(5, 0).
|
||||
Listados e mostrados em ordem ascendente de perímetro, eles são:
|
||||
|
||||
There are nine such triangles having a perimeter ≤ 50.
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
A(-4, 3), B(5, 0), C(4, -3)<br>
|
||||
A(4, 3), B(5, 0), C(-4, -3)<br>
|
||||
A(-3, 4), B(5, 0), C(3, -4)<br>
|
||||
<br><br>
|
||||
A(3, 4), B(5, 0), C(-3, -4)<br>
|
||||
A(0, 5), B(5, 0), C(0, -5)<br>
|
||||
A(1, 8), B(8, -1), C(-4, -7)<br>
|
||||
<br><br>
|
||||
A(8, 1), B(1, -8), C(-4, 7)<br>
|
||||
A(2, 9), B(9, -2), C(-6, -7)<br>
|
||||
A(9, 2), B(2, -9), C(-6, 7)<br>
|
||||
</td>
|
||||
<td><img class="img-responsive center-block" alt="nove triângulos ABC com o perímetro ≤ 50" src="https://cdn.freecodecamp.org/curriculum/project-euler/triangle-centres.gif" style="background-color: white; padding: 10px;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Listed and shown in ascending order of their perimeter, they are:
|
||||
A soma dos seus perímetros, arredondada para quatro casas decimais, é 291,0089.
|
||||
|
||||
A(-4, 3), B(5, 0), C(4, -3) A(4, 3), B(5, 0), C(-4, -3) A(-3, 4), B(5, 0), C(3, -4) A(3, 4), B(5, 0), C(-3, -4) A(0, 5), B(5, 0), C(0, -5) A(1, 8), B(8, -1), C(-4, -7) A(8, 1), B(1, -8), C(-4, 7) A(2, 9), B(9, -2), C(-6, -7) A(9, 2), B(2, -9), C(-6, 7)
|
||||
|
||||
The sum of their perimeters, rounded to four decimal places, is 291.0089.
|
||||
|
||||
Find all such triangles with a perimeter ≤ 105. Enter as your answer the sum of their perimeters rounded to four decimal places.
|
||||
Encontre todos os triângulos desse tipo com um $\text{perímetro} ≤ {10}^5$. Insira como resposta a soma dos seus perímetros, arredondada para quatro casas decimais.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler264()` should return 2816417.1055.
|
||||
`triangleCentres()` deve retornar `2816417.1055`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler264(), 2816417.1055);
|
||||
assert.strictEqual(triangleCentres(), 2816417.1055);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -39,12 +56,12 @@ assert.strictEqual(euler264(), 2816417.1055);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler264() {
|
||||
function triangleCentres() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler264();
|
||||
triangleCentres();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 5900f4761000cf542c50ff88
|
||||
title: 'Problem 265: Binary Circles'
|
||||
title: 'Problema 265: Círculos binários'
|
||||
challengeType: 5
|
||||
forumTopicId: 301914
|
||||
dashedName: problem-265-binary-circles
|
||||
@ -8,24 +8,29 @@ dashedName: problem-265-binary-circles
|
||||
|
||||
# --description--
|
||||
|
||||
2N binary digits can be placed in a circle so that all the N-digit clockwise subsequences are distinct.
|
||||
Os algarismos binários $2^N$ podem ser colocados em um círculo de modo que todas as subsequências de $N$ algarismos no sentido horário sejam distintas.
|
||||
|
||||
For N=3, two such circular arrangements are possible, ignoring rotations:
|
||||
Para $N = 3$, dois arranjos circulares são possíveis, ignorando rotações:
|
||||
|
||||
For the first arrangement, the 3-digit subsequences, in clockwise order, are: 000, 001, 010, 101, 011, 111, 110 and 100.
|
||||
<img class="img-responsive center-block" alt="dois arranjos circulares para N = 3" src="https://cdn.freecodecamp.org/curriculum/project-euler/binary-circles.gif" style="background-color: white; padding: 10px;" />
|
||||
|
||||
Each circular arrangement can be encoded as a number by concatenating the binary digits starting with the subsequence of all zeros as the most significant bits and proceeding clockwise. The two arrangements for N=3 are thus represented as 23 and 29: 00010111 2 = 23 00011101 2 = 29
|
||||
Para o primeiro arranjo, as subsequências de 3 algarismos, no sentido horário, são: 000, 001, 010, 101, 011, 111, 110 e 100.
|
||||
|
||||
Calling S(N) the sum of the unique numeric representations, we can see that S(3) = 23 + 29 = 52.
|
||||
Cada arranjo circular pode ser codificado como um número, concatenando os algarismos binários, começando com a subsequência de todos os zeros, como os bits mais significativos e prosseguindo no sentido horário. Os dois arranjos para $N = 3$ são, portanto, representados como 23 e 29:
|
||||
|
||||
Find S(5).
|
||||
$${00010111}_2 = 23\\\\
|
||||
{00011101}_2 = 29$$
|
||||
|
||||
Chamando $S(N)$ de soma das representações numéricas únicas, podemos ver que $S(3) = 23 + 29 = 52$.
|
||||
|
||||
Encontre $S(5)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler265()` should return 209110240768.
|
||||
`binaryCircles()` deve retornar `209110240768`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler265(), 209110240768);
|
||||
assert.strictEqual(binaryCircles(), 209110240768);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -33,12 +38,12 @@ assert.strictEqual(euler265(), 209110240768);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler265() {
|
||||
function binaryCircles() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler265();
|
||||
binaryCircles();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user