from tools import number_theory def make(x, y, z): return x ** 2 + y ** 3 + z ** 4 def count(limit): result = set() prime = list(number_theory.make_prime(int(limit ** 0.5) + 1)) for i in prime: for j in prime: for k in prime: trns = make(i, j, k) if trns > limit: break result.add(trns) if make(i, j, 2) > limit: break if make(i, 2, 2) > limit: break return result print(len(count(50000000)))