def reversible(n): n_rev_str = str(n)[::-1] if n_rev_str.startswith("0"): return False n_rev = int(n_rev_str) ds = str(n + n_rev) for d in ds: if int(d) % 2 == 0: return False return True def euler_145(): # pure bruteforce, took about four minutes wity pypy count = 0 counted = set() for i in range(10**9): if not i in counted and reversible(i): count += 1 counted.add(i) return count if __name__ == "__main__": solution = euler_145() print("e145.py: " + str(solution)) assert(solution == 608720)