def run(): maximum = 999 palindrome = -1 i = maximum while i > 0 and palindrome == -1: j = 0 while i+j <= maximum-j: if euler.isPalindrome((i+j)*(maximum-j)): palindrome = (i+j)*(maximum-j) j += 1 i -= 1 return palindrome
def run(): matches = set([]) limit = 10**8 for i in xrange(1, 7071): j = 2 while True: n = sumNConsecutiveSquares(i, j) if n >= limit: break if euler.isPalindrome(n): matches.add(n) j += 1 return sum(matches)
from euler import isPalindrome output = 0 m = 0 n = 0 for i in range(999, 100, -1): for j in range(999, 100, -1): result = i * j if isPalindrome(result): if output < result: output = result m = i n =j print output, m, n
from euler import isPalindrome output = 0 m = 0 n = 0 for i in range(999, 100, -1): for j in range(999, 100, -1): result = i * j if isPalindrome(result): if output < result: output = result m = i n = j print output, m, n
def isLychrel(n): for _ in range(1, 51): n = reverseAndAdd(n) if euler.isPalindrome(n): return False return True
def isPalindrome(n): ''' Determine if n is a palindrome. ''' digits = euler.digitize(n) return euler.isPalindrome(digits)
def isLychrel(num): for i in range(0, 50): num += int(str(num)[::-1]) if e.isPalindrome(str(num)): return True return False