I'm trying to generalize the Theorem 2.7.1 in [1] where they prove:
$$\sum_{p \leq x} f(p) = \int_{2}^{x} \frac{f(t)}{\log{t}} dt + \epsilon(x)f(x) - \int_{2}^{x} \epsilon(t) f^{'}(t) dt $$
where $\epsilon(x) = o\left( \frac{t}{\log{t}} \right)$. I would like to find a proper approximation for :
$$ \sum_{a < p \leq x} f(p) $$
with $a \geq 2$. So rewriting the sum as a Stieltjes integral, using $\pi(x) = li(x) + \epsilon(x)$ and using integration by parts I get up to:
$$ \int_{a}^{x} \frac{f(t)}{\log{t}} dt + \epsilon(x) f(x) - \epsilon(a) f(a) - \int_{a}^{x} \epsilon(t) f^{'}(t) dt $$
Is this correct? is it possible to simplify the above integral even more?
[1] Bach, Eric; Shallit, Jeffrey, Algorithmic number theory, Vol. 1: Efficient algorithms, MIT Press Series in the Foundations of Computing. Cambridge, MA: The MIT Press. xvi, 512 p. (1996). ZBL0873.11070.