Skip to content

Instantly share code, notes, and snippets.

@amalloy
Forked from zolrath/gist:1177848
Created August 29, 2011 06:28
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save amalloy/1177884 to your computer and use it in GitHub Desktop.
Clojure 1.2.1 vs 1.3.0-beta2 Question
(letfn [(divides? [num div]
(zero? (mod num div)))
(divisors [n]
(filter #(divides? n %) (range 1 n)))
(d [n] (apply + (divisors n)))]
(apply +
(for [i (range 1 1000)
:let [di (d i)]
j (range 1 i)
:when (and (= di j) (= i (d j)))
num [i j]]
num)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment