Simplify $\left({\sum_{k=1}^{2499}\sqrt{10+{\sqrt{50+\sqrt{k}}}}}\right)\left({\sum_{k=1}^{2499}\sqrt{10-{\sqrt{50+\sqrt{k}}}}}\right)^{-1}$

Simplify $$\frac{\displaystyle\sum_{k=1}^{2499}\sqrt{10+{\sqrt{50+\sqrt{k}}}}}{\displaystyle\sum_{k=1}^{2499}\sqrt{10-{\sqrt{50+\sqrt{k}}}}}$$

I don't have any good idea. I need your help.


Here is my answer. I've just got the following result:$$\frac{\sum_{k=1}^{2499}\sqrt{10+{\sqrt{50+\sqrt k}}}}{\sum_{k=1}^{2499}\sqrt{10-{\sqrt{50+\sqrt k}}}}=1+\sqrt2+\sqrt{4+2\sqrt2}=\cot\frac{\pi}{16}.$$

Proof: Suppose that $\sum$ represents $\sum_{k=1}^{2499}$. Let the numerator and the denominator be $A$ and $B$ respectively. Letting $a_k=\sqrt{10+\sqrt{50+\sqrt k}}, b_k=\sqrt{10-\sqrt{50+\sqrt k}}$, we can represent $A, B$ as $A=\sum a_k, B=\sum b_k.$ Letting $p_k=\sqrt{50+\sqrt k}$ and $q_k=\sqrt{50-\sqrt k}$, since ${p_k}^2+{q_k}^2=10^2$ and $p_k\gt0, q_k\gt0$, there exists a real number $0\lt x_k\lt \frac{\pi}{2}$ such that $p_k=10\cos x_k, q_k=10\sin x_k$. Then, we get $$a_k=\sqrt{10+10\cos x_k}=\sqrt{10+10\left(2{\cos^2{\frac{x_k}{2}}}-1\right)}=\sqrt{20}\cos \frac{x_k}{2},$$$$b_k=\sqrt{10-10\cos x_k}=\sqrt{10-10\left(1-2{\sin^2{\frac{x_k}{2}}}\right)}=\sqrt{20}\sin \frac{x_k}{2}.$$ Then, since $\sum a_k=\sum a_{2500-k}$, let's consider $a_{2500-k}$. $$\begin{align}a_{2500-k}&=\sqrt{10+\sqrt{50+\sqrt{(50+\sqrt k)(50-\sqrt k)}}}\\&=\sqrt{10+\sqrt{50+{p_kq_k}}}\\&=\sqrt{10+\sqrt{50+100\cos {x_k}\sin {x_k}}}\\&=\sqrt{10+\sqrt{50(\cos {x_k}+\sin {x_k})^2}}\\&=\sqrt{10+\sqrt{50}\cdot\sqrt2\sin \left(x_k+\frac{\pi}{4}\right)}\\&=\sqrt{10+10\cdot2\cos \left(\frac{x_k}{2}+\frac{\pi}{8}\right)\sin \left(\frac{x_k}{2}+\frac{\pi}{8}\right)}\\&=\sqrt{10\left(\cos \left(\frac{x_k}{2}+\frac{\pi}{8}\right)+\sin \left(\frac{x_k}{2}+\frac{\pi}{8}\right)\right)^2}\\&=\sqrt{10}\left(\cos \left(\frac{x_k}{2}+\frac{\pi}{8}\right)+\sin \left(\frac{x_k}{2}+\frac{\pi}{8}\right)\right)\\&=\frac{\left(\cos \left(\frac{\pi}{8}\right)+\sin \left(\frac{\pi}{8}\right)\right)a_k+\left(\cos \left(\frac{\pi}{8}\right)-\sin \left(\frac{\pi}{8}\right)\right)b_k}{\sqrt2}\\&=\sqrt{\frac{\sqrt2+1}{2\sqrt2}}a_k+\sqrt{\frac{\sqrt2-1}{2\sqrt2}}b_k.\end{align}$$ Hence, $$A=\sqrt{\frac{\sqrt2+1}{2\sqrt2}}A+\sqrt{\frac{\sqrt2-1}{2\sqrt2}}B.$$ So, the proof is completed with $$\frac AB=1+\sqrt2+\sqrt{4+2\sqrt2}. $$

After a while, I got the following theorem in the same way as above.

Theorem: For any natural number $n$, $$\frac{\sum_{k=1}^{n^2+2n}\sqrt{\sqrt{2n+2}+{\sqrt{n+1+\sqrt k}}}}{\sum_{k=1}^{n^2+2n}\sqrt{\sqrt{2n+2}-{\sqrt{n+1+\sqrt k}}}}=1+\sqrt2+\sqrt{4+2\sqrt2}=\cot {\frac{\pi}{16}}.$$

Note that the case $n=49$ in this theorem is the question at the top.

P.S. I think it's worth adding a link where user mercio provided a background why the theorem holds for any $n$. (it's a background, not a proof. The theorem has already been proved.)