(Not) Surprising Result on Natural Numbers as Sum of $k$-Almost Primes I started with the following idea:


*

*Let $P_k$ be the infinte set of all $k$-almost primes.

*The counting function for $k$-almost primes less than $x$, is 
$\displaystyle \pi_k(x)\sim\frac{x}{\log x}\frac{(\log \log x)^{k-1}}{(k-1)!}$, where the error goes like $\displaystyle O\left(\frac{x(\log \log x)^{k-2}}{\log x} \right)$. See answer to this MO question.

*The union of all $P_k$ is $\mathbb{N}$ (except $1$), so the counting functions sum up to $\displaystyle \sum_k \pi_k (x)=x$.


I wanted to look at the error term and see how large the discrepancy, between the sum of primes counting functions and natural number couting function (haha!) is. But to my surprise I found the following:
With the series expansion of $\displaystyle e^t=\sum_{m=0}^\infty \frac{t^m}{m!}$, where $t=\log \log x$, we get:
$$
\log x = e^{\log \log x}=\sum_{m=1}^\infty\frac{(\log \log x)^{m-1}}{(m-1)!}.
$$
Here I used a Taylor series with derivatives w.r.t. to $\log \log x$. We use $\displaystyle \frac{d^me^{\log \log x}}{d(\log \log x)^m}=1$ .
Now summing up all $\pi_k(x)$, we have 
$$
x=\sum_k \pi_k(x) \sim \frac{x}{\log x} \sum_{k=1}^\infty\frac{(\log \log x)^{k-1}}{(k-1)!} 
=x.
$$
Ok, it's correct, but why? Do the error terms all cancel or is this just a artifact of the bad approximation of the counting function $\pi_k(x)$?
 A: Looking through Ramanjuan's Collected Papers in the 32d paper (p. 242 in my ed.) I notice he has the following: 
$$(1)\hspace{7mm}\pi_k(x)\sim \frac{x}{\ln x} \frac{(\ln \ln x)^{k-1}}{(k-1)!}$$
$$(2)\hspace{5mm}[x] = \{\pi_1(x) + \pi_2(x)+\pi_3(x)...\}$$ 
and 
$$(3)\hspace{5mm}x = \frac{x}{\ln x}\{1 + \ln\ln x + \frac{(\ln\ln x)^2}{2!}+...\}$$
He mentions that Landau proved (1) and says (2)and (3) are "obvious." He does say there is a "far from exact" correspondence between (2) and (3). Ramanujan does not suggest that (3) is other than asymptotically exact (nor do Eric's comments).  
Sasha gives a very nice proof for numbers of the form $2^n$ here. My question was I think essentially the same as this one and motivated by the same question. Does this mean the PNT errors cancel? 
I think expanding $e^y$ in a power series with $y = \ln\ln x$ gives (3).
So I think that, yes, the sum of the errors for the PNT must be zero for given x. Also I doubt there is much to be made of it.
(The proof of (1) in Landau is at p. 203 and following--Landau is not indexed.)
