Skip to content

Instantly share code, notes, and snippets.

@baransu
Created June 7, 2017 20:16
Show Gist options
  • Save baransu/e43e12de26ed4e855e34eadbf9993eb6 to your computer and use it in GitHub Desktop.
Save baransu/e43e12de26ed4e855e34eadbf9993eb6 to your computer and use it in GitHub Desktop.
stirling :: Int -> Int -> Int
stirling n 0 = 0
stirling n 1 = 1
stirling n k
| n == k = 1
| k > n = 0
| otherwise =
stirling (n - 1) (k - 1) + k * stirling (n - 1) k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment