euler/Problem025.hs

6 lines
346 B
Haskell
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- The Fibonacci sequence is defined by the recurrence relation:
-- F(n) = F(n1) + F(n2), 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