Skip to content

Instantly share code, notes, and snippets.

@jaredcacurak
Created January 25, 2011 22:33
Show Gist options
  • Select an option

  • Save jaredcacurak/795838 to your computer and use it in GitHub Desktop.

Select an option

Save jaredcacurak/795838 to your computer and use it in GitHub Desktop.
A Clojure solution for Project Euler - Problem 6
(def whole-numbers (iterate inc 1))
(defn square [n] (* n n))
(defn sum-of-squares [n]
(reduce +
(take n
(map square whole-numbers))))
(defn square-of-sum [n]
(square
(reduce +
(take n whole-numbers))))
(- (square-of-sum 100) (sum-of-squares 100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment