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](https://en.wikipedia.org/wiki/Meissel%E2%80%93Lehmer_algorithm)

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](http://mathworld.wolfram.com/MeisselsFormula.html)

The Lehmer formula stops at $P\_3$ (and still uses some $\phi$/Legendre parts)  

[Wolfram - Lehmer](http://mathworld.wolfram.com/LehmersFormula.html)

> 
> 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](https://projecteuclid.org/download/pdf_1/euclid.ijm/1255455259)

Deleglise talks about performances here  

[Prime counting Meissel, Lehmer, ...](https://cr.yp.to/bib/1996/deleglise.pdf)

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.