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$?