Last active
August 29, 2015 13:56
-
-
Save mtayseer/9009867 to your computer and use it in GitHub Desktop.
Solution for http://projecteuler.net/problem=4
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
def is_palindrome(x): | |
x = str(x) | |
return x == x[::-1] | |
def find_palindromes(m, n): | |
for i in xrange(m, n): | |
for j in xrange(i, n): | |
x = i * j | |
if is_palindrome(x): | |
yield x | |
print max(find_palindromes(100, 1000)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment