How to find integral $\underbrace{\int\sqrt{2+\sqrt{2+\sqrt{2+\cdots+\sqrt{2+x}}}}}_{n}dx,x>-2$ Find the integral
$$\int\underbrace{\sqrt{2+\sqrt{2+\sqrt{2+\cdots+\sqrt{2+x}}}}}_{n}dx,x>-2$$
where $n$ define  the number of  the square 
I know  this  if 
$0 \le x\le 2$, then let $$x=2\cos{t},0\le t\le\dfrac{\pi}{2}$$
so
$$\sqrt{2+x}=\sqrt{2+2\cos{t}}=2\cos{\dfrac{t}{2}}$$
so
$$\sqrt{2+\sqrt{2+x}}=2\cos{\dfrac{t}{2^2}}$$
so
$$\int\sqrt{2+\sqrt{2+\sqrt{2+\cdots+\sqrt{2+x}}}}dx=\int2\cos{\dfrac{t}{2^n}}(-2\sin{t})dt$$
and for $x\ge 2$ case, I  let
$x=\cosh{t}$, but for  $-2\le x\le 0$ case, I can't do it.

For the finitely many nested radical case,
$$-4\int \cos\left(\frac{t}{2^n}\right)\sin t\,dt=-2\int \left(\sin(2^{-n}t+t)-\sin(2^{-n}t-t)\right)\,dt$$
$$=-2\left(-\frac{\cos(t(2^{-n}+1))}{2^{-n}+1}+\frac{\cos(t(2^{-n}-1))}{2^{-n}-1}\right)+C$$
Substitute $t=\arccos(x/2)$ to obtain the answer.
The substitution is valid for $-2\le x\le 2$. 
I hope this addresses the issue.
