volver

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.


Dado que las parejas de números de 3 dígitos son como mucho 8992 (999100) combinaciones, esto no es un problema para hacerlo a fuerza bruta.

Es decir, listamos los números en dos loops, comparamos el producto y los dígitos del producto a la inversa, y si es palindromo, nos quedamos con el máximo:

max=0,0,0
for i in range(100, 999):
    for j in range(100, 999):
        l=str(i*j)
        if l==l[::-1] and i*j>max[-1]:
            max=i,j,i*j
print(max)