diff options
Diffstat (limited to 'Problem36.py')
-rw-r--r-- | Problem36.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Problem36.py b/Problem36.py new file mode 100644 index 0000000..98e898c --- /dev/null +++ b/Problem36.py @@ -0,0 +1,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)
\ No newline at end of file |