Created
February 7, 2012 03:01
-
-
Save biesnecker/1756869 to your computer and use it in GitHub Desktop.
Bell numbers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn bell | |
"Returns the nth Bell number" | |
[n] | |
(cond | |
(= n 0) 1 | |
(= n 1) 1 | |
:else (reduce + (map #(abs (stirling-2 n %)) (range 0 (inc n)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment