第四题原文如下:
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.
找出由两个三位数乘积构成的最大回文
一个回文数指的是从左向右和从右向左读都一样的数字。最大的由两个两位数乘积构成的回文数是9009 = 91 * 99.
找出最大的有由个三位数乘积构成的回文数。
python代码:
def FoundMaxPalindrome():
max = 0
for x in xrange(999, 100, -1):
for y in xrange(999, 100, -1):
if isPalindrome(str(x*y)):
if max < x*y:
max = x*y
print x, y ,max
print max