pal n = x == reverse x where x = show n main = print $ head $ filter pal [i*k | i <- [999,998..], k <- [999,998..]]