def solve(seq): """Return the Polynomial that can be used to compute the given sequence""" coefficients = calculateCoefficients(seq) p = Polynomial() for i in xrange(0, len(coefficients)): p = p.plus(Polynomial(coefficients[i]).times(factorialPower(i))) p.removeTrailingZeroes() return p