Example #1
0
def pe004():
    """Find the largest palindrome made from the product of two 3-digit numbers"""
    from tools import isPalindrome

    pmax = 0
    for i in xrange(100, 1000):
        for j in xrange(i, 1000):
            p = i * j
            if isPalindrome(str(p)) and p > pmax:
                pmax = p
                
    return pmax
Example #2
0
#! /usr/bin/python
from tools import isPalindrome

print sum([i for i in xrange(1000001) if isPalindrome(str(i)) and isPalindrome(str(bin(i))[2:])])
Example #3
0
def reverseProducts():
    l = [(i * j, i, j) for i in range(100, 999) for j in range(100, 999)
         if isPalindrome(str(i * j))]
    return max(l)
Example #4
0
def reverseProducts():
    l = [(i * j, i, j) for i in range(100, 999) for j in range(100, 999) if isPalindrome(str(i * j))]
    return max(l)