Last active
October 21, 2016 05:57
-
-
Save JacksonGariety/21441e8c397a2a44580b0e75a8c6be8c 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
import Data.List | |
main = print $ largestPalindrome 3 | |
isPalindrome :: Integer -> Bool | |
isPalindrome n = | |
let s = show n | |
in reverse s == s | |
largestPalindrome :: Integer -> Integer | |
largestPalindrome e = last . sort $ filter isPalindrome [x * y | x <- [100..10^e], y <- [100..10^e], y >= x] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment