summaryrefslogtreecommitdiff
path: root/Problem36.py
blob: 98e898c3e6ba08b502383473fe0c8afe629e994e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#Completed 9/13/2021 14:26
def isPalindrome(n):
    n = list(str(n))
    m = list(reversed(n))
    if n == m:
        return True
    else:
        return False
def isBitPalindrome(n):
    n = str(bin(n))
    return isPalindrome(n[2:])
count = 0
for x in range(1, 1000000):
    if(isPalindrome(x) and isBitPalindrome(x)):
        count+=x
print("Answer is:", count)