Skip to content

Instantly share code, notes, and snippets.

@PEZ
Created January 14, 2009 23:25
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 PEZ/47155 to your computer and use it in GitHub Desktop.
Save PEZ/47155 to your computer and use it in GitHub Desktop.
"""Find the largest palindrom that is the product of two three-digit factors:
http://projecteuler.net/index.php?section=problems&id=4"""
# Brute force
def big_products(max):
for a in xrange(100, 1000):
for b in xrange(100, 1000):
yield str(a * b)
max(int(p) for p in big_products(999) if p == p[::-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment