mirror of
https://github.com/correl/euler.git
synced 2024-11-23 19:19:53 +00:00
19 lines
353 B
Python
19 lines
353 B
Python
MAX = 1000000
|
|
|
|
def binary(n):
|
|
return '{0:b}'.format(n)
|
|
|
|
if __name__ == '__main__':
|
|
total = 0
|
|
i = 0
|
|
while i < MAX:
|
|
i = i + 1
|
|
n = str(i)
|
|
if n != n[::-1]:
|
|
continue
|
|
b = binary(i)
|
|
if b != b[::-1]:
|
|
continue
|
|
print n, b
|
|
total = total + i
|
|
print 'Total:', total
|