Simplify pentagon_numbers function by bettter using generators.