Skip to content

Instantly share code, notes, and snippets.

@wilkes
Created March 16, 2010 15:17
Show Gist options
  • Save wilkes/334078 to your computer and use it in GitHub Desktop.
Save wilkes/334078 to your computer and use it in GitHub Desktop.
(defn perfect-number? [x]
(and (> x 0)
(== (apply + (filter #(= (rem x %) 0) (range 1 (inc x))))
x)))
(defn list-perfs [num]
(filter perfect-number? (range num)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment