Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (15 sloc) 493 Bytes
{-
- Solution to Project Euler problem 57
- Copyright (c) Project Nayuki. All rights reserved.
-
- https://www.nayuki.io/page/project-euler-solutions
- https://github.com/nayuki/Project-Euler-solutions
-}
limit = 1000
main = putStrLn (show ans)
ans = sum [1 | b <- take limit (contFracSeq 0 1), b]
contFracSeq :: Integer -> Integer -> [Bool]
contFracSeq n d = let
numer = d
denom = d * 2 + n
in (length (show (numer + denom)) > length (show denom)) : (contFracSeq numer denom)