Problem 36：Double-base palindromes
The decimal number, 585 = 10010010012 (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.)
sum = 0 for i in range(1, 1000000): strNum = str(i) strBinaryNum = str(format(i, 'b')) if(strNum == strNum[::-1] and strBinaryNum == strBinaryNum[::-1]): print(strNum, strBinaryNum) sum += i print(sum)