Add solution for problem 65.
This commit is contained in:
parent
5a172a158e
commit
f1e442c1b3
|
|
@ -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
|
||||||
Loading…
Reference in New Issue