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]:
def pal_check(num):
    if (str(num) == str(num)[::-1]):
        return True
    else:
        return False
    
maxn= 0
for i in range(100, 1000):
    for j in range(i, 1000):
        val = i * j
        if (pal_check(val) and val > maxn):
            maxn = val
            fac1 = i
            fac2 = j

print(maxn)
print(fac1)
print(fac2)
#raise NotImplementedError()


906609
913
993

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