2018-09-30 22:01:58 +00:00
---
id: 5900f4d21000cf542c50ffe5
title: 'Problem 358: Cyclic numbers'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 302018
2021-01-13 02:31:00 +00:00
dashedName: problem-358-cyclic-numbers
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
2021-07-29 17:14:22 +00:00
A cyclic number with $n$ digits has a very interesting property:
2018-09-30 22:01:58 +00:00
2021-07-29 17:14:22 +00:00
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!
2018-09-30 22:01:58 +00:00
2021-07-29 17:14:22 +00:00
The smallest cyclic number is the 6-digit number 142857:
2018-09-30 22:01:58 +00:00
2021-07-29 17:14:22 +00:00
$$\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}$$
2018-09-30 22:01:58 +00:00
Note that for cyclic numbers, leading zeros are important.
2021-07-29 17:14:22 +00:00
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.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-29 17:14:22 +00:00
`cyclicNumbers()` should return `3284144505` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-29 17:14:22 +00:00
assert.strictEqual(cyclicNumbers(), 3284144505);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-29 17:14:22 +00:00
function cyclicNumbers() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-29 17:14:22 +00:00
cyclicNumbers();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```