TITLE: Help me find the flaw in my method for prime counting
QUESTION [5 upvotes]: I've been playing around with my own notation for estimating the number of integers relatively prime to a given primorial and I came up with a result that cannot be right. 
I would appreciate it if someone could help me restate my observations in standard notation and help me understand my mistake.
Here's my notation:
$H_{p_i}(x)$ = the number of integers less than or equal to $x$ that are relatively prime to $p_i\#$
For example: 
$H_3(10) = 3 \left\{ 1,5,7 \right\}$
$H_5(30) = 8 \left\{ 1,7,11,13,17,19,23,29 \right\}$
I use this notation because if I assume $p_0 = 1$ and $H_1(x) = x$, I get:
$H_{p_i}(x) = H_{p_{i-1}}(x) - H_{p_{i-1}}\left(\left\lfloor\dfrac{x}{p_i}\right\rfloor\right)$
I also use this notation:
$p_i\#_{-1} = (p_i -1)(p_{i-1}-1)(p_{i-2}-1)\dots(2-1)$
So that the standard primorial would be:
$p_i\#_{0} = p_i\#$
And the number of pairs of $x,x+2$ that are relatively prime to $p_i\#$ and where $x < p_i\#$ is $p_i\#_{-2}$.
So, I was reasoning about primorials using my notation as I normally do when I struck upon a simple formula for the lower bound for any $H_{p_i}$
Let me start with $H_2(x)$ which is easy to state in terms of an upper and lower bound:
$\dfrac{x}{2} \le H_2(x) \le \dfrac{x+1}{2}$
Now, I would like to come up with a similar expression for $H_3(x)$ which gets overly complicated and unuseful if we approach it in the obvious way.
So, I thought about using two different values: $H_{\text{min}\,3}(x)$ and $H_{\text{max}\,3}(x)$ which I derive in a simple way from $H_2(x)$: 
$H_{3}(x) = H_2(x) - H_2\left(\left\lfloor\dfrac{x}{3}\right\rfloor\right)$
$H_{\text{min}\, 3}(x) = \dfrac{x}{2} - \dfrac{\frac{x}{3}-\left\{\frac{x}{3}\right\}+1}{2}$
$H_{\text{max}\, 3}(x) = \dfrac{x+1}{2} - \dfrac{\frac{x}{3} -\left\{\frac{x}{3}\right\}}{2}$
so that I get the following upper and lower bounds:
$\dfrac{2x-3}{6} \le H_{\text{min}\, 3}(x) \le \dfrac{2x-1}{6}$
$\dfrac{2x+3}{6} \le H_{\text{max}\, 3}(x) \le \dfrac{2x+5}{6}$
where $H_{\text{max}\,3}(x) \ge H_3(x) \ge H_{\text{min}\,3}(x)$
Let:

$H_{\text{min}\, \text{low}\, 3}(x) = \dfrac{2x-3}{6}$
$H_{\text{min}\, \text{high}\, 3}(x) = \dfrac{2x-1}{6}$
$H_{\text{max}\, \text{low}\, 3}(x) = \dfrac{2x+3}{6}$
$H_{\text{max}\, \text{high}\, 3}(x) = \dfrac{2x+5}{6}$

Then, I have the following:
$H_{\text{min}\, p_i}(x) = H_{\text{min}\, \text{low}\, p_{i-1}}(x) - H_{\text{min}\, \text{high}\, p_{i-1}}\left(\left\lfloor\dfrac{x}{p_i}\right\rfloor\right)$
$H_{\text{max}\, p_i}(x) = H_{\text{max}\, \text{high}\, p_{i-1}}(x) - H_{\text{max}\, \text{low}\, p_{i-1}}\left(\left\lfloor\dfrac{x}{p_i}\right\rfloor\right)$
Using induction (see below for my logic), I was able to generalize this to:
$\dfrac{p_i\#_{-1}x - p_i(p_{i-1}\#_{-1})}{p_i\#} \le H_{\text{min}\, p_i}(x) \le \dfrac{p_i\#_{-1}x - p_i\#_{-1}}{p_i\#}$
$\dfrac{p_i\#_{-1}x + p_i(p_{i-1}\#_{-1})}{p_i\#} \le H_{\text{max}\, p_i}(x) \le \dfrac{p_i\#_{-1}x + p_i(p_{i-1}\#_{-1}) + p_i\#_{-1}}{p_i\#}$
Using the results above, I attempt to analyze Legendre's Conjecture:
Let $p_i$ be the largest prime less than or equal to $x$
$\pi(x^2 + 2x) - \pi(x^2) = H_{p_i}(x^2 + 2x) - H_{p_i}(x^2) \ge H_{\text{min}\, p_i}(x^2+2x) - H_{\text{max}\, p_i}(x^2)$
$H_{\text{min}\, p_i}(x^2+2x) - H_{\text{max}\, p_i}(x^2) \ge \dfrac{p_i\#_{-1}(x^2+2x) - p_i(p_{i-1}\#_{-1})}{p_i\#} - \dfrac{p_i\#_{-1}(x^2) + p_i(p_{i-1}\#_{-1}) + p_i\#_{-1}}{p_i\#} =$
$= \dfrac{p_i\#_{-1}(x^2+2x -x^2) - (p_i + p_i + [p_i-1])(p_{i-1}\#_{-1})}{p_i\#} =$
$=  \dfrac{p_i\#_{-1}(2x) - (3p_i-1)(p_{i-1}\#_{-1})}{p_i\#} > \dfrac{(p_i-1)(2x) - (3p_i-1)}{p_i p_{i-1}}$
$\dfrac{(p_i-1)(2x) - (3p_i-1)}{p_i p_{i-1}} > \dfrac{2x-3}{p_i} \ge \dfrac{2x-3}{x} =2  -\dfrac{3}{x}$
which would suggest that Legendre's Conjecture is true for $x \ge 3$
This result is ridiculous given the primitiveness of my method.  Could someone help me to see what I am doing wrong?

Here's my logic behind the induction.
Lemma 1: $\dfrac{p_i\#_{-1}x - p_i(p_{i-1}\#_{-1})}{p_i\#} \le H_{\text{min}\, p_i}(x) \le \dfrac{p_i\#_{-1}x - p_{i-1}\#_{-1}}{p_{i}\#}$
(1)  $H_{2}(x) = x - \left\lfloor\dfrac{x}{2}\right\rfloor = \dfrac{x}{2} + \left\{\dfrac{x}{2}\right\}$
(2)  $H_{3}(x) = H_{2}(x) - H_2(\left\lfloor\dfrac{x}{3}\right\rfloor)$
(3)  $H_{\text{min}\, 3} = \dfrac{x}{2} - \dfrac{\frac{x}{3} -\left\{\frac{x}{3}\right\}+1}{2} = \dfrac{2x-3 + 3\left\{\frac{x}{3}\right\}}{6} $
(4) $\dfrac{2x-3}{6} \le H_{\text{min}\, 3}(x) \le \dfrac{2x-1}{6}$
(5) Assume $\dfrac{p_i\#_{-1}x - p_i(p_{i-1}\#_{-1})}{p_i\#} \le H_{\text{min}\, p_i}(x) \le \dfrac{p_i\#_{-1}x - p_{i-1}\#_{-1}}{p_{i}\#}$
(6) $H_{p_{i+1}}(x) = H_{p_i}(x) - H_{p_i}(\left\lfloor\dfrac{x}{p_{i+1}}\right\rfloor)$
(7) $H_{\text{min}\, p_{i+1}} =\dfrac{p_i\#_{-1}x - p_i(p_{i-1}\#_{-1})}{p_i\#} - \dfrac{p_i\#_{-1}\left\lfloor\frac{x}{p_{i+1}}\right\rfloor - p_{i-1}\#_{-1}}{p_i\#} =$
$= \dfrac{p_{i+1}\#_{-1}x - p_{i+1}(p_i\#_{-1}) + (p_i\#_{-1})(p_{i+1})\left\{\frac{x}{p_{i+1}}\right\}}{p_{i+1}\#}$ 
(8)  So that:
$\dfrac{p_{i+1}\#_{-1}x - p_{i+1}(p_{i}\#_{-1})}{p_{i+1}\#} \le H_{\text{min}\, p_{i+1}}(x) \le \dfrac{p_{i+1}\#_{-1}x - p_{i}\#_{-1}}{p_{i+1}\#}$
Lemma 2: $\dfrac{p_i\#_{-1}x + p_i(p_{i-1}\#_{-1})}{p_i\#} \le H_{\text{max}\, p_i}(x) \le \dfrac{p_i\#_{-1}x + p_i(p_{i-1}\#_{-1}) + p_i\#_{-1}}{p_i\#}$
(1)  $H_{2}(x) = x - \left\lfloor\dfrac{x}{2}\right\rfloor = \dfrac{x}{2} + \left\{\dfrac{x}{2}\right\}$
(2)  $H_{3}(x) = H_{2}(x) - H_2(\left\lfloor\dfrac{x}{3}\right\rfloor)$
(3)  $H_{\text{max}\, 3} = \dfrac{x+1}{2} - \dfrac{\frac{x}{3} -\left\{\frac{x}{3}\right\}}{2} = \dfrac{2x+3 + 3\left\{\frac{x}{3}\right\}}{6} $
(4) $\dfrac{2x+3}{6} \le H_{\text{max}\, 3}(x) \le \dfrac{2x+5}{6}$
(5) Assume $\dfrac{p_i\#_{-1}x + p_i(p_{i-1}\#_{-1})}{p_i\#} \le H_{\text{max}\, p_i}(x) \le \dfrac{p_i\#_{-1}x + p_i(p_{i-1}\#_{-1}) + p_i\#_{-1}}{p_i\#}$
(6) $H_{p_{i+1}}(x) = H_{p_i}(x) - H_{p_i}(\left\lfloor\dfrac{x}{p_{i+1}}\right\rfloor)$
(7) $H_{\text{max}\, p_{i+1}} =\dfrac{p_{i}\#_{-1}x + p_i(p_{i-1}\#_{-1}) + p_i\#_{-1}}{p_i\#} - \dfrac{p_i\#_{-1}\left\lfloor\frac{x}{p_{i+1}}\right\rfloor + p_i(p_{i-1}\#_{-1}) }{p_i\#}=$
$= \dfrac{p_{i+1}\#_{-1}x + p_{i+1}(p_i\#_{-1}) + (p_i\#_{-1})(p_{i+1})\left\{\frac{x}{p_{i+1}}\right\}}{p_{i+1}\#}$ 
(8)  So that:
$\dfrac{p_{i+1}\#_{-1}x + p_{i+1}(p_{i}\#_{-1})}{p_{i+1}\#} \le H_{\text{max}\, p_{i+1}}(x) \le \dfrac{p_{i+1}\#_{-1}x + p_{i+1}(p_{i}\#_{-1}) + p_{i+1}\#_{-1}}{p_{i+1}\#}$

Edit:  Additional examples
$H_5(20) = H_3(20) - H_3(\left\lfloor\dfrac{20}{5}\right\rfloor) = [H_2(20) - H_2(\left\lfloor\dfrac{20}{3}\right\rfloor)] -[H_2(4) - H_2(\left\lfloor\dfrac{4}{3}\right\rfloor)] =$
$= [H_1(20) - H_1(\left\lfloor\dfrac{20}{2}\right\rfloor)] - [H_1(6) - H_1(\left\lfloor\dfrac{6}{2}\right\rfloor)] - [H_1(4) - H_1(\left\lfloor\dfrac{4}{2}\right\rfloor)] + [H_1(1) - H_1(\left\lfloor\dfrac{1}{2}\right\rfloor) =$
$= [20 - 10]  - [6-3] - [4-2] +[1-0] = 6 \{1, 7, 11, 13, 17, 19\}$

Edit: Added clarification on $3p_i - 1$ based on comment.

REPLY [2 votes]: You have shown
$$
H_{\min\operatorname{low} p_i} \le H_{p_i} \le H_{\max\operatorname{high}p_i}
$$
for all $x$, from which you try to show
$$
\begin{align}
H_{p_{i+1}}(x) & = H_{p_i}(x)-H_{p_i}(\lfloor x/p_{i+1}\rfloor) \\
&\ge H_{\min\operatorname{low} p_i}(x)-H_{\min\operatorname{high} p_i}(\lfloor x/p_{i+1}\rfloor) \\
\end{align}
$$
but unfortunately the best you can say is in fact
$$
H_{p_{i+1}}(x) \ge H_{\min\operatorname{low} p_i}(x)-H_{\max\operatorname{high} p_i}(\lfloor x/p_{i+1}\rfloor)
$$
and similarly for the upper bound.
Your bounds for $H_\min, H_\max$ fail pretty quickly:
$$
\frac{5\#_{-1}\cdot 28 - 5(3\#_{-1})}{5\#} = \frac{107}{15} > 7 = H_5(28) \\
\frac{5\#_{-1}\cdot 23 + 5(3\#_{-1}) + 5\#_{-1}}{5\#} = \frac{101}{15}<7 = H_5(23)
$$