Another integral $\int \frac{3 x^2+2 x+1}{ \left(x^3+x^2+x+2\right) \sqrt{1+\sqrt{x^3+x^2+x+2}}} \, dx$ Here is an indefinite integral that is similar to an integral I wanna propose for a contest. Apart from 
using CAS, do you see any very easy way of calculating it?
$$\int \frac{1+2x +3 x^2}{\left(2+x+x^2+x^3\right) \sqrt{1+\sqrt{2+x+x^2+x^3}}} \, dx$$
EDIT: It's a part from the generalization 
$$\int \frac{1+2x +3 x^2+\cdots n x^{n-1}}{\left(2+x+x^2+\cdots+ x^n\right) \sqrt{1\pm\sqrt{2+x+x^2+\cdots +x^n}}} \, dx$$
Supplementary question: How would you calculate the following integral using the generalization above? Would you prefer another way?
$$\int_0^{1/2} \frac{1}{\left(x^2-3 x+2\right)\sqrt{\sqrt{\frac{x-2}{x-1}}+1} } \, dx$$
As a note, the generalization like the one you see above and slightly modified versions can be wisely used for calculating very hard integrals.
 A: HINT: 
As $\dfrac{d(2+x+x^2+x^3)}{dx}=1+2x+3x^2,$
let  $\sqrt{1+\sqrt{2+x+x^2+x^3}}=u\implies 2+x+x^2+x^3=(u^2-1)^2$
and $(1+2x+3x^2)dx=(u^2-1)2u\ du$
Now use Partial Fraction Decomposition, 
$\dfrac1{(u^2-1)^2}=\dfrac A{u-1}+\dfrac B{(u-1)^2}+\dfrac C{u+1}+\dfrac D{(u+1)^2}$
A: Let $$2+x+x^2+x^3=t^2\implies (1+2x+3x^2)dx=2tdt$$ $$\int \frac{2tdt}{t^2\sqrt{1+t}}$$ $$=2\int \frac{dt}{t\sqrt{1+t}}$$
Let $1+t=x^2\implies dt=2xdx$
$$=2\int \frac{2xdx}{(x^2-1)x}$$
$$=4\int \frac{dx}{x^2-1}$$
$$=4\int \frac{dx}{(x-1)(x+1)}$$
$$=4\frac{1}{2}\int \left(\frac{1}{x-1}-\frac{1}{x+1}\right)dx$$
$$=4\frac{1}{2}\left(\int\frac{dx}{x-1}-\int\frac{dx}{x+1}\right)$$
$$=2\left(\ln|x-1|-\ln|x+1|\right)+c$$
$$=2\ln\left|\frac{x-1}{x+1}\right|+c$$
$$=2\ln\left|\frac{\sqrt{1+t}-1}{\sqrt{1+t}+1}\right|+c$$
$$=2\ln\left|\frac{\sqrt{1+\sqrt{1+2+x+x^2+x^3}}-1}{\sqrt{1+\sqrt{1+2+x+x^2+x^3}}+1}\right|+c$$
A: Let $\sinh^4(t)=x^3+x^2+x+2$. Then $\cosh(t)=\sqrt{1+\sqrt{x^3+x^2+x+2}}$ and
$$
\begin{align}
&\int\frac{3x^2+2x+1}{\left(x^3+x^2+x+2\right)\sqrt{1+\sqrt{x^3+x^2+x+2}}} \,\mathrm{d}x\\
&=\int\frac{\mathrm{d}\sinh^4(t)}{\sinh^4(t)\cosh(t)}\\
&=4\int\frac{\mathrm{d}t}{\sinh(t)}\\
&=4\int\frac{\mathrm{d}\cosh(t)}{\cosh^2(t)-1}\\
&=2\int\left(\frac1{\cosh(t)-1}-\frac1{\cosh(t)+1}\right)\mathrm{d}\cosh(t)\\[2pt]
&=2\log\left(\frac{\cosh(t)-1}{\cosh(t)+1}\right)+C\\[6pt]
&=-4\operatorname{arccoth}(\cosh(t))+C\\[6pt]
&=-4\operatorname{arccoth}\left(\sqrt{1+\sqrt{x^3+x^2+x+2}}\right)+C
\end{align}
$$
