diff --git a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/project-euler/problem-330-eulers-number.md b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/project-euler/problem-330-eulers-number.md index c8a3feab396..fb52e637364 100644 --- a/curriculum/challenges/chinese-traditional/10-coding-interview-prep/project-euler/problem-330-eulers-number.md +++ b/curriculum/challenges/chinese-traditional/10-coding-interview-prep/project-euler/problem-330-eulers-number.md @@ -1,6 +1,6 @@ --- id: 5900f4b71000cf542c50ffc9 -title: 'Problem 330: Euler''s Number' +title: '問題 330:歐拉數' challengeType: 5 forumTopicId: 301988 dashedName: problem-330-eulers-number @@ -8,30 +8,28 @@ dashedName: problem-330-eulers-number # --description-- -An infinite sequence of real numbers a(n) is defined for all integers n as follows: +對於所有的整數 $n$,一個無限實數序列 $a(n)$ 定義如下: - +$$ a(n) = \begin{cases} 1 & n < 0 \\\\ \displaystyle \sum_{i = 1}^{\infty} \frac{a(n - 1)}{i!} & n \ge 0 \end{cases} $$ -For example,a(0) = 11! + 12! + 13! + ... = e − 1 a(1) = e − 11! + 12! + 13! + ... = 2e − 3 a(2) = 2e − 31! + e − 12! + 13! + ... = 72 e − 6 +例如, -with e = 2.7182818... being Euler's constant. +$$\begin{align} & a(0) = \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots = e − 1 \\\\ & a(1) = \frac{e − 1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots = 2e − 3 \\\\ & a(2) = \frac{2e − 3}{1!} + \frac{e − 1}{2!} + \frac{1}{3!} + \ldots = \frac{7}{2} e − 6 \end{align}$$ -It can be shown that a(n) is of the form +其中,$e = 2.7182818\ldots$ 是歐拉常數。 -A(n) e + B(n)n! for integers A(n) and B(n). +可以看出,$a(n)$ 可以寫成 $\displaystyle\frac{A(n)e + B(n)}{n!}$ 這樣的形式,其中 $A(n)$ 和 $B(n)$ 均是整數。 -For example a(10) = +例如,$\displaystyle a(10) = \frac{328161643e − 652694486}{10!}$。 -328161643 e − 65269448610!. - -Find A(109) + B(109) and give your answer mod 77 777 777. +求解 $A({10}^9)$ + $B({10}^9)$ 並給出答案 $\bmod 77\\,777\\,777$。 # --hints-- -`euler330()` should return 15955822. +`eulersNumber()` 應該返回 `15955822`。 ```js -assert.strictEqual(euler330(), 15955822); +assert.strictEqual(eulersNumber(), 15955822); ``` # --seed-- @@ -39,12 +37,12 @@ assert.strictEqual(euler330(), 15955822); ## --seed-contents-- ```js -function euler330() { +function eulersNumber() { return true; } -euler330(); +eulersNumber(); ``` # --solutions-- diff --git a/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-330-eulers-number.md b/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-330-eulers-number.md index c8a3feab396..8444afe2b77 100644 --- a/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-330-eulers-number.md +++ b/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-330-eulers-number.md @@ -1,6 +1,6 @@ --- id: 5900f4b71000cf542c50ffc9 -title: 'Problem 330: Euler''s Number' +title: '问题 330:欧拉数' challengeType: 5 forumTopicId: 301988 dashedName: problem-330-eulers-number @@ -8,30 +8,28 @@ dashedName: problem-330-eulers-number # --description-- -An infinite sequence of real numbers a(n) is defined for all integers n as follows: +对于所有的整数 $n$,一个无限实数序列 $a(n)$ 定义如下: - +$$ a(n) = \begin{cases} 1 & n < 0 \\\\ \displaystyle \sum_{i = 1}^{\infty} \frac{a(n - 1)}{i!} & n \ge 0 \end{cases} $$ -For example,a(0) = 11! + 12! + 13! + ... = e − 1 a(1) = e − 11! + 12! + 13! + ... = 2e − 3 a(2) = 2e − 31! + e − 12! + 13! + ... = 72 e − 6 +例如, -with e = 2.7182818... being Euler's constant. +$$\begin{align} & a(0) = \frac{1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots = e − 1 \\\\ & a(1) = \frac{e − 1}{1!} + \frac{1}{2!} + \frac{1}{3!} + \ldots = 2e − 3 \\\\ & a(2) = \frac{2e − 3}{1!} + \frac{e − 1}{2!} + \frac{1}{3!} + \ldots = \frac{7}{2} e − 6 \end{align}$$ -It can be shown that a(n) is of the form +其中,$e = 2.7182818\ldots$ 是欧拉常数。 -A(n) e + B(n)n! for integers A(n) and B(n). +可以看出,$a(n)$ 可以写成 $\displaystyle\frac{A(n)e + B(n)}{n!}$ 这样的形式,其中 $A(n)$ 和 $B(n)$ 均是整数。 -For example a(10) = +例如,$\displaystyle a(10) = \frac{328161643e − 652694486}{10!}$。 -328161643 e − 65269448610!. - -Find A(109) + B(109) and give your answer mod 77 777 777. +求解 $A({10}^9)$ + $B({10}^9)$ 并给出答案 $\bmod 77\\,777\\,777$。 # --hints-- -`euler330()` should return 15955822. +`eulersNumber()` 应该返回 `15955822`。 ```js -assert.strictEqual(euler330(), 15955822); +assert.strictEqual(eulersNumber(), 15955822); ``` # --seed-- @@ -39,12 +37,12 @@ assert.strictEqual(euler330(), 15955822); ## --seed-contents-- ```js -function euler330() { +function eulersNumber() { return true; } -euler330(); +eulersNumber(); ``` # --solutions-- diff --git a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md index 19ad4afeac6..3302b9a1797 100644 --- a/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md +++ b/curriculum/challenges/portuguese/02-javascript-algorithms-and-data-structures/functional-programming/refactor-global-variables-out-of-functions.md @@ -27,6 +27,7 @@ Reescreva o código de forma que o array global `bookList` não seja alterado em `bookList` não deve ser alterado e precisa permanecer igual a `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. ```js +add(bookList, "Test"); assert( JSON.stringify(bookList) === JSON.stringify([ @@ -38,11 +39,11 @@ assert( ); ``` -`newBookList` deve ser igual a `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. +`add(bookList, "A Brief History of Time")` deve retornar `["The Hound of the Baskervilles", "On The Electrodynamics of Moving Bodies", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. ```js assert( - JSON.stringify(newBookList) === + JSON.stringify(add(bookList, "A Brief History of Time")) === JSON.stringify([ 'The Hound of the Baskervilles', 'On The Electrodynamics of Moving Bodies', @@ -53,11 +54,11 @@ assert( ); ``` -`newerBookList` deve ser igual a `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. +`remove(bookList, "On The Electrodynamics of Moving Bodies")` deve retornar `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae"]`. ```js assert( - JSON.stringify(newerBookList) === + JSON.stringify(remove(bookList, 'On The Electrodynamics of Moving Bodies')) === JSON.stringify([ 'The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', @@ -66,11 +67,11 @@ assert( ); ``` -`newestBookList` deve ser igual a `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. +`remove(add(bookList, "A Brief History of Time"), "On The Electrodynamics of Moving Bodies");` deve ser igual a `["The Hound of the Baskervilles", "Philosophiæ Naturalis Principia Mathematica", "Disquisitiones Arithmeticae", "A Brief History of Time"]`. ```js assert( - JSON.stringify(newestBookList) === + JSON.stringify(remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies')) === JSON.stringify([ 'The Hound of the Baskervilles', 'Philosophiæ Naturalis Principia Mathematica', @@ -108,12 +109,6 @@ function remove(bookName) { // Change code above this line } } - -const newBookList = add(bookList, 'A Brief History of Time'); -const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies'); -const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies'); - -console.log(bookList); ``` # --solutions-- @@ -134,8 +129,4 @@ function remove(bookList, bookName) { } return bookListCopy; } - -const newBookList = add(bookList, 'A Brief History of Time'); -const newerBookList = remove(bookList, 'On The Electrodynamics of Moving Bodies'); -const newestBookList = remove(add(bookList, 'A Brief History of Time'), 'On The Electrodynamics of Moving Bodies'); ```