Given a polynomial
p(x) with integral coefficients and a constant term of
p(0) = 1 or -1, and a nonnegative integer
N, return the
N-th coefficient of the power seris (sometimes called "Taylor series") of
f(x) = 1/p(x) developed at
x0 = 0, i.e., the coefficient of the monomial of degree
The given conditions ensure that the power series exist and that the its coefficients are integers.
As always the polynomial can be accepted in any convenient format, e.g. a list of coefficients, for instance
p(x) = x^3-2x+5 could be represented as
The powerseries of a function
f developed at
0 is given by
N-th coefficient (the coefficient of
x^N) is given by
where denotes the
n-th derivative of
p(x) = 1-xresults in the geometric series
f(x) = 1 + x + x^2 + ...so the output should be
p(x) = (1-x)^2 = x^2 - 2x + 1results in the derivative of the geometric series
f(x) = 1 + 2x + 3x^2 + 4x^3 + ..., so the output for
p(x) = 1 - x - x^2results in the generating function of the Fibonacci sequence
f(x) = 1 + x + 2x^2 + 3x^3 + 5x^4 + 8x^5 + 13x^6 + ...
p(x) = 1 - x^2results in the generating function of
f(x) = 1 + x^2 + x^4 + x^6 + ...
p(x) = (1 - x)^3 = 1 -3x + 3x^2 - x^3results in the generating function of the triangular numbers
f(x) = 1 + 3x + 6x^6 + 10x^3 + 15x^4 + 21x^5 + ...that means the
N-th coefficient is the binomial coefficient
p(x) = (x - 3)^2 + (x - 2)^3 = 1 + 6x - 5x^2 + x^3results in
f(x) = 1 - 6x + 41x^2 - 277x^3 + 1873x4 - 12664x^5 + 85626x^6 - 57849x^7 + ...