Skip to content

Instantly share code, notes, and snippets.

@Eskatrem
Created August 15, 2011 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eskatrem/1148056 to your computer and use it in GitHub Desktop.
Save Eskatrem/1148056 to your computer and use it in GitHub Desktop.
(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