Defining the combination formula (nCr) recursively.12345Prelude> let ncr n k | k == 0 = 1 | n == k = 1 | otherwise = ncr (n-1) k + ncr (n-1) (k-1)Prelude> ncr 3 23Prelude> ncr 15 41365
This works because http://www.cs.nott.ac.uk/~vxc/g51mcs/ch05_combinatorics.pdf , page 9.