The number of primes $q$ such that $p_n \lt q \lt (p_{n + 1})^2$ where $p_n$ is the $n$th prime.
Let $d = (p_{n + 1})^2 - p_n$. Then is the above just $$d - \sum_{\text{prime } q \leq p_n} \left\lceil \frac{d}{q} \right\rceil + \sum_{\text{prime } p \lt q \leq p_n} \left\lceil \frac{d}{pq} \right\rceil - \dots ?$$
I'm not sure how I came to the above formula, so I'm asking this, which is less broad than the earlier post.
By sieving, show that $$\sum_{n \le x, \text{lpf}(n) > k} 1 = \sum_{m \in A_k} \mu(m) \lfloor x/m \rfloor$$ where $\text{lpf}$ is the least prime factor and $A_k$ is the set of integers whose largest prime factor is $\le k$.
Then note $$\sum_{n \le x, \text{lpf}(n) > \sqrt{x}} 1 = \pi(x)-\pi(\sqrt{x})$$
The Möbius function is defined by $\mu(m) = (-1)^j$ if $m$ is a product of $j$ different primes, $\mu(m) = 0$ otherwise.