def is_lychrel(n): t = 1 for i in xrange(1, 50): n += int(str(n)[::-1]) if is_palindromic(n): t = 0 break return t
from gauss import (is_palindromic, base_change) s = 0 for n in xrange(1, 1000000): if is_palindromic(n) and is_palindromic(base_change(n, 2)): s += n print s