A collection of implementations of common algorithms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
202 B

7 years ago
module Main where
-- find the rows of pascal's triangle
choose n 0 = 1
choose n k = (choose n (k-1)) * (n-k) `div` k
pascal n = [choose n i | i <- [0..n-1]]
main = mapM_ print $ map pascal [1..100]