TITLE: Integral of products of cosines
QUESTION [7 upvotes]: Given $m+1$ integers $\alpha_0,\ldots,\alpha_m\geq 1$, I was trying to get a nice closed formula for the integral
$$
\int_0^\pi\cos(\alpha_1\theta)\cdots\cos(\alpha_m\theta)d\theta.
$$
More precisely, I was trying to count the number of $m$-uplets $(\alpha_1\ldots,\alpha_m)$ with $1\leq \alpha_1\leq\ldots\leq\alpha_m\leq n$ such that the later integral is non-zero. 
When $m=1$, this is easy because of the orthogonality relation
$$
\frac{2}{\pi}\int_0^\pi\cos(\alpha_0\theta)\cos(\alpha_1\theta)d\theta=\;\boldsymbol 1_{\alpha_0=\alpha_1},
$$ 
and thus the number of such solutions is $\boldsymbol 1_{\alpha_0\leq n}$, that is the number of ways to partition $\alpha_0$ into one positive integer smaller than $n$.
If one looks instead at the integral
$$
\frac{1}{2\pi}\int_0^{2\pi}e^{i\alpha_0\theta}e^{-i\alpha_1\theta}\cdots e^{-i\alpha_m\theta} d\theta
$$
then the number of solutions is the number of ways to partition $\alpha_0$ into $m$ integers smaller than $n$. I was somehow hopping that a similar type of solution would appear for the cosine integral, but maybe that is too optimistic ... 
Any idea for the general case with the cosines ? Or a reference ? I have tried to use inductively the trigonometric formula $cos(a)cos(b)=\frac{1}{2}(cos(a+b)+\cos(a-b))$, but I don't see any structure appearing.

REPLY [3 votes]: The question if this integral is zero, is one of the classical $NP$-complete Problems given in the book of Garey and Johnson, Computers and Intractability, 1979. p. 252. There called AN14 and with the upper limit of the integral $2\pi$ instead of $\pi$.