Project Euler 4 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.
'''
from math import *
def reverse(string):
return string[::-1]
m=0
i1=0
while i1<1000:
i2=0
while i2<1000:
if reverse(str(i1*i2))==str(i1*i2):
if i1*i2>=m:
m=i1*i2
i2+=1
i1+=1
print m
转载于:https://blog.51cto.com/bigbi/1304563