Skip to content

Instantly share code, notes, and snippets.

@windelicato
Created April 5, 2013 02:48
Show Gist options
  • Select an option

  • Save windelicato/5316212 to your computer and use it in GitHub Desktop.

Select an option

Save windelicato/5316212 to your computer and use it in GitHub Desktop.
Project Euler #15
factorial :: Integer -> Integer
factorial n = foldr (*) 1 [1..n]
choose :: Integer -> Integer -> Integer
choose n k = (factorial n) `div` ((factorial k) * (factorial (n - k)))
main :: IO ()
main = print $ choose 40 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment