Closed form or upper bound (in modulus) for $\int_0^{\pi/2}\frac{\cos(n\theta)}{\log(\theta)-\log(2)}d\theta$ The quantities
$$a_n=\frac 4\pi\int_0^{\pi/2}\frac{\cos(n\theta)}{\log\left(\frac \theta 2\right)}d\theta$$
where $n$ is a non-negative even integer, appeared in a problem I'm thinking about. They're the coefficients in a series which approximates a function, and if I have an upper bound for $|a_n|$ or $\sqrt{a_n^2+a_{n+2}^2+\cdots}$ or $|a_n|+|a_{n+2}|+\cdots$ for $n$ large I can apply a theorem which tells me how good the approximation is.
Dirichlet's conditions for the convergence of Fourier series imply that $a_n\to 0$. The integrand changes sign $n$ times in the integration interval, so the upper bound $\int_0^{\pi/2}\left|\frac{\cos(n\theta)}{\log\left(\frac \theta 2\right)}\right|d\theta$ gets you nothing. I also tried using complex analysis, as $a_n$ is the real part of $\frac 4\pi\int_0^{\pi/2}\frac{e^{in\theta}}{\log\left(\frac \theta 2\right)}d\theta$, but then you have an exponential on the numerator and a logarithm in the denominator, which is really problematic.
 A: By integration by parts
$$ \frac{\pi}{8}a_n = \int_{0}^{\pi/4}\frac{\cos(2n\theta)}{\log\theta}\,d\theta = \left[\frac{\sin(2n\theta)}{2n\log\theta}\right]_{0}^{\pi/4}+\frac{1}{2n}\int_{0}^{\pi/4}\frac{\sin(2n\theta)}{\theta\log^2\theta}\,d\theta$$
equals
$$ \frac{\sin(\pi n/2)}{n \log^2(4/\pi)}+\frac{1-\cos(\pi n/2)}{\pi n^2 \log^2(4/\pi)}+\frac{1}{4n^2}\int_{0}^{\pi/4}\frac{2+\log\theta}{\theta\log^3\theta}\cdot\frac{1-\cos(2n\theta)}{\theta}\,d\theta  $$
where the absolute value of the last integral can be controlled by
$$ \int_{0}^{\frac{1}{2n}}\frac{2+\log\theta}{2\log^3\theta}\,d\theta + C\left|\int_{\frac{1}{2n}}^{\pi/4}\frac{2+\log\theta}{2\theta^2\log^3\theta}\right| = O\left(\frac{1}{n \log^2 n}\right)+O\left(\frac{n}{\log^2 n}\right)$$
so
$$ \frac{\pi}{8} a_n = \frac{\sin(\pi n/2)}{n\log^2(4/\pi)} + O\left(\frac{1}{n \log^2 n}\right). $$
As pointed out in the comments, this proves that $\{a_n\}_{n\geq 1}$ is summable, which is far from trivial (at least to me).
A: Substitute $\theta\mapsto 2\theta$ to find that
$$|a_n|\le \frac{8}{\pi}\left|\int_0^{\pi/4}\frac{e^{i2n\theta}}{\log\theta}d\theta\right|.$$
Now, integrate by parts and you will find that
$$|a_n|\le\frac{C}{n}\left( 1+\int_0^{\pi/4}\frac{d\theta}{\theta\log^2\theta}\right)\le\frac{C'}{n}$$
for some $C, C'>0$ since the integral in the middle converges. Thus, you have that
$$\sum_{n\ge N}|a_n|^2\le c\int_{N}^\infty \frac{dx}{x^2}\le\frac{c}{N}.$$
for some $c>0$ and all integers $N \ge 1$. This implies that the infinite sum $\sum_{n\ge 1} |a_n|^2$ converges and gives you an estimate on its tail.
