2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4d21000cf542c50ffe5
|
2020-12-16 07:37:30 +00:00
|
|
|
|
title: 问题358:循环数
|
2018-10-10 22:03:03 +00:00
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --description--
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
具有n位数字的循环数具有一个非常有趣的属性:
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
当乘以1、2、3、4,... n时,所有乘积都具有完全相同的数字,并且顺序相同,但是以循环方式旋转!
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
最小的循环数是6位数字142857: 142857×1 = 142857 142857×2 = 285714 142857×3 = 428571 142857×4 = 571428 142857×5 = 714285 142857×6 = 857142
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
下一个循环号是16位数字0588235294117647: 0588235294117647×1 = 0588235294117647 0588235294117647×2 = 1176470588235294 0588235294117647×3 = 1764705882352941 ... 0588235294117647×16 = 9411764705882352
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
|
|
|
|
请注意,对于循环数,前导零很重要。
|
|
|
|
|
|
|
|
|
|
只有一个循环数,其最左边的11个数字为00000000137,最右边的5个数字为56789(即其形式为00000000137 ... 56789,中间是未知数字)。 查找所有数字的总和。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --hints--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
`euler358()`应返回3284144505。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 07:37:30 +00:00
|
|
|
|
assert.strictEqual(euler358(), 3284144505);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --solutions--
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|