Solution (source code)

= Solution

Write $L=\log D$. By the <Prime number theorem> and <partial summation>, the sum is at most a constant times
$$
\int_2^z
\frac1{t(\log t)^4}
\exp\left(-\frac{L}{2\log t}\right)dt.
$$
Make the substitution $v=L/\log t$. Since $dt/t=-L v^{-2}dv$, this becomes
$$
\frac1{L^3}
\int_{L/\log z}^{L/\log2}v^2e^{-v/2}\,dv
\leq
\frac1{L^3}
\int_{L/\log z}^{\infty}v^2e^{-v/2}\,dv.
$$
For $u>0$, the final integral is $O(e^{-cu})$ after decreasing the absolute constant $c>0$; any polynomial factor in $u$ is absorbed by the exponential, and bounded $u$ causes no problem. Taking $u=L/\log z$ proves
$$
\sum_{p\leq z}\frac1{p(\log p)^3}
\exp\left(-\frac12\frac{\log D}{\log p}\right)
\ll\frac1{(\log D)^3}
\exp\left(-c\frac{\log D}{\log z}\right),
$$
the <exponentially damped reciprocal-prime sum> estimate.