I would like to prove the following proposition from A. Harper's paper "Sharp conditional upper bound for moments of the Riemann Zeta Function"
Proposition. Let $T$ be large and let $n=p_1^{\alpha_1}\cdots p_r^{\alpha_r}$, where $p_i$ are distinct primes and $\alpha_i\in\mathbb{N}$ for all $i$. Then $$ \int_T^{2T}\prod_{i=1}^r\cos(t\log p_i)^\alpha_i dt = Tf(n)+\mathcal{O}(n)$$ where $f(n)=0$ if any of the exponents $\alpha_i$ is odd, and otherwise $$ f(n)=\prod_{i=1}^r\frac{1}{2^{\alpha_i}}\frac{\alpha_i!}{((\alpha_i/2)!)^2}$$
He says that this is a slight variant of Lemma 4 from Radzwill's paper on Selberg's central limit theorem, noting that the error ter there is estimated quite generously, and can actually be taken a $\mathcal{O}(n)$. The proof goes on as follows: consider primes $q_1,\dots q_k\leq x$ with $q_1\cdots q_k=p_1^{\alpha_1}\cdots p_r^{\alpha_r}=n$. Since $\cos(t)=\frac{e^{it}+e^{-it}}{2}$ we have $$ \cos(t\log p_i)^{\alpha_i}=\frac{1}{2^{\alpha_i}}(e^{it\log p_i}+e^{-it\log p_i})^{\alpha_i}=\frac{1}{2^{\alpha_i}}{\alpha_i\choose \alpha_i/2}+\sum_{\substack{0\leq \ell\leq \alpha_i \\ \ell\neq\alpha_i/2}}\frac{1}{2^{\alpha_i}}{\alpha_i\choose \ell}e^{i(\alpha_i-2\ell)t\log p_i} $$ Hence $$ \int_T^{2T}\prod_{i=1}^r\cos(t\log p_i)^\alpha_i dt = \int_T^{2T}\prod_{i=1}^r\left(\frac{1}{2^{\alpha_i}}{\alpha_i\choose \alpha_i/2}+\sum_{\substack{0\leq \ell\leq \alpha_i \\ \ell\neq\alpha_i/2}}\frac{1}{2^{\alpha_i}}{\alpha_i\choose \ell}e^{i(\alpha_i-2\ell)t\log p_i}\right) $$ which equals to $$ Tf(n)+\sum_{\substack{0\leq \ell_i\leq_{\alpha_i} \\ \text{for all } 1\leq i\leq r\\ \text{not all }\ell_i=\alpha_i/2}}\int_T^{2T}\prod_{i=1}^r\frac{1}{2^{\alpha_i}}{\alpha_i\choose \ell}e^{i(\alpha_i-2\ell)t\log p_i}dt $$ He then says that the number of terms in the sum is $\leq(\alpha_1+1)\cdots(\alpha_r+1)\leq 2^{\alpha_1}\cdots 2^{\alpha_r}=2^k$ where $k=\alpha_1+\cdots\alpha_r$. Moreover each of these terms is of the form $$ \int_T^{2T} \gamma e^{it(\beta_1\log p_1+\cdots \beta_r \log p_r)}dt$$ with $|\gamma|\leq 1$ and integers $|\beta_i|\leq\alpha_i$. He then claims that $\beta_1\log p_1+\cdots \beta_r \log p_r\gg x^{-k}$ and therefore, using that $\int e^{cit}=-\frac{ie^{cit}}{c}+constant$ and that $|\gamma|\leq 1$ we get that $$ \int_T^{2T} \gamma e^{it(\beta_1\log p_1+\cdots \beta_r \log p_r)}dt\ll x^k$$ therefore the sum actually contributes at most $\mathcal{O}(2^kx^k)$. My question is: how do I go from $\mathcal{O}(2^kx^k)$ to $\mathcal{O}(n)$? I guess the bound $(\alpha_1+1)\cdots(\alpha_r+1)\leq 2^{\alpha_1}\cdots 2^{\alpha_r}=2^k$ could be improved. I don't know how to show the bound $$\beta_1\log p_1+\cdots \beta_r \log p_r\gg x^{-k}$$ maybe this can be improved as well. The only other bound used is $|\gamma|\leq 1$ where $\gamma$ is product of factors of the form $\frac{1}{2^{\alpha_i}}{\alpha_i\choose \ell}$. Using Stirling's approximation for the factorial I have $$ \frac{1}{2^{\alpha_i}}{\alpha_i \choose \ell}\leq \frac{1}{2^{\alpha_i}}{\alpha_i \choose \alpha_i/2}\sim\frac{\sqrt{2}}{\sqrt{\pi\alpha_i}} $$ hence this bound is good. Thank you very much for your help!