Advertisement
banovski

Project Euler, Problem #4, Haskell

Dec 1st, 2021 (edited)
2,023
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- A palindromic number reads the same both ways. The largest
  2. -- palindrome made from the product of two 2-digit numbers is
  3. -- 9009 = 91 × 99. Find the largest palindrome made from the product
  4. -- of two 3-digit numbers.
  5.  
  6. main :: IO ()
  7. main =
  8.   print $
  9.   maximum
  10.     [ z
  11.     | x <- [100 .. 999]
  12.     , y <- [100 .. 999]
  13.     , let z = x * y
  14.     , show z == reverse (show z)
  15.     ]
  16.  
  17. -- 906609
  18.  
  19. -- real 0m0,629s
  20. -- user 0m0,628s
  21. -- sys  0m0,000s
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement