Created
February 7, 2010 17:28
-
-
Save lypanov/297543 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn square [x] (* x x)) | |
(defn search | |
([a b c] | |
(if (and (= (+ (square a) (square b)) (square c)) | |
(= 12 (+ a b c))) [[a b c]])) | |
([b c] | |
(first (filter seq (map #(search % b c) (range 1 b))))) | |
([c] | |
(first (filter seq (map #(search % c) (range 1 c))))) | |
([] | |
(first (filter seq (map #(search %) (iterate inc 1)))))) | |
(apply * (first (search))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment