Pages

Project Euler Problem #4 with Python: Largest Palindrome

To find the largest palindromic number from multiplying two three digit numbers, I used the following python code:

def is_palindromic(n):
    return str(n) == str(n)[::-1]

print max(i*j for i in xrange(999,99,-1) for j in xrange(999,99,-1) if is_palindromic(i*j))

0 comments:

Post a Comment