generator for Legendre polynomials