mirror of
https://github.com/correl/euler.git
synced 2024-12-26 03:00:07 +00:00
Problem 036
git-svn-id: file:///srv/svn/euler@60 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
793812b67b
commit
8bc3076a0d
1 changed files with 19 additions and 0 deletions
19
e036.py
Normal file
19
e036.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
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
|
Loading…
Reference in a new issue