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