Skip to content

Instantly share code, notes, and snippets.

@mtayseer
Created February 14, 2014 23:55
Show Gist options
  • Save mtayseer/9012059 to your computer and use it in GitHub Desktop.
Save mtayseer/9012059 to your computer and use it in GitHub Desktop.
# 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