Let $n$ be a fixed positive integer such that $\sin(\frac\pi{2n})+\cos(\frac\pi{2n})=\frac{\sqrt n}2$ then find $n$. 
Let $n$ be a fixed positive integer such that $\sin(\frac\pi{2n})+\cos(\frac\pi{2n})=\frac{\sqrt n}2$ then find $n$.

This question already exists here, but the answer mentioned there is incorrect. That post says the answer is $4\lt n\lt 8$. But the answer is only $n=6$.
How to show this mathematically, without calculator?
My Attempt:
The given equation is $$\sin(\frac\pi4+\frac\pi{2n})=\frac{\sqrt n}{2\sqrt2}$$
Also, $$\frac\pi4\lt\frac\pi4+\frac\pi{2n}\le\frac\pi4+\frac\pi2\\\implies \frac1{\sqrt2}\le\sin(\frac\pi4+\frac\pi{2n})\le1\implies\frac1{\sqrt2}\le\frac{\sqrt n}{2\sqrt2}\le1\\\implies2\le\ n\le2\sqrt2\\\implies4\le n\le8$$
 A: Squaring we get:
$\sin^2(\frac\pi{2n})+\cos^2(\frac\pi{2n}) + 2\sin(\frac\pi{2n})\cos(\frac\pi{2n})  =\frac{n}{4}$
$\implies \sin(\frac{\pi}{n}) = \frac{n}{4} - 1$
$\implies 4 < n < 8$
We can easily check that $n = 5$ and $n=7$ are not solutions. Hence $n=6$
A: I try to solve a more general equation $$
\sin \left(\frac{\pi}{2 x}\right)+\cos \left(\frac{\pi}{2 x}\right)=\frac{\sqrt{x}}{2} \textrm{ for }x\geq 1\tag{*}  $$
Squaring both sides yields $$
\begin{gathered}
\sin ^2\left(\frac{\pi}{2 x}\right)+\cos^2\left(\frac{\pi}{2 x}\right)+2 \sin \left(\frac{\pi}{2 x}\right) \cos \left(\frac{\pi}{2 x}\right)=\frac{x}{4} \\
0<\sin \left(\frac{\pi}{x}\right)=\frac{x}{4}-1 <1\Rightarrow 4\leq x\le 8\cdots (**).
\end{gathered}
$$
Let’s consider the function $f(x)=\sin \left(\frac{\pi}{x}\right)-\frac{x}{4}+1, \textrm{ where }x\in[4,8].$
Since both $\sin \left(\frac{\pi}{x}\right)$ and $-\frac{x}{4}$  are strictly decreasing on $[4, 8]$ implies that $f(x)$ is strictly decreasing on $[4,8]$. Noticing that $f(\frac{\pi}{6})=\sin\left(\frac{\pi}{6}\right) -\frac{6}{4}+1=0$ from $(**)$$\Rightarrow  f(x)\ne 0 $ for any $6\ne x\in [4,8],$ we can conclude that $x=6$ is the unique solution to the given equation $(*). $
$$
$$
