Assume that $$ g\left(x\right)=\int\frac{x^2-12}{\left(x^2-6x+k\right)^2}dx, $$ where $k \in \Bbb N$, is a rational function. Find sum of all possible values of k.
My attempt: \begin{align*} g\left(x\right) &=\int\frac{x^2-12}{\left(x^2-6x+k\right)^2}dx \\ &=\int\frac{1}{x^2-6x+k}dx + 3\int\frac{\left(2x-6\right)}{\left(x^2-6k+k\right)^2}dx + \left(6-k\right)\int\frac{1}{\left(x^2-6k+k\right)^2}dx \\ &=\int\frac{1}{\left(x-3\right)^2+k-9}dx + 3\int\frac{\left(2x-6\right)}{\left(x^2-6k+k\right)^2}dx + \left(6-k\right)\int\frac{1}{\left(x^2-6k+k\right)^2}dx \end{align*}
I know $k=9$ is a solution as it makes the quadratic in the denominator a perfect square but how am I supposed to go about finding the other solutions? Is there a better approach than using partial fractions? I also don't know how to integrate the last term (dx/biquadratic)...
You can make it faster writing $$P=\frac{x^2-12}{\left(x^2-6 x+k\right)^2}=\frac{x^2-12}{(x-a)^2\,(x-b)^2}$$
Using partial fraction decomposition $$P=\frac{2 (a b-12)}{(a-b)^3}\left(\frac 1{x-b}-\frac 1{x-a}\right)+\frac 1{(a-b)^2}\left(\frac{a^2-12}{(x-a)^2}+\frac{b^2-12}{(x-b)^2} \right)$$
Integrate term wise and look at the limit of the result when $b\to a$.