Project Euler with Ruby on WSL [Problem 25]
たまに問題の質が変わる
んだなぁ
問題
1000-digit Fibonacci number
The Fibonacci sequence is defined by the recurrence relation:
, where and . Hence the first 12 terms will be:
The 12th term, , is the first term to contain three digits.
What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
私訳
1000桁のフィボナッチ数
フィボナッチ数列の中で、最初に 1000 桁である項の添え字はいくつか?
解答方針
これ愚直にやると解けないんじゃないかとちょっと心配になる 12項につき 2 桁程度増えるとすると、1000桁増えるには 1000/2*12 = 6000 項ほど必要な計算になる
ってごり押しで行けそうな気がしてきたな
行けちゃった…。実際には 6000 よりだいぶ小さい。