Skip to content

Instantly share code, notes, and snippets.

@theoretick
Created September 2, 2014 23:52
Show Gist options
  • Save theoretick/5b977bede02bbe263fe1 to your computer and use it in GitHub Desktop.
Save theoretick/5b977bede02bbe263fe1 to your computer and use it in GitHub Desktop.
(defn prob3 [target]
(let [factorials [] biggest target]
(dotimes [num target]
(if-not (or (contains? [0, 1] num) (> num biggest))
(if (= (rem target num) 0)
(recur [(/ biggest num)
(if-not (contains? factorials num)
(def factorials (conj factorials num)))
]))))
(println factorials)))
(time (p3 600851475143))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment