fix(curriculum): clean-up Project Euler 341-360 (#42998)

* fix: clean-up Project Euler 341-360

* fix: improve wording

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
This commit is contained in:
gikf
2021-07-29 19:14:22 +02:00
committed by GitHub
parent 7e41f19633
commit c18554dd44
20 changed files with 271 additions and 168 deletions

View File

@ -8,24 +8,41 @@ dashedName: problem-358-cyclic-numbers
# --description--
A cyclic number with n digits has a very interesting property:
A cyclic number with $n$ digits has a very interesting property:
When it is multiplied by 1, 2, 3, 4, ... n, all the products have exactly the same digits, in the same order, but rotated in a circular fashion!
When it is multiplied by 1, 2, 3, 4, ... $n$, all the products have exactly the same digits, in the same order, but rotated in a circular fashion!
The smallest cyclic number is the 6-digit number 142857 : 142857 × 1 = 142857 142857 × 2 = 285714 142857 × 3 = 428571 142857 × 4 = 571428 142857 × 5 = 714285 142857 × 6 = 857142
The smallest cyclic number is the 6-digit number 142857:
The next cyclic number is 0588235294117647 with 16 digits : 0588235294117647 × 1 = 0588235294117647 0588235294117647 × 2 = 1176470588235294 0588235294117647 × 3 = 1764705882352941 ... 0588235294117647 × 16 = 9411764705882352
$$\begin{align}
& 142857 × 1 = 142857 \\\\
& 142857 × 2 = 285714 \\\\
& 142857 × 3 = 428571 \\\\
& 142857 × 4 = 571428 \\\\
& 142857 × 5 = 714285 \\\\
& 142857 × 6 = 857142
\end{align}$$
The next cyclic number is 0588235294117647 with 16 digits:
$$\begin{align}
& 0588235294117647 × 1 = 0588235294117647 \\\\
& 0588235294117647 × 2 = 1176470588235294 \\\\
& 0588235294117647 × 3 = 1764705882352941 \\\\
& \ldots \\\\
& 0588235294117647 × 16 = 9411764705882352
\end{align}$$
Note that for cyclic numbers, leading zeros are important.
There is only one cyclic number for which, the eleven leftmost digits are 00000000137 and the five rightmost digits are 56789 (i.e., it has the form 00000000137...56789 with an unknown number of digits in the middle). Find the sum of all its digits.
There is only one cyclic number for which, the eleven leftmost digits are 00000000137 and the five rightmost digits are 56789 (i.e., it has the form $00000000137\ldots56789$ with an unknown number of digits in the middle). Find the sum of all its digits.
# --hints--
`euler358()` should return 3284144505.
`cyclicNumbers()` should return `3284144505`.
```js
assert.strictEqual(euler358(), 3284144505);
assert.strictEqual(cyclicNumbers(), 3284144505);
```
# --seed--
@ -33,12 +50,12 @@ assert.strictEqual(euler358(), 3284144505);
## --seed-contents--
```js
function euler358() {
function cyclicNumbers() {
return true;
}
euler358();
cyclicNumbers();
```
# --solutions--