Files
freeCodeCamp/curriculum/challenges/japanese/10-coding-interview-prep/project-euler/problem-358-cyclic-numbers.md
2022-04-02 17:46:30 +09:00

58 lines
1.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f4d21000cf542c50ffe5
title: '問題 358: 巡回数'
challengeType: 5
forumTopicId: 302018
dashedName: problem-358-cyclic-numbers
---
# --description--
$n$ 桁の巡回数は非常に興味深い性質を持っています:
1, 2, 3, 4, ... $n$ を乗じると、すべての積に全く同じ数字が使われ、数字を循環させると順序も同じになります!
最小の巡回数は、6 桁の数 142857 です。
$$\begin{align} & 142857 × 1 = 142857 \\\\
& 142857 × 2 = 285714 \\\\ & 142857 × 3 = 428571 \\\\
& 142857 × 4 = 571428 \\\\ & 142857 × 5 = 714285 \\\\
& 142857 × 6 = 857142 \end{align}$$
次の巡回数は、16 桁の 0588235294117647 です。
$$\begin{align} & 0588235294117647 × 1 = 0588235294117647 \\\\
& 0588235294117647 × 2 = 1176470588235294 \\\\ & 0588235294117647 × 3 = 1764705882352941 \\\\
& \ldots \\\\ & 0588235294117647 × 16 = 9411764705882352 \end{align}$$
なお、巡回数では先行ゼロが重要です。
左端の 11 桁が 00000000137 で、右端の 5 桁が 56789 (すなわち $00000000137\ldots56789$ の形を取り、中間の数字は不明) の巡回数は 1 つしかありません。 この数のすべての桁の和を求めなさい。
# --hints--
`cyclicNumbers()``3284144505` を返す必要があります。
```js
assert.strictEqual(cyclicNumbers(), 3284144505);
```
# --seed--
## --seed-contents--
```js
function cyclicNumbers() {
return true;
}
cyclicNumbers();
```
# --solutions--
```js
// solution required
```