diff --git a/Problem065.hs b/Problem065.hs new file mode 100644 index 0000000..25760c0 --- /dev/null +++ b/Problem065.hs @@ -0,0 +1,10 @@ +-- Find the sum of digits in the numerator of the 100th convergent of the continued fraction for e. +import Euler + +convergent n = go $ take n e_cf + where + go [a] = a + go (a:as) = a + recip (go as) + e_cf = 2 : concatMap (\k -> [1, 2*k, 1]) [1..] + +main = print $ sum $ (\x->x::[Integer]) $ toDigits $ numerator $ convergent 100