def main(): for Pa in ngonalNums(5): for Pb in ngonalNums(5): if Pb >= Pa: break if pentagonal(Pa + Pb) and pentagonal(Pa - Pb): return Pa - Pb
def main(limit): return next(n for n in ngonalNums(3) if n > limit and pentagonal(n) and hexagonal(n))