Project Euler Problem 4: Largest palindrome product

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.

In [1]:
from six.moves import filter, range
In [2]:
is_palindrome = lambda s: s == s[::-1]
num_is_palindrome = lambda n: is_palindrome(str(n))
In [3]:
max(filter(num_is_palindrome, (x*y for x in range(100, 1000) for y in range(x, 1000))))
Out[3]:
906609

Comments

Comments powered by Disqus