|
|
@@ -0,0 +1,17 @@
|
|
|
+
|
|
|
+import Utils
|
|
|
+
|
|
|
+import Data.Tuple
|
|
|
+
|
|
|
+fibonacciWhile :: (Integer -> Bool) -> (Int, Integer)
|
|
|
+fibonacciWhile f = go' 1 1 1
|
|
|
+ where
|
|
|
+ go' i f1 f2
|
|
|
+ | f f1 = go' (i+1) (f1+f2) f1
|
|
|
+ | otherwise = (i, f1)
|
|
|
+
|
|
|
+solution :: Int
|
|
|
+solution = (fibonacciWhile (\x -> (length $ show x) < 1000) |> fst) + 1
|
|
|
+
|
|
|
+main :: IO ()
|
|
|
+main = putStrLn ("Solution: " ++ show solution)
|