/ Published in: Haskell
URL: http://projecteuler.net/index.php?section=problems&id=4
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.
There are shorter ways to do this, and I cheat a bit by counting down to 900 rather than 100, but this one short-circuits when it finds the answer, and so is very efficient.
Expand |
Embed | Plain Text
isPalindrome [] = True in (str2 == str) findPal [] = 0 mult = x * y in case pal of True -> mult False -> findPal xs main = do
You need to login to post a comment.
