Skip to content

Instantly share code, notes, and snippets.

@biesnecker
Created February 7, 2012 03:01
Show Gist options
  • Save biesnecker/1756869 to your computer and use it in GitHub Desktop.
Save biesnecker/1756869 to your computer and use it in GitHub Desktop.
Bell numbers
(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