From 1161f9a034de06a63538e3a9a0b7717098c744d9 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Fri, 7 Apr 2023 08:13:49 -0500 Subject: Initial Commit --- Problem36.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Problem36.py (limited to 'Problem36.py') 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 -- cgit v1.2.3