# Why is the magnitude of the sum of two adjacent nth roots always an 'interesting' number, and what do these numbers have to do with each other?

While doing something completely unrelated, I discovered an interesting function:

$$f(x)=2\left\vert\cos{\frac{\pi}{x}}\right\vert$$

Which gives the absolute value of the sum of any two adjacent $$x^\text{th}$$-roots of unity for $$x\in\mathbb{R}$$.

This function seemed interesting to me because, for whatever reason, integer (and certain rational) values of $$x$$ seem only to yield 'interesting' numbers.

For instance:

$$f(5/2)=\Phi$$ (golden ratio conjugate) , $$f(4)=\sqrt{2}$$, $$f(5)=\phi$$ (golden ratio),

$$f(7)=\sqrt{\mathcal{S}}$$ (squareroot of the silver constant),

$$f(9/7)=\frac{1}{\mathcal{P}_c(6^3)}$$ ($$\mathcal{P}_c\left(6^3\right)$$ is the bond percolation threshold for a honeycomb lattice),

$$f(9)=\frac{1}{\mathcal{P}_c(3^6)}-1$$ ($$\mathcal{P}_c\left(3^6\right)$$ is the bond percolation threshold for a triangular lattice)

...and so on.

I found out shortly before writing this that these are the square roots of Beraha numbers, but I have no idea what that means or what it has to do with roots of unity, so the question hasn't changed.

Why are these numbers showing up? And what do Beraha numbers, roots of unity, lattices, and algebraic roots have to do with each other?

Note: if $$x$$ is rational, then $$f(x)$$ is algebraic. I can neither confirm nor deny that $$f(x)$$ is algebraic if $$x$$ is algebraic. In any case, transcendental numbers don't show up here. It is also easy to show that the sum of any two $$x^\text{th}$$ roots of unity are algebraic if $$x$$ is rational.

Note: two $$x^\text{th}$$-roots of unity are 'adjacent' if the distance between them is minimal. i.e. $$z_1,z_2=\sqrt[x]{1}$$ are adjacent if there is no $$z_3=\sqrt[x]{1}$$ such that $$d(z_1,z_2)>d(z_1,z_3)$$ or $$d(z_1,z_2)>d(z_2,z_3)$$

If you count the roots of unity by 'stepping' clockwise or counterclockwise around the unit circle, then the magnitude of the sum of two roots of unity separated by $$n$$ steps is given by the function: $$f(x)=2\left\vert\cos{\frac{\pi n}{x}}\right\vert$$

Before all these $$f(x)=\sqrt{4\cos^2\frac{\pi}{x}}=2\left|\cos\frac{\pi}{x}\right|.$$