Home

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.



Yawn. Iteration and multiplication? Let's try to one-line it in Python:


print [i*j for i in range(999, 900, -1) for j in range(999, 900,-1) if (str(i*j) == str(i*j)[::-1])][0]


Of course, this continues longer than it should, and is not guaranteed to find any palindrome numbers, but I don't know how to implement a break in a list comprehension, so it is what it is.