What is $\lim_{n\to\infty}2^n\sqrt{2-\sqrt{2+\sqrt{2+\dots+\sqrt{p}}}}$ for $negative$ and other $p$? This was inspired by similar posts like this one. Define the function,
$$F(p) = \lim_{n\to\infty}2^n\sqrt{2-\underbrace{\sqrt{2+\sqrt{2+\dots+\sqrt{p}}}}_{n \textrm{ square roots}}}$$
We know that,
$$F(2) = \frac{\pi}{2},\quad F(3) = \frac{\pi}{3}$$
I was wondering what it evaluates to if we use other integers. Some numerical computation and the Inverse Symbolic Calculator suggests that,
$$\begin{aligned}
F(5) &= 2\ln\big(\tfrac{1+\sqrt{5}}{2}\big)\,i\\
F(6) &= \ln\big(2+\sqrt{3}\big)\,i\\
F(7) &= \ln\big(\tfrac{5+\sqrt{3\times7}}{2}\big)\,i\\
\vdots\\
F(11) &= \ln\big(\tfrac{9+\sqrt{7\times11}}{2}\big)\,i\\
\vdots\\
F(17) &= \ln\big(\tfrac{15+\sqrt{13\times17}}{2}\big)\,i
\end{aligned}$$
Note that the radical arguments are fundamental units. If we use negative $p$,
$$\begin{aligned}
F(-1) &= \pi-2\ln\big(\tfrac{1+\sqrt{5}}{2}\big)\,i\\
F(-2) &= \pi-\ln\big(2+\sqrt{3}\big)\,i\\
F(-3) &= \pi-\ln\big(\tfrac{5+\sqrt{3\times7}}{2}\big)\,i\\
\vdots\\
F(-7) &= \pi-\ln\big(\tfrac{9+\sqrt{7\times11}}{2}\big)\,i\\
\vdots\\
F(-13) &= \pi-\ln\big(\tfrac{15+\sqrt{13\times17}}{2}\big)\,i
\end{aligned}$$
and so on. It seems $F(2+m)+F(2-m) = \pi$. I also observed that if $m\pm2$ are primes, then,
$$F(2+m) = \pi-F(2-m) = \ln\Big(\tfrac{m+\sqrt{(m-2)(m+2)}}{2}\Big)\,i\tag1$$
though the form of $(1)$ is only conjectural. 
Question: What is then the formula for $F(p)$ using general $p$?

The (hyperbolic) cosine bisection formula gives:
$$2\cos\frac{x}{2}=\sqrt{2+2\cos x},\qquad 2\cosh\frac{x}{2}=\sqrt{2+2\cos x}$$
hence assuming $a_0=2\cosh(u_0)=\sqrt{p}$ and $a_{n+1}=\sqrt{2+a_n}$ we have:
$$ a_n = 2 \cosh\left(\frac{u_0}{2^n}\right),\quad \sqrt{2-a_n}= 2\sinh\left(\frac{u_0}{2^{n+1}}\right)$$
so:
$$ \lim_{n\to +\infty} 2^n\sqrt{2-a_n} = u_0 = \text{arccosh}\left(\frac{\sqrt{p}}{2}\right). $$
If $p$ is a positive real number less than $4$ it is enough to replace $\cosh$ with $\cos$ and $\text{arccosh}$ with $\arccos$. If $p$ is negative, we have to be careful in defining what the square root of a complex number is, but the trick is just the same. 
