6 lines
346 B
Haskell
6 lines
346 B
Haskell
-- The Fibonacci sequence is defined by the recurrence relation:
|
||
-- F(n) = F(n−1) + F(n−2), where F(1) = 1 and F(2) = 1.
|
||
-- What is the index of the first term in the Fibonacci sequence to contain 1000 digits?
|
||
fibs = 1 : 1 : zipWith (+) (tail fibs) fibs
|
||
main = print $ fst $ head $ filter ((>= 1000) . length . show . snd) $ zip [1..] fibs
|