Skip to content

Instantly share code, notes, and snippets.

@goyuninfo
Created May 19, 2014 19:36
Show Gist options
  • Save goyuninfo/06037c0ad5fbebce74bb to your computer and use it in GitHub Desktop.
Save goyuninfo/06037c0ad5fbebce74bb to your computer and use it in GitHub Desktop.
Project Euler Problem 4 Largest palindrome product
def is_palindrome(n):
"""Return True if n is a palindrome; False otherwise."""
s = str(n)
return s == s[::-1]
from itertools import product
print max(x * y for x, y in product(range(1000), repeat=2) if is_palindrome(x * y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment