For a positive integer $n$ and a real number $a$, consider the function $$f_n(a) = \int_0^{\pi} (\cos x + a\sin 2nx)^2\, dx$$ (1) When we transform $f_n(a)$ into $$f_n(a) = \int_0^{\pi} \left\{\frac{1 + \cos \mathbf{L}\, x}{2} + a^2 \frac{1 - \cos \mathbf{M}\, nx}{2} + a(\sin(2n+1)x + \sin(2n-1)x)\right\} dx$$ and calculate the definite integral on the right side, we obtain $$f_n(a) = \frac{\pi}{\mathbf{N}}\, a^2 + \frac{\mathbf{O}\, n}{\mathbf{P}\, n^2 - \mathbf{Q}}\, a + \frac{\pi}{\mathbf{R}}.$$ (2) Let $a_n$ denote the value of $a$ at which $f_n(a)$ is minimalized, and set $S_N = \sum_{n=1}^{N} \frac{a_n}{n}$. Then $$\begin{aligned}
S_N &= -\frac{\mathbf{S}}{\pi} \sum_{n=1}^{N} \left(\frac{1}{2n - \mathbf{T}} - \frac{1}{2n + \mathbf{U}}\right) \\
&= -\frac{\mathbf{S}}{\pi} \left(\mathbf{V} - \frac{1}{\mathbf{W}N + \mathbf{U}}\right)
\end{aligned}$$ Hence we obtain $$\sum_{n=1}^{\infty} \frac{a_n}{n} = \lim_{N \to \infty} S_N = -\frac{\mathbf{Y}}{\pi}.$$
For a positive integer $n$ and a real number $a$, consider the function
$$f_n(a) = \int_0^{\pi} (\cos x + a\sin 2nx)^2\, dx$$
(1) When we transform $f_n(a)$ into
$$f_n(a) = \int_0^{\pi} \left\{\frac{1 + \cos \mathbf{L}\, x}{2} + a^2 \frac{1 - \cos \mathbf{M}\, nx}{2} + a(\sin(2n+1)x + \sin(2n-1)x)\right\} dx$$
and calculate the definite integral on the right side, we obtain
$$f_n(a) = \frac{\pi}{\mathbf{N}}\, a^2 + \frac{\mathbf{O}\, n}{\mathbf{P}\, n^2 - \mathbf{Q}}\, a + \frac{\pi}{\mathbf{R}}.$$
(2) Let $a_n$ denote the value of $a$ at which $f_n(a)$ is minimalized, and set $S_N = \sum_{n=1}^{N} \frac{a_n}{n}$.
Then
$$\begin{aligned}
S_N &= -\frac{\mathbf{S}}{\pi} \sum_{n=1}^{N} \left(\frac{1}{2n - \mathbf{T}} - \frac{1}{2n + \mathbf{U}}\right) \\
&= -\frac{\mathbf{S}}{\pi} \left(\mathbf{V} - \frac{1}{\mathbf{W}N + \mathbf{U}}\right)
\end{aligned}$$
Hence we obtain
$$\sum_{n=1}^{\infty} \frac{a_n}{n} = \lim_{N \to \infty} S_N = -\frac{\mathbf{Y}}{\pi}.$$