sabato 9 ottobre 2010

Problem 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.

solution = maximum $ filter isPalindromic [x*y | x ← [2..999], y ← [2..999]]

isPalindromic x = text ≡ (reverse text)
    where text = show x

Nessun commento:

Posta un commento