Prime counting. Meissel, Lehmer: is there a general formula? I am looking for a general forumla to count prime numbers on which the Meissel and Lehmer formula are based:
$$\pi(x)=\phi(x,a)+a-1-\sum\limits_{k=2}^{\lfloor log_{p_{(a+1)}}(x) \rfloor}{P_k(x,a)}$$
Wiki - prime counting - Meissel Lehmer
More precisely, I am looking for the detailed description of the $P_k$ for $k>3$.   
$P_k(x,a)$ counts the numbers$\leqslant x$ with exactly $k$ prime factors all greater than $p_a$ ($a^{th}$ prime), but in the full general formula, this last condition is not necessary.  
The Meissel formula stops at $P_2$ (and still uses some $\phi$/Legendre parts)
Wolfram - Meissel
The Lehmer formula stops at $P_3$ (and still uses some $\phi$/Legendre parts)
Wolfram - Lehmer

I don't find anything about the general formula (using all the $P_k$ terms).
  Is there any paper on it?
  Why stop at $P_3$? is it a performance issue?  

Lehmer vaguely talk about it in his 1959 paper
On the exact number of primes less than a given limit
Deleglise talks about performances here
Prime counting Meissel, Lehmer, ...
Thanks
Edit: by "a general formula on which the Meissel and Lehmer formula are based", I meant the one they tend to (with all $P_k$), not the one they started from (Legendre, with no $P_k$). Sorry if it was not clear.
 A: The answer to the question 'why stop at $P_3$?' is simply: because the choice $p_a^4>x$ implies $P_k=0$ for $k\geq 4$. So the papers that only include $P_2$ and $P_3$ in fact do start from the full formula with all $P_k$'s, it's just that the rest is assured to be identically zero by a judicious choice of $p_a$.
The performance gain if one takes a smaller $p_a$ so that higher $P_k$'s are nonzero is small (a factor $1/\log x$ when going from $p_a\gtrsim x^{1/3}$ to $p_a\gtrsim x^{1/4}$), at the expense of a greater complexity of the calculation. Since now polynomially faster algorithms are available (Lagarias, Miller & Odlyzko's algorithm is a factor $1/x^{1/3}$ faster than Meissel-Lehmer) there does not seem to be a motivation to speed up Meissel-Lehmer logarithmically by reducing $p_a$ below $x^{1/4}$.
A: Here it is:
$$\pi(x)=\phi(x,a)+a-1-\sum\limits_{k=2}^{\lfloor log_{p_{(a+1)}}(x) \rfloor}\underbrace{{\Bigg\{ \sum\limits_{n_2=a+1}^{\pi(\sqrt[k]{x})} \sum\limits_{n_3=n_2}^{\pi\big(\sqrt[k-1]{\frac{x}{p_{n_2}}}\big)} \sum\limits_{n_4=n_3}^{\pi\Big(\sqrt[k-2]{\frac{x}{p_{n_2}\cdot p_{n_3}}}\Big)} ... \sum\limits_{n_k=n_{k-1}}^{\pi\Bigg(\sqrt[2]{\frac{x}{\prod\limits_{i=2}^{k-1}{p_{n_i}}}}\Bigg)} {\Bigg[\pi(\frac{x}{\prod\limits_{i=2}^{k}{p_{n_i}}})-\pi(p_{n_{k}})+1\Bigg]}   \Bigg\}}}_{P_k(x,a)}$$
$a$ can be set to $\pi(\sqrt[{\lceil log_2(x) \rceil}]{x})=0$, so $\phi(x,a)+a-1$ become $x-1$ but as said above, $a$ can be set to any value up to $\pi(\sqrt[2]{x})$ (kindof cursor to distribute the "work" between $\phi$ and $P_k$)
(Note: $n_1=a+1$)
$\phi(x,a)+a-1$ can also be replaced by a more efficient recursive function which looks a lot like the right part (involving $\lfloor \frac{x}{\prod{p_{n_i}}} \rfloor -p_{n_k}+1$)
