Created
December 15, 2012 16:12
-
-
Save anonymous/4296706 to your computer and use it in GitHub Desktop.
; A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. ; Find the largest palindrome made from the product of two 3-digit numbers.
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
(def nums (for [x (range 100 1000) y (range 100 1000)] | |
(* x y))) | |
(defn palindromic? [n] | |
(let [n n rev-n (apply str (reverse (str n)))] | |
(= n (BigDecimal. rev-n)))) | |
(last (sort (filter palindromic? nums))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A number is palindrome, if number remains same after reversing it's digits. Here is the C program to check for palindrome number.