from tools import number_theory from functools import reduce def multi(l): return reduce(lambda x, y: x * y, l, 1) def phi_rate(l): return reduce(lambda x, y: x * y / (y - 1), l, 1) def find_longest(l, ) def calc(limit): prime = list(number_theory.make_prime(int(limit ** 0.5) + 1)) result = [] for l in range(len(prime)): if multi(prime[:l]) > limit: l -= 1 i = 0 while True: if multi(prime[i:i + l]) < limit: result.append((phi_rate(prime[i:i + l]), prime[i:i + l])) i += 1 else: break return max(result) print(multi(calc(200000)[1]))