Created
August 15, 2011 22:38
-
-
Save Eskatrem/1148056 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 is-palindrome [x] | |
(= x (Integer/parseInt (apply str (reverse (str x))))) | |
) | |
(defn problem4 [] | |
;Find the largest palindrome made from the product of two 3-digit numbers. | |
(def max-palindrome 0) | |
(doseq [i (range 999)] | |
(doseq [j (range i)] | |
(do | |
(def tmp (* i j)) | |
(if (and (is-palindrome tmp) (> tmp max-palindrome)) (def max-palindrome tmp))))) | |
max-palindrome | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment