Radical expression for Cosine formulas Is there nice radical expression for $$\cos\left(\frac{\pi}{2^k+1}\right)?$$
Example: $\cos\left(\dfrac{\pi}{5}\right)=\dfrac{\sqrt{5}+1}{4}$.
Please provide some concrete examples.
Also please provide a general procedure.
I would like to handle $$\cos\left(\frac{a\pi}{2^k+1}\right)$$ as well for $a\in\{0,1,2,\dots,k-1\}$.

Some general solution can be arrived by combining Trigonometry and infinite nested square roots of 2
My answer is very long. Please bear with me. But it is basic
Basic Trigonometric formula
$\cos2\theta = 2\cos^2\theta -1$ ==> $2\cos2\theta =4\cos^2\theta -2$ ==> $4\cos^2\theta = 2 + 2\cos2\theta $
$$2\cos\theta =\sqrt{2+2\cos2\theta} ...... \text Equation 1$$
$\cos2\theta = 1 - 2\sin^2\theta$ ==> $2\cos2\theta =2 - 4\sin^2\theta$ ==> $4\sin^2\theta = 2 - 2\cos2\theta $
$$2\sin\theta =\sqrt{2-2\cos2\theta} ...... \text Equation 2$$
First example
Now solving infinite nested radicals having only 2 having '-'(minus signs) throughout
$\sqrt{2-\sqrt{2-\sqrt{2-...}}}$ as follows
$x = \sqrt{2-x}$
Now substituting $x = 2\cos\theta$
$2\cos\theta = \sqrt{2-2\cos\theta} = 2\sin\frac{\theta}{2}= 2\cos(\frac{\pi}{2}- \frac{\theta}{2})$
Now $\cos\theta = \cos(\frac{\pi}{2}- \frac{\theta}{2})$
$\theta = \frac{\pi}{2}- \frac{\theta}{2}$ ==>$ 2\theta = \pi-\theta ==> 3\theta = \pi$ ==> Therefore $ \theta = \frac{\pi}{3}$ = $\frac{2^0}{2^1+1}\cdot\pi$
Now easy to understand that $2cos\frac{\pi}{3} = 2\cdot\frac{1}{2} =1 $ which is the solution for infinite nested square roots of 2 having all '-'signs
2nd example
$$\sqrt{2-\sqrt{2+\sqrt{2-\sqrt{2+...}}}}$$ ... Repetition of alternate '+' & '-' infinitely
Here $x = \sqrt{2-\sqrt{2+x}}$
Again substitution of $ x = 2\cos\theta$
$2\cos\theta = \sqrt{2-\sqrt2+2\cos\theta}$ ==> $2\cos\theta = \sqrt{2-2\cos\frac{\theta}{2}} $ ==>$ 2\sin\frac{\theta}{4}$ ==> $2\cos(\frac{\pi}{2}- \frac{\theta}{4})$
Now $$\theta = \frac{\pi}{2} - \frac{\theta}{4}$$
Solving this will be $\theta = \frac{2\pi}{5}$ =$\frac{2^1}{2^2+1}\cdot\pi$
3rd example
$\sqrt{2-\sqrt{2+\sqrt{2+\sqrt{2-\sqrt{2+\sqrt{2+...}}}}}}$
as
$x = \sqrt{2-\sqrt{2+\sqrt{2+x}}}$
$2\cos\theta = \sqrt{2-\sqrt{2+\sqrt{2+2\cos\theta}}}$
Solving will be
$= 2\sin\frac{\theta}{8} = 2\cos(\frac{\pi}{2}-\frac{\theta}{8})$
Therefore $\theta + \frac{\theta}{8} = \frac{\pi}{2}$ ==> $\theta = \frac{4}{9}\cdot\pi$ and is $\frac{2^2}{2^3+1}\cdot\pi$ which is 80°
$$2\cos80° = \sqrt{2-\sqrt{2+\sqrt{2+\sqrt{2-\sqrt{2+\sqrt{2+...}}}}}}$$
By generalizing above method, we can get
$$ 2\cos\theta = \sqrt{2-\sqrt{2+\sqrt{2+... \text{k times} +2\cos\theta}}} $$
By simplifying we get
$$ \theta = \frac{\pi}{2} - \frac{\theta}{2^{k+1}}$$
$$ \theta + \frac{\theta}{2^{k+1}} = \frac{\pi}{2}$$

Further simplification will lead to relationship between cyclic infinite nested square roots of 2 and cosine values for angles as

$$ (\sqrt{2-\sqrt{2+\sqrt{2+... \text{k times}}}})...= 2\cos(\frac{2^k}{2^{k+1}+1}\cdot\pi)$$ where $ k\in \mathbb{N}\cup\{0\} $
Addendum : Please remember within brackets is one cycle of nested square roots of 2 which repeats infinitely (LHS) (named as cyclic infinite nested square roots of 2) converging to cosine values(RHS)
As a continuation of above method
$$\lim_{k\to\infty}(\sqrt{2-\sqrt{2+\sqrt{2+... \text{k times}}}})...$$ converges to $\sqrt{2-2} = 0$ as $\sqrt{2+\sqrt{2+\sqrt{2+...}}} = 2$ and proves $2cos\frac{\pi}{2}=0$
Interestingly substitution of $k= -1$ leads to $2\cos(\frac{2^{-1}}{2^0+1})$ = $2\cos\frac{\pi}{4} = \sqrt2$
