""" 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 Helper import isPalidrome product = 0 for i in range(100, 1000): for j in range(100, 1000): number = i*j if isPalidrome(number) == True: if product < number: product = number print product
def isLychrel(n): for i in range(49): n = n + int(str(n)[::-1]) if isPalidrome(n): return False return True
""" The decimal number, 585 = 1001001001 (binary), is palindromic in both bases. Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. (Please note that the palindromic number, in either base, may not include leading zeros.) This probelm bored, I wont waste time on it. So answers from http://blog.dreamshire.com/2009/03/29/project-euler-problem-36-solution/ """ from Helper import isPalidrome dec2bin = lambda n: str(bin(n))[2:] s = 0 limit = 1000000 for n in range(1, limit, 2): if isPalidrome(n) and isPalidrome(dec2bin(n)): s += n print "Answer to PE36 = ", s