Created
August 15, 2011 22:42
-
-
Save amalloy/1148071 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
;; Project Euler problem 4 | |
;; Largest palindrome which is a product of two three-digit numbers | |
(apply max (for [x (range 1000), y (range x) | |
:let [prod (* x y)] | |
:when (apply = ((juxt seq reverse) (str prod)))] | |
prod)) | |
;; or without juxt: | |
(apply max (for [x (range 1000), y (range x) | |
:let [prod (* x y), s (str prod)] | |
:when (= (seq s) (reverse s))] | |
prod)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment