🌚

欧拉工程第四解

Posted at — Oct 22, 2008
#Python #数学 #欧拉工程 #算法 #编程

第四解:

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.

解:

```python largestPalindrome = 0 for i in range(100,1000): for j in range(100,1000): product = i * j if int(str(product)[::-1]) == product and product > largestPalindrome: largestPalindrome = product print largestPalindrome ```

穷举,有没有效率高的办法?