Skip to content

Instantly share code, notes, and snippets.

@cmoore
Created June 17, 2009 19:11
Show Gist options
  • Save cmoore/131429 to your computer and use it in GitHub Desktop.
Save cmoore/131429 to your computer and use it in GitHub Desktop.
fib :: ( Num t, Num t1 ) => t -> t1
fib 0 = 0
fib 1 = 1
fib n = fib (n-1) + fib (n-2)
cnl_clink :: (Num t, Num a, Ord a) => t -> [a]
cnl_clink x = let lx = fib x
in
if lx > 4000000 then
[]
else
[lx] ++ cnl_clink (x + 1)
problem_two :: Int
problem_two = do
sum $ filter even $ cnl_clink 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment