Created
February 15, 2014 02:52
-
-
Save funkotron/9013877 to your computer and use it in GitHub Desktop.
Problem 4 of Project Euler in Clojure
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 palindrome? | |
"Is x the same read backwards?" | |
[x] | |
(let [s (seq (str x))] | |
(= s (reverse s)))) | |
(def three-digit-products | |
"All the products of two three-digit numbers" | |
(for [x (range 100 999) | |
y (range 100 999)] | |
(* x y))) | |
;; Find the maximum number composed of two three-digit | |
;; products that is a palindrome. | |
(reduce max (filter palindrome? three-digit-products) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment