Skip to content

Instantly share code, notes, and snippets.

@narma
Created August 15, 2012 12:07
Show Gist options
  • Save narma/3359558 to your computer and use it in GitHub Desktop.
Save narma/3359558 to your computer and use it in GitHub Desktop.
clojure test
(defn factors-sorted-by-product [start end]
(map rest (let [r (reverse (range start end))]
(reverse (sort-by first (for [x r y r :when (>= x y)]
(list (* x y) x y)
)
))
)
))
(defn get-diff-factors [vals]
(loop [ar (seq vals) res (vector)]
(if (empty? ar)
res
(recur (next ar) (conj res (map - (second ar) (first ar)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment