Created
February 14, 2014 23:55
-
-
Save mtayseer/9012059 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Translation of https://gist.github.com/alaafqandil/9009412 to Python | |
def multiple_of_3x3(num): | |
return any(num % i == 0 and len(str(num / i)) == 3 for i in reversed(xrange(100, 1000))) | |
def find_max_palindrome(): | |
for i in reversed(xrange(10)): | |
for j in reversed(xrange(10)): | |
for k in reversed(xrange(10)): | |
palindrome = int('{0}{1}{2}{2}{1}{0}'.format(i, j, k)) | |
if palindrome < 999 ** 2: | |
if multiple_of_3x3(palindrome): | |
return palindrome | |
print find_max_palindrome() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment