Abstract We establish the optimal order of Malliavin-type remainders in asymptotic density approximation formula for Beurling generalized integers. Given $\alpha \in (0,1]$ and $c>0$ (with $c\leq 1$ if =1$ ), a number system is constructed with Riemann prime counting function $ \Pi (x)= \operatorname {\mathrm {Li}}(x)+ O(x\exp (-c \log ^{\alpha } x ) +\log _{2}x), whose integer satisfies ext...