tasks a-s

This commit is contained in:
Ingy döt Net 2013-04-10 23:57:08 -07:00
parent 47bf37c096
commit b83f433714
12433 changed files with 156208 additions and 123 deletions

View file

@ -0,0 +1,10 @@
-- Three infinite lists, corresponding to the three definitions in the problem
-- statement.
cats1 = map (\n -> product [n+2..2*n] `div` product [1..n]) [0..]
cats2 = 1 : map (\n -> sum $ zipWith (*) (reverse (take n cats2)) cats2) [1..]
cats3 = scanl (\c n -> c*2*(2*n-1) `div` (n+1)) 1 [1..]
main = mapM_ (print . take 15) [cats1, cats2, cats3]