def solve(): # all hexagonal numbers are also triangle return next(n for n in set(pentagonal(100000)) & set(hexagonal(100000)) if n > 40755)
def solve(): l = list(pentagonal(10000)) s = set(l) return next(m - n for n in l for m in l if m - n in s if m + n in s)