Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MILLION = 1000000
- DECIMAL_FORMAT = "{0:d}"
- BINARY_FORMAT = "{0:b}"
- def is_palindromic(l):
- return l == l[::-1]
- sum = 0
- for i in range(1, MILLION):
- if is_palindromic(DECIMAL_FORMAT.format(i)) and is_palindromic(BINARY_FORMAT.format(i)):
- sum += i
- print(sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement