# On the number of primes between prime $p_n$ and $p_{n}^2$

does anyone knows if there are studies on the number of primes between prime $$p_n$$ and $$p_{n}^2$$, where $$p_n$$ is the $$n$$-th prime?

I am studying it through the following formula:

\begin{align} \pi(p^2_n)-\pi(p_n) \simeq (p_{n}^2-1) \prod_{i=1}^{n} \frac{(p_i-1)}{p_i}, \end{align}

where $$p_n$$ is the $$n$$-th prime number, $$p_i$$ the $$i$$-th primer number as well, and $$\pi(n)$$, for positive integer $$n$$, is the prime counting function.

I have seen a related question here:

The values of $n$ which satisfy an inequality about prime numbers

EDIT:

Since there are questions about the interest of this, let me explain why it is interesting for me:

All the integers up to $$p_n^2$$ have only prime factors in $$\{2,3,\ldots,p_n\}$$. So if we exclude the even numbers (i.e. $$1/2$$), then the multiples of $$3$$ (i.e. $$2/3$$), then the multiples of $$5$$ (i.e. $$4/5$$) and so on ... up to $$p_n$$ we should obtain exactly the prime numbers in the interval $$(p_n,p_n^2)$$. However it seems not to be as easy as it appears.

• The formula you wrote down does not make sense. What are $N$ and $n$ on the right hand side? Jul 14, 2023 at 9:59
• Ups, yes, sorry my fault. Jul 14, 2023 at 10:06
• I find it hard to really grasp the interest of this question.
– YCor
Jul 14, 2023 at 13:37
• I find it interesting since the integers in the interval $p_i$ up to $p_n$ are not divisible by any prime in this interval, so we know all its factors and I find quite intriguing why we can't then count them exactly. Jul 20, 2023 at 15:54

There is nothing special about the difference $$\pi(p_n^2) - \pi(p_n)$$; we can take the input to be any large positive number. That is, it makes sense to consider

$$\displaystyle \pi(x^2) - \pi(x), x \gg 1.$$

By the prime number theorem we have

$$\displaystyle \pi(y) \sim \frac{y}{\log y},$$

and if we use the logarithmic integral we have the more precise form

$$\displaystyle \pi(y) = \int_2^y \frac{dt}{\log t} + O \left(y \exp \left( - A (\log y)^{\frac{3}{5}} \right) \right)$$

for some $$A > 0$$. Therefore, we see that

$$\displaystyle \pi(x^2) \sim \pi(x^2) - \pi(x)$$

for all $$x$$ sufficiently large. Assuming the Riemann hypothesis, one can expect that the fluctuations of

$$\displaystyle \pi(x^2) = \int_2^{x^2} \frac{dt}{\log t} + O_\varepsilon \left(x^{1 + \varepsilon} \right)$$

will overwhelm the main term of $$\pi(x) \sim x (\log x)^{-1}$$.

• Thanks @stanley, perhaps I missed the context. I find it interesting since the integers in the interval $p_i$ up to $p_n$ are not divisible by any prime in this interval, so we know all its divisors and I find quite intriguing why we can't then count them exactly. Jul 20, 2023 at 15:56
• We can readily count them exactly! If you want you can even turn that into a 'closed form' using inclusion-exclusion, in the usual way of such things. But that formula isn't particularly useful. It sounds like what you're expecting is a 'constant length' formula ($O(1)$ or at worst $O(\log^k n)$ to evaluate, for some small $k$) for $\pi(p_n^2)-\pi(p_n)$ and the simple observations about size of divisors just turn out to not be much help with that. Jul 30, 2023 at 2:25