This question already has an answer here:

Although the question might look trivial at first because there are infinitely many prime numbers and for example the ratio of two near prime numbers tends to $1$ at infinity, there is still a point that is missing.

If we define the set $S=\{\, \frac{p_{i}}{p_{j}}\mid i,j\in\Bbb N\,\}$ where $p_i$ is prime number $i$, is it dense in the set of non-negative reals?

If it is, as much as it looks (prevalently) obvious, I am not sure about which precise property is ensuring this, as neither the infinitude of primes nor the limit of ratio of two successive primes reaching $1$ (which is a theorem on its own) looks sufficient individually.

I could imagine something like: the rational set has this property and we can replace each rational number with a ratio of two primes to any desired precision. But, can we?

Maybe I am missing something, but it is not obvious whichever way I look at it.

Theorem that is expected is like:

If $\frac{r_{1}}{s_{1}}>\frac{r_{2}}{s_{2}} > 0$ then there are always two prime numbers $p_{m}$ and $p_{n}$ so that $\frac{r_{1}}{s_{1}}>\frac{p_{m}}{p_{n}}>\frac{r_{2}}{s_{2}}$

if that is to work.


marked as duplicate by Watson, user91500, José Carlos Santos, Claude Leibovici, Marc van Leeuwen Aug 8 '17 at 11:23

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 5
    $\begingroup$ @RabMakh $\mathbb Q$ is dense in $\mathbb R$ $\endgroup$ – Mark Bennet Aug 7 '17 at 21:34
  • 1
    $\begingroup$ You need to allow primes to be negative for this. $\endgroup$ – Mark Bennet Aug 7 '17 at 21:49
  • 1
    $\begingroup$ @JuliánAguirre Wow, that is a very non-obvious question to contain the answer to this one :). $\endgroup$ – Erick Wong Aug 8 '17 at 0:13
  • 5
    $\begingroup$ I love how this question got three radically different but great answers: "don't care that they're primes", "based on widely known results about primes", and "heavy/esoteric machinery". $\endgroup$ – R.. Aug 8 '17 at 2:05
  • 1
    $\begingroup$ @ErickWong Neither/nor meaning individually, I added the clarification. $\endgroup$ – user318107 Aug 8 '17 at 5:43

Yes, you can. Let $x_0>0$ be a given positive number, and let $p_k$ denote the $k$th prime.

Recall that $p_n \sim n \log n$ as $n \to \infty$ so

$$\lim_{n \to +\infty} \frac{p_{\lfloor nx_0 \rfloor}}{p_n} = \lim_{n \to +\infty} \frac{\lfloor nx_0 \rfloor \log \lfloor nx_0 \rfloor}{n \log n} = \lim_{n \to +\infty} \frac{\left(nx_0 - \epsilon_n\right)\log (nx_0 - \epsilon_n)}{n \log n}$$

where $\epsilon_n \in [0,1)$ ($\epsilon_n$ depends on $n$).

Since for fixed $x_0>0$, and any sequence $\left\{\epsilon_n\right\} \subset [0,1)$ we have the equivalences $nx_0 - \epsilon_n \sim nx_0 $ and $\log (nx_0 - \epsilon_n) \sim \log(nx_0)$ as $n \to \infty$, we get

$$\lim_{n \to +\infty} \frac{\left(nx_0 - \epsilon_n\right)\log (nx_0 - \epsilon_n)}{n \log n} = \lim_{n \to +\infty} \frac{nx_0\left(\log n + \log x_0\right)}{n \log n} = \lim_{n \to +\infty} \frac{x_0\left(\log n\right)}{\log n} + \lim_{n \to +\infty} \frac{x_0\log x_0}{\log n} = x_0 $$

This implies any $x_0>0$ can be approximated to arbitrary precision by the sequence $\left\{\frac{p_{\lfloor {nx_0} \rfloor}}{p_n}\right\}_{n \geq 1}$

If you allow negative primes, this means prime ratios are dense in $\mathbb{R}$.


As hinted at by the OP, this is implied by the pair of facts that there are infinitely many primes, and the ratio of successive primes converges to $1$. Here is a proof that uses no further properties of the sequence of primes, hence the same result applies to any increasing integer sequence with those two properties (more generally, any sequence of reals that increases to $\infty$ and has ratios converging to $1$).

Let $C>1$ be a positive real to be approximated ($C=1$ is directly implied by our assumptions, and $C<1$ can be handled by taking reciprocals), and suppose we need to find a prime fraction in the range $(C,C + \epsilon)$.

Since $p_{n+1}/p_n \to 1$, we may choose $N$ such that $p_{n+1}/p_n < 1 + \epsilon/C$ for all $n \ge N$. We now take $b = p_N$ as our denominator and choose $a := p_m$ so that $m$ is the least index satisfying $p_m/b > C$. Clearly such an $m$ exists since there are infinitely many primes so arbitrarily large values of $a$ are available.

It is clear that $m > N$ and that $a/b > C$. By our choice of $m$, $p_{m-1}/b \le C$. By our choice of $N$, $p_m/p_{m-1} < 1 + \epsilon/C$. Therefore $a/b = (p_m/p_{m-1})(p_{m-1}/b) < C + \epsilon$.

  • $\begingroup$ The property of $p_{n+1}/p_{n}$ reaching 0 at infinity is not a trivial property, it is a theorem on its own. I have mentioned it not necessarily as a question if precisely these two can be used, more like an illustration over the properties that are in game. $\endgroup$ – user318107 Aug 8 '17 at 5:50
  • $\begingroup$ I am slightly puzzled here. You say "the ratio of successive primes converges to 1" but the OP says "the ratio of two near prime numbers tends to 0 at infinity" and Alex just said "$p_{n+1}/p_n$ reaching 0 at infinity". These seem a bit contradictory. $\endgroup$ – badjohn Aug 8 '17 at 10:57
  • $\begingroup$ @badjohn see here $\endgroup$ – Marja Aug 8 '17 at 11:01
  • $\begingroup$ @Marja Thanks. That gives me what Erick says but does not explain the (apparent) contradiction with what alex.peter said. $\endgroup$ – badjohn Aug 8 '17 at 11:08
  • $\begingroup$ @badjohn Well, limit is unique. .... and alex just fixed his/her typo. $\endgroup$ – Marja Aug 8 '17 at 11:11

The set of primes has asymptotic density zero, but $\pi(n)$ is not terribly smaller than $n$, it is about $\frac{n}{\log n}$ by the PNT. Additionally, a result of Ingham ensures the existence of a prime in the interval $[n^3,(n+1)^3]$ for any $n\geq N=\exp\exp(34)$. Let $r\in(1,+\infty)$. For any prime $p>N^3$, there is a prime $q$ in the range $[pr,((pr)^{1/3}+1)^3]$. Obviously $\frac{q}{p}\geq r$, but $$ \frac{q}{p}-r \leq \frac{3(pr)^{2/3}}{p} = \frac{3r^{2/3}}{p^{1/3}} $$ and the RHS tends to zero as $p\to \infty$, hence the ratios of primes are dense in $(1,+\infty)$. By considering reciprocals and opposites it is simple to prove that the ratios of primes are dense in $\mathbb{R}$.

Obviously we do not stricly need the finesse of Ingham's result, something like "for any $n$ large enough, there always is a prime in the interval $[n^{42},(n+1)^{42}]$" would have done the job equally fine. We may also prove the claim by invoking something like

Let $E\subset\mathbb{N}$ the set of natural numbers $n$ with the property that there is a prime in the interval $[n,n+\log(n)^{12}]$. $E$ has a positive asymptotic density.

encoding the fact that moderately large prime gaps are quite rare. Indeed, in the interval $[1,n]$ the average distance between a prime and the next one is around $\log n$, always by the PNT.

  • $\begingroup$ I'm not sure I understand what $E$ is. Should it say "the set of natural numbers $n$," instead? $\endgroup$ – Cameron Buie Aug 8 '17 at 11:37
  • $\begingroup$ @CameronBuie: sorry for the misunderstanding, I did not notice I missed a "$n$" in my definition of $E$ above, now fixed. $\endgroup$ – Jack D'Aurizio Aug 8 '17 at 22:17
  • $\begingroup$ Quite alright. For my part, I should've said " 'the set of natural numbers $n$ with the property...,' " instead. :-) $\endgroup$ – Cameron Buie Aug 8 '17 at 22:24

(I).Theorem. For any $x\in \mathbb R$ there exist infinitely many $(a,b)\in \mathbb Z\times \mathbb N$ such that $|x-\frac {a}{b}|<\frac {1}{b^2\sqrt 5}.$

For convenience we will take the weaker result that $|x-\frac {a}{b}|<\frac {1}{b^2}$ in the above theorem.

(II). An immediate corollary to the Prime Number Theorem: For all $y>0$ there exists $z>0$ such there exists a prime between $n$ and $n(1+y)$ whenever $n>z$.

(III). Let $x>0.$ Given $y>0,$ take $z$ such that there is a prime between $n$ and $n(1+y)$ for all $n\geq z.$ Take $a,b \in \mathbb N$ such that $|x-\frac {a}{b}|<\frac {1}{b^2}$ and $\min (a,b)\geq z$ (which is possible by Theorem (I).) Let $p,q$ be primes with $a<p<a(1+y)$ and $b<q<(1+y)b.$

We have $-aby= ab-ba(1+y)<aq-bp<ab(1+y)-ba=aby.$ That is, $|aq-bp|<aby$.

Also $\frac{a}{b}=|\frac {a}{b}|\leq |\frac {a}{b}-x|+|x|<\frac {1}{b^2}+|x|\leq 1+x.$

Therefore $$\left|x-\frac {p}{q}\right|\leq\left|x-\frac {a}{b}\right|+\left|\frac {a}{b}-\frac {p}{q}\right|<\frac {1}{b^2}+\left|\frac {aq-bp}{bq}\right|<\frac {1}{b^2}+ \frac {aby}{b^2}=\frac {1}{b^2}+y\frac {a}{b}\leq \frac {1}{b^2}+ y(1+x).$$

Since $y$ can be arbitrarily close to $0,$ and $b$ can be arbirtarily large for any given $y,$ we are finished for $x>0.$ For $x=0$ consider $2/p$ for arbitrarily large prime $p.$

Footnote. Theorem (I) is not deep or difficult. The Prime Number Theorem definitely is.