示例#1
0
def is_lychrel(x):
    digs = eu.digits(x)
    for i in range(49):
        rdigs = digs[:]
        rdigs.reverse()
        x += eu.undigits(rdigs)
        digs = eu.digits(x)
        if eu.palindrome(digs):
            return False
    return True
示例#2
0
import euler_util

min_val = 99
max_pal = 0
for i in range(999,min_val,-1):
    for j in range(i,min_val,-1):
        val = i * j
        if euler_util.palindrome(str(val)):
            if val > max_pal:
                print i,j,val
                min_val = j
                max_pal = val
示例#3
0
import euler_util

sum = 0
for i in range(1000000):
    if euler_util.palindrome(str(i)) and euler_util.palindrome(euler_util.bin(i)):
        sum += i
print sum