Skip to content

Commit

Permalink
visual fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dionyziz committed May 2, 2012
1 parent 3935377 commit be23cab
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions problem-125/125.py
@@ -1,19 +1,17 @@
from math import *

def palindrome( s ):
return str( s )[ ::-1 ] == str( s )
return s[ ::-1 ] == s

seen = {}
ret = 0
N = pow( 10, 8 )
sqrtN = int( sqrt( N ) )
for i in xrange( 1, sqrtN ):
s = i * i
for j in xrange( i + 1, sqrtN ):
s = s + j * j
s += j * j
if s > N:
break
if palindrome( s ) and s not in seen:
if palindrome( str( s ) ):
seen[ s ] = True
ret = ret + s
print ret
print sum( iter( seen ) )

0 comments on commit be23cab

Please sign in to comment.