In this post I proposed a formulation of Mertens function $M(n)$ using the inclusion-exclusion principle, as follows:
$$M(n)=-\pi\left(n\right)+\left(\sum_{p_{i}<\sqrt{n}}\pi\left(\lfloor\frac{n}{p_{i}}\rfloor\right)\right)-\left(\sum_{p_{i}<p_{j}<\sqrt[3]{n}}\pi\left(\lfloor\frac{n}{p_{i}p_{j}}\rfloor\right)\right)+\left(\sum_{p_{i}<p_{j}<p_{k}<\sqrt[4]{n}}\pi\left(\lfloor\frac{n}{p_{i}p_{j}p_{k}}\rfloor\right)\right)-\dots-\left(\frac{\pi\left(\sqrt{n}\right)^{2}+\pi\left(\sqrt{n}\right)}{2}\right)+\sum_{i=3}^{j}\left(\left(-1\right)^{i+1}\left(\frac{\left(\pi\left(\sqrt[i]{n}\right)-\left(i-2\right)\right)\left(\pi\left(\sqrt[i]{n}\right)-\left(i-3\right)\right)\left(2\left(\pi\left(\sqrt[i]{n}\right)-\left(i-2\right)\right)+3\left(i-2\right)+1\right)}{6}\right)\right)$$
Where $j=\max\{i\mid \pi\left(\sqrt[i]{n}\right)>i-2\}$
The advantages of this formulation are that (i) the terms $-\pi\left(n\right)+\left(\sum_{p_{i}<\sqrt{n}}\pi\left(\lfloor\frac{n}{p_{i}}\rfloor\right)\right)-\left(\sum_{p_{i}<p_{j}<\sqrt[3]{n}}\pi\left(\lfloor\frac{n}{p_{i}p_{j}}\rfloor\right)\right)+\left(\sum_{p_{i}<p_{j}<p_{k}<\sqrt[4]{n}}\pi\left(\lfloor\frac{n}{p_{i}p_{j}p_{k}}\rfloor\right)\right)-\dots$ seem pretty similar to Legendre's Formula and (ii) the terms $-\left(\frac{\pi\left(\sqrt{n}\right)^{2}+\pi\left(\sqrt{n}\right)}{2}\right)+\sum_{i=3}^{j}\left(\left(-1\right)^{i+1}\left(\frac{\left(\pi\left(\sqrt[i]{n}\right)-\left(i-2\right)\right)\left(\pi\left(\sqrt[i]{n}\right)-\left(i-3\right)\right)\left(2\left(\pi\left(\sqrt[i]{n}\right)-\left(i-2\right)\right)+3\left(i-2\right)+1\right)}{6}\right)\right)$ seem boundable.
I would like to assess how "similar" are the terms in (i) to Legendre's formula, and if the similarity is enough to bound them sharply; and how "boundable" could be the terms in (ii). Obviously I expect to be difficult finding sharp bounds, as bounding sharply $M(n)$ could prove/disprove the Riemmann Hypothesis; but maybe this approach has not been explored (I doubt it, so any reference in this sense would be welcomed too).
Thanks in advance!
EDIT
As noted by @StevenClark the formula needs to incorporate a $1$ to account for $1$, and the sums in (i) must consider primes less or equal than $\sqrt[i]{n}$; thus, the completed formula would be:
$$M(n)=1-\pi\left(n\right)+\left(\sum_{p_{i}\leq\sqrt{n}}\pi\left(\lfloor\frac{n}{p_{i}}\rfloor\right)\right)-\left(\sum_{p_{i}<p_{j}\leq\sqrt[3]{n}}\pi\left(\lfloor\frac{n}{p_{i}p_{j}}\rfloor\right)\right)+\left(\sum_{p_{i}<p_{j}<p_{k}\leq\sqrt[4]{n}}\pi\left(\lfloor\frac{n}{p_{i}p_{j}p_{k}}\rfloor\right)\right)-\dots-\left(\frac{\pi\left(\sqrt{n}\right)^{2}+\pi\left(\sqrt{n}\right)}{2}\right)+\sum_{i=3}^{j}\left(\left(-1\right)^{i+1}\left(\frac{\left(\pi\left(\sqrt[i]{n}\right)-\left(i-2\right)\right)\left(\pi\left(\sqrt[i]{n}\right)-\left(i-3\right)\right)\left(2\left(\pi\left(\sqrt[i]{n}\right)-\left(i-2\right)\right)+3\left(i-2\right)+1\right)}{6}\right)\right)$$
Where $j=\max\{i\mid \pi\left(\sqrt[i]{n}\right)>i-2\}$
EDIT 2
After analyzing the flaws detected by @StevenClark, I have found a way to fix them, but the formula changes are substantial. Here it goes:
$$M(n)=1-\pi\left(n\right)+\sum_{p_{i}\leq\frac{n}{p_i}}\left(\pi\left(\lfloor\frac{n}{p_{i}}\rfloor\right)-i\right)-\sum_{p_{i}<p_{j}\leq\frac{n}{p_ip_j}}\left(\pi\left(\lfloor\frac{n}{p_{i}p_{j}}\rfloor\right)-j\right)+\sum_{p_{i}<p_{j}<p_{k}\leq\frac{n}{p_ip_jp_k}}\left(\pi\left(\lfloor\frac{n}{p_{i}p_{j}p_{k}}\rfloor\right)-k\right)-\dots$$
Indeed, the formula looks cleaner and even more beautiful.
M\left(n\right)
produces unusual spacing. At least to me, $M(n)$M(n)
looks better. If you regularly need the sizing effect, you can also do $M{\left(n\right)}$M{\left(n\right)}
. $\endgroup$