Problem 26 » 履歴 » バージョン 1
Noppi, 2024/01/08 04:28
| 1 | 1 | Noppi | [ホーム](https://redmine.noppi.jp) - [[Wiki|Project Euler]] |
|---|---|---|---|
| 2 | # [[Problem 26]] |
||
| 3 | |||
| 4 | ## Reciprocal Cycles |
||
| 5 | A unit fraction contains $1$ in the numerator. The decimal representation of the unit fractions with denominators $2$ to $10$ are given: |
||
| 6 | |||
| 7 | $1/2 = 0.5$ |
||
| 8 | $1/3 =0.(3)$ |
||
| 9 | $1/4 =0.25$ |
||
| 10 | $1/5 = 0.2$ |
||
| 11 | $1/6 = 0.1(6)$ |
||
| 12 | $1/7 = 0.(142857)$ |
||
| 13 | $1/8 = 0.125$ |
||
| 14 | $1/9 = 0.(1)$ |
||
| 15 | $1/10 = 0.1$ |
||
| 16 | |||
| 17 | Where $0.1(6)$ means $0.166666\cdots$, and has a $1$-digit recurring cycle. It can be seen that $1/7$ has a $6$-digit recurring cycle. |
||
| 18 | |||
| 19 | Find the value of $d \lt 1000$ for which $1/d$ contains the longest recurring cycle in its decimal fraction part. |
||
| 20 | |||
| 21 | ## 逆数の循環節 その1 |
||
| 22 | 単位分数とは分子が1の分数である. 分母が2から10の単位分数を10進数で表記すると次のようになる. |
||
| 23 | |||
| 24 | 1/2 = 0.5 |
||
| 25 | 1/3 = 0.(3) |
||
| 26 | 1/4 = 0.25 |
||
| 27 | 1/5 = 0.2 |
||
| 28 | 1/6 = 0.1(6) |
||
| 29 | 1/7 = 0.(142857) |
||
| 30 | 1/8 = 0.125 |
||
| 31 | 1/9 = 0.(1) |
||
| 32 | 1/10 = 0.1 |
||
| 33 | |||
| 34 | 0.1(6)は 0.166666... という数字であり, 1桁の循環節を持つ. 1/7 の循環節は6桁ある. |
||
| 35 | |||
| 36 | d < 1000 なる 1/d の中で小数部の循環節が最も長くなるような d を求めよ. |
||
| 37 | |||
| 38 | ```scheme |
||
| 39 | ``` |