a*100000 + b*10000 + c*1000 + c*100 * b*10 + a = a*100001 + b*10010 + c*1100 ''' import time t = time.time() tally = 0 for a in range(1,10,2): num1 = a num2 = a*11 if cf.is_palindrome(str(bin(num1))[2:]): tally += num1 if cf.is_palindrome(str(bin(num2))[2:]): tally += num2 for b in range(10): num3 = a*101 + b*10 num4 = a*1001 + b*110 if cf.is_palindrome(str(bin(num3))[2:]): tally += num3 if cf.is_palindrome(str(bin(num4))[2:]): tally += num4 for c in range(10): num5 = a*10001 + b*1010 + c*100
''' Created on 2013-01-22 @author: paymahn ''' import CommonFunctions as cf print str(bin(956978)) tally = 0 for i in range(1000000): if cf.is_palindrome(i) and cf.is_palindrome(str(bin(i))[2:]): tally += i print i print tally