Problem 35

Double-base palindromes

Problem 37

Double-base palindromes

Problem 36

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.)
from tools import is_palindrome


def run(limit=1000000):
    total = 0
    for i in range(limit):
        if is_palindrome(str(i)):
            if is_palindrome(bin(i)[2:]):
                total += i

    return total