We combine ideas used in approximation theory with classical estimates in analytic number theory to obtain refined asymptotic expansions of Dirichlet, Euler and Mertens’s type. A sample result: For every continuous function \(f: \left[ 0,1\right] \rightarrow \mathbb {R}\) twice differentiable at 1 we have \(\begin{aligned} \sum \limits _{i\le x}d\left( i\right) f\left( \frac{\ln i}{\ln x}\right) =f\left( 1\right) x\ln x+\left[ \left( 2\gamma -1\right) f\left( 1\right) -f^{\prime }\left( 1\right) \right] x \end{aligned}\) \(\begin{aligned} +\frac{\left[ f^{\prime \prime }\left( 1\right) +2\left( 1-\gamma \right) f^{\prime }\left( 1\right) \right] x}{\ln x}+o\left( \frac{x}{\ln x}\right) \end{aligned}\) where d is the divisor function and \(\gamma \) is the Euler constant.