Skip to content

Instantly share code, notes, and snippets.

@edalorzo
Created November 25, 2012 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edalorzo/4142197 to your computer and use it in GitHub Desktop.
Save edalorzo/4142197 to your computer and use it in GitHub Desktop.
Project Euler-Problem #4
def is_palindrome(n):
text = str(n)
return text == text[::-1]
def palindromes():
for j in range(100,1000):
for k in range(100,1000):
product = j * k
if is_palindrome(product):
yield product
if __name__ == '__main__':
print "The largest palindrome made from the product of two 3-digit numbers is %d" % max(palindromes())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment