From 8bc3076a0ddd26075dc5cdae018dc5c3c0a8cd12 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Tue, 4 May 2010 12:54:43 +0000 Subject: [PATCH] Problem 036 git-svn-id: file:///srv/svn/euler@60 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- e036.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 e036.py diff --git a/e036.py b/e036.py new file mode 100644 index 0000000..72855eb --- /dev/null +++ b/e036.py @@ -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