Problem 57 » 履歴 » バージョン 1
Noppi, 2024/01/22 10:50
| 1 | 1 | Noppi | [ホーム](https://redmine.noppi.jp) - [[Wiki|Project Euler]] |
|---|---|---|---|
| 2 | # [[Problem 57]] |
||
| 3 | |||
| 4 | ## Square Root Convergents |
||
| 5 | It is possible to show that the square root of two can be expressed as an infinite continued fraction. |
||
| 6 | |||
| 7 | <p style="text-align:center">$\sqrt 2 =1+ \frac 1 {2+ \frac 1 {2 +\frac 1 {2+ \dots}}}$</p> |
||
| 8 | |||
| 9 | By expanding this for the first four iterations, we get: |
||
| 10 | |||
| 11 | $1 + \frac 1 2 = \frac 32 = 1.5$ |
||
| 12 | $1 + \frac 1 {2 + \frac 1 2} = \frac 7 5 = 1.4$ |
||
| 13 | $1 + \frac 1 {2 + \frac 1 {2+\frac 1 2}} = \frac {17}{12} = 1.41666 \dots$ |
||
| 14 | $1 + \frac 1 {2 + \frac 1 {2+\frac 1 {2+\frac 1 2}}} = \frac {41}{29} = 1.41379 \dots$ |
||
| 15 | |||
| 16 | The next three expansions are $\frac {99}{70}$, $\frac {239}{169}$, and $\frac {577}{408}$, but the eighth expansion, $\frac {1393}{985}$, is the first example where the number of digits in the numerator exceeds the number of digits in the denominator. |
||
| 17 | |||
| 18 | In the first one-thousand expansions, how many fractions contain a numerator with more digits than the denominator? |
||
| 19 | |||
| 20 | ## 平方根の近似分数 |
||
| 21 | 2の平方根は無限に続く連分数で表すことができる. |
||
| 22 | |||
| 23 | <div style="text-align:center">√ 2 = 1 + 1/(2 + 1/(2 + 1/(2 + ... ))) = 1.414213...</div> |
||
| 24 | |||
| 25 | 最初の4回の繰り返しを展開すると以下が得られる. |
||
| 26 | |||
| 27 | 1 + 1/2 = 3/2 = 1.5 |
||
| 28 | 1 + 1/(2 + 1/2) = 7/5 = 1.4 |
||
| 29 | 1 + 1/(2 + 1/(2 + 1/2)) = 17/12 = 1.41666... |
||
| 30 | 1 + 1/(2 + 1/(2 + 1/(2 + 1/2))) = 41/29 = 1.41379... |
||
| 31 | |||
| 32 | 次の3つの項は99/70, 239/169, 577/408である. 第8項は1393/985である. これは分子の桁数が分母の桁数を超える最初の例である. |
||
| 33 | |||
| 34 | 最初の1000項を考えたとき, 分子の桁数が分母の桁数を超える項はいくつあるか? |
||
| 35 | |||
| 36 | ```scheme |
||
| 37 | ``` |