Skip to content

Instantly share code, notes, and snippets.

@dbyrne
Created March 25, 2011 20:50
Show Gist options
  • Save dbyrne/887605 to your computer and use it in GitHub Desktop.
Save dbyrne/887605 to your computer and use it in GitHub Desktop.
Project Euler #36 - Clojure
(defn palindrome? [x]
(= x (apply str (reverse x))))
(defn palindromic-2-10? [x]
(let [dec (Integer/toString x)
bin (Integer/toString x 2)]
(and (palindrome? dec) (palindrome? bin))))
(with-test
(defn prob-36 []
(apply + (filter
palindromic-2-10?
(range 1 1000000))))
(is (= (prob-36) 872187)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment