fix(curriculum): clean-up Project Euler 221-240 (#42839)
* fix: clean-up Project Euler 221-240 * fix: corrections from review Co-authored-by: Tom <20648924+moT01@users.noreply.github.com> Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
@ -8,32 +8,48 @@ dashedName: problem-230-fibonacci-words
|
||||
|
||||
# --description--
|
||||
|
||||
For any two strings of digits, A and B, we define FA,B to be the sequence (A,B,AB,BAB,ABBAB,...) in which each term is the concatenation of the previous two.
|
||||
For any two strings of digits, $A$ and $B$, we define $F_{A,B}$ to be the sequence ($A, B, AB, BAB, ABBAB, \ldots$) in which each term is the concatenation of the previous two.
|
||||
|
||||
Further, we define DA,B(n) to be the nth digit in the first term of FA,B that contains at least n digits.
|
||||
Further, we define $D_{A,B}(n)$ to be the $n^{\text{th}}$ digit in the first term of $F_{A,B}$ that contains at least $n$ digits.
|
||||
|
||||
Example:
|
||||
|
||||
Let A=1415926535, B=8979323846. We wish to find DA,B(35), say.
|
||||
Let $A = 1\\,415\\,926\\,535$, $B = 8\\,979\\,323\\,846$. We wish to find $D_{A,B}(35)$, say.
|
||||
|
||||
The first few terms of FA,B are: 1415926535 8979323846 14159265358979323846 897932384614159265358979323846 14159265358979323846897932384614159265358979323846
|
||||
The first few terms of $F_{A,B}$ are:
|
||||
|
||||
Then DA,B(35) is the 35th digit in the fifth term, which is 9.
|
||||
$$\begin{align}
|
||||
& 1\\,415\\,926\\,535 \\\\
|
||||
& 8\\,979\\,323\\,846 \\\\
|
||||
& 14\\,159\\,265\\,358\\,979\\,323\\,846 \\\\
|
||||
& 897\\,932\\,384\\,614\\,159\\,265\\,358\\,979\\,323\\,846 \\\\
|
||||
& 14\\,159\\,265\\,358\\,979\\,323\\,846\\,897\\,932\\,384\\,614\\,15\color{red}{9}\\,265\\,358\\,979\\,323\\,846
|
||||
\end{align}$$
|
||||
|
||||
Now we use for A the first 100 digits of π behind the decimal point: 14159265358979323846264338327950288419716939937510 58209749445923078164062862089986280348253421170679
|
||||
Then $D_{A,B}(35)$ is the ${35}^{\text{th}}$ digit in the fifth term, which is 9.
|
||||
|
||||
and for B the next hundred digits:
|
||||
Now we use for $A$ the first 100 digits of $π$ behind the decimal point:
|
||||
|
||||
82148086513282306647093844609550582231725359408128 48111745028410270193852110555964462294895493038196 .
|
||||
$$\begin{align}
|
||||
& 14\\,159\\,265\\,358\\,979\\,323\\,846\\,264\\,338\\,327\\,950\\,288\\,419\\,716\\,939\\,937\\,510 \\\\
|
||||
& 58\\,209\\,749\\,445\\,923\\,078\\,164\\,062\\,862\\,089\\,986\\,280\\,348\\,253\\,421\\,170\\,679
|
||||
\end{align}$$
|
||||
|
||||
Find ∑n = 0,1,...,17 10n× DA,B((127+19n)×7n) .
|
||||
and for $B$ the next hundred digits:
|
||||
|
||||
$$\begin{align}
|
||||
& 82\\,148\\,086\\,513\\,282\\,306\\,647\\,093\\,844\\,609\\,550\\,582\\,231\\,725\\,359\\,408\\,128 \\\\
|
||||
& 48\\,111\\,745\\,028\\,410\\,270\\,193\\,852\\,110\\,555\\,964\\,462\\,294\\,895\\,493\\,038\\,196
|
||||
\end{align}$$
|
||||
|
||||
Find $\sum_{n = 0, 1, \ldots, 17} {10}^n × D_{A,B}((127 + 19n) × 7^n)$.
|
||||
|
||||
# --hints--
|
||||
|
||||
`euler230()` should return 850481152593119200.
|
||||
`fibonacciWords()` should return `850481152593119200`.
|
||||
|
||||
```js
|
||||
assert.strictEqual(euler230(), 850481152593119200);
|
||||
assert.strictEqual(fibonacciWords(), 850481152593119200);
|
||||
```
|
||||
|
||||
# --seed--
|
||||
@ -41,12 +57,12 @@ assert.strictEqual(euler230(), 850481152593119200);
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function euler230() {
|
||||
function fibonacciWords() {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
euler230();
|
||||
fibonacciWords();
|
||||
```
|
||||
|
||||
# --solutions--
|
||||
|
Reference in New Issue
Block a user