Project Euler: Problem 4

https://projecteuler.net/problem=4

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]:
p=[]
#nested loops, multiply every 3-digit number to every other 3-digit number.
for i in range(100,1000):
    for x in range(100,1000):
        a = i*x
        #checks if number produced is same forward and backward
        if str(a)==str(a)[::-1]:
            p.append(a)

In [25]:
print (max(p))


906609

In [24]:
# This cell will be used for grading, leave it at the end of the notebook.