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,求三位数最大的回文数
解答
1 2 3 4 5 6 7 8 9 10 11 12 13
def(): list=[] for i in range(999,99,-1): for j in range(999,99,-1): product = i*j productlist = str(product) if productlist[0]==productlist[-1] and productlist[1]==productlist[-2] and productlist[2]==productlist[-3]: productInt = int(productlist) list.append(productInt) list.sort() print(list[-1]) return list[-1] ouler4()
近期评论