TITLE: For which values of $a$ is $f$ primitivable?
QUESTION [6 upvotes]: Let $a \in \mathbb{R}$ and $p,q$ be natural numbers with $p \geq q+2.$ For which values of $a$ is the function 
  $$f(x) = 
\begin{cases}
\frac{1}{x}\sin \frac{1}{x^p}\sin \frac{1}{x^q}, &x \neq 0 \\
a, &x=0
\end{cases}
$$
  primitivable?

I noticed that $\frac{1}{x}\sin \frac{1}{x^p}\sin \frac{1}{x^q}$ doesn't have an elementary antiderivative, so I tried to obtain it from the derivative of some function and work this from there. But those powers in the denominator are really getting in the way of any attempt.
I also thought of using the formula $\sin a \sin b = \frac{1}{2}(\cos(a-b)-\cos(a+b))$ and so I split the function like  this:
$$f(x)=
\frac{1}{2}\begin{cases}
\frac{1}{x}\cos(\frac{1}{x^p}-\frac{1}{x^q}), &x \neq 0 \\
a, &x=0
\end{cases} -
\frac{1}{2}\begin{cases}
\frac{1}{x}\cos(\frac{1}{x^p}+\frac{1}{x^q}), &x \neq 0 \\
a, &x=0
\end{cases}
$$
and this definitely looks more promising, but I don't know how to proceed.

REPLY [2 votes]: Take $a=0$. Consider the function
$$
G(x):=x^{p}\cos\frac{1}{x^{p}}\sin\frac{1}{x^{q}}.
$$
Then for $x\neq0$,
\begin{align*}
G^{\prime}(x)  & =px^{p-1}\cos\frac{1}{x^{p}}\sin\frac{1}{x^{q}}-px^{-1}%
\sin\frac{1}{x^{p}}\sin\frac{1}{x^{q}}\\
& -qx^{p-q-1}\cos\frac{1}{x^{p}}\cos\frac{1}{x^{q}}\\
& =:h(x)-pf(x),
\end{align*}
while for $x=0$,
$$
\frac{G(x)-G(0)}{x-0}=x^{p-1}\cos\frac{1}{x^{p}}\sin\frac{1}{x^{q}}%
\rightarrow0
$$
since $p\geq2$. Now the function
$$
h(x)=px^{p-1}\cos\frac{1}{x^{p}}\sin\frac{1}{x^{q}}-qx^{p-q-1}\cos\frac
{1}{x^{p}}\cos\frac{1}{x^{q}}%
$$
is continuous at $x=0$ provided we set $h(0):=0$, since $p-q-1\geq1$ and so
$$
\lim_{x\rightarrow0}h(x)=0.
$$
It follows that $h$ has an antiderivative $H(x):=\int_{0}^{x}h(t)\,dt$. It
follows that$$
-pf(x)=G^{\prime}(x)-H^{\prime}(x)
$$
and so the function given for $x\in\lbrack-1,1]$ by$$
F(x):=-\frac{1}{p}G(x)+\frac{1}{p}H(x)
$$
has derivative $F^{\prime}(x)=-\frac{1}{p}G^{\prime}(x)+\frac{1}{p}H^{\prime
}(x)=f(x)$. 
For $x\geq1$ define
$$
F(x):=F(1)+\int_{1}^{x}f(t)\,dt.
$$
Note that $f$ is integrable in $[1,\infty)$ since $\sin t\sim t$ for
$t\rightarrow0$ and so as $x\rightarrow\infty$
we have $$
\frac{1}{x}\sin\frac{1}{x^{p}}\sin\frac{1}{x^{q}}\sim\frac{1}{x^{1+p+q}}
$$
and $1+p+q\geq3$. Then $F^{\prime}(x)=f(x)$ for all $x\geq1$. 
Similarly, for $x\leq-1$ define
$$
F(x):=F(-1)+\int_{-1}^{x}f(t)\,dt.
$$