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.


def largest_palprod(r):
    # r = digital resolution
    # this is not efficient enough to reasonably do more than 4 digits
    D = {}

    top = int('9' * r)
    for i in range(top, top//10, -1):
        for j in range(i, top//10, -1):
            if str(i * j) == str(i * j)[::-1]:
                D.update({i*j:f'{i} * {j}'})
        
    return f'{D[max(D)]} = {max(D)}'

print(largest_palprod(4))
Click to reveal output
9999 * 9901 = 99000099

See problem 4 on projecteuler.net