From 9d96efdaf3e4e83cde50e228df29ece17e676035 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 12 Apr 2010 15:53:02 +0000 Subject: [PATCH] Problem 004 git-svn-id: file:///srv/svn/euler@22 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- 004.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 004.py diff --git a/004.py b/004.py new file mode 100644 index 0000000..d754d22 --- /dev/null +++ b/004.py @@ -0,0 +1,11 @@ +def palindrome(): + palindromes = {} + for i in range(999, 99, -1): + for ii in range(999,99, -1): + result = str(i * ii) + if result == result[::-1]: + palindromes[i * ii] = [i, ii] + p = sorted(palindromes.keys(), reverse=True)[0] + print 'Palindrome: {0}x{1}: {2}'.format(palindromes[p][0], palindromes[p][1], p) + +palindrome()