I'm having trouble getting the desired error term, but I'm close to solving the problem. Maybe you could polish my method to get what you want...
First sum: Here's where you need to improve the error term.
Second sum: since (which is equivalent to the prime number theorem!).
Third sum: since .
Enumerating we get . Where is the error term that you need to improve upon.
Dear
Chiph, sorry for the delay in writing. I hope you are aware of the Eulers summation formula which says:
If has a continuous derivative on the interval then
Please apply in the Eulers Summation formula to get the desired result.
All of these can be found in Tom Apostol's Analytic Number Theory book.
Just to point out a combinatorial interpretation of the sum
It's equal to the cardinal of (1)
The explanation is simple:
Fix , let be (for each prime ).
Now (1) is the set of pairs of integers in , such that they - the pairs- do not belong to the union .
Note that -since we are working with primes- which cardinal is
The rest is inclusion-exclusion. Evidently you can substitute that for any