# Two kinds of prime gaps

$$1361 - 1327 = 34$$ Between these two prime numbers there are no others. No prime gaps this big come before this one; i.e. this one is "maximal".

The largest prime not exceeding the square roots of any of them is $31.$ All prime numbers not exceeding $31$ divide some number between these two primes.

$$9587 - 9551 = 36$$

Between these two prime numbers there are no others. No prime gaps this big come before this one, i.e. this one is "maximal".

The largest prime not exceeding the square roots of any of them is $97.$ Some prime numbers not exceeding $97$ divide no number between these two primes. In fact, $97$ is one of those. So are $83$ and $89.$

Are infinitely many maximal prime gaps like the first one mentioned above, in this respect? How are they distributed among maximal prime gaps? (I'd guess they occur less frequently than those like the second one.)

• I think that you are asking something equivalent to Legendre's(?) question, is there always a prime between $n$ and $n + \sqrt n.$ It is quite possible that the original question was $n$ and $n + 2 \sqrt n.$ I will need to read your question again... – Will Jagy Oct 17 '17 at 20:58
• We conjecture the $k$-th prime gap is distributed as a geometric distribution with parameter $1-\frac{1}{\log k}$ (mean and standard deviation $\log k$) see Cramer's random model for primes. – reuns Oct 17 '17 at 21:08
• @WillJagy : I exhibited one case in which the phenomenon I'm asking about happens and one it which it does not, so the word "always" may be a stretch. – Michael Hardy Oct 17 '17 at 21:23
• @reuns : In what way would you mention $g(k)$ in this question? – Michael Hardy Oct 17 '17 at 21:29
• Replace Are infinitely many maximal prime gaps like the first one mentioned above, in this respect? How are they distributed among maximal prime gaps? (I'd guess they occur less frequently than those like the second one.) by the corresponding formulas using $g(k) = p_{k+1}-p_k$ (and try using the Cramer model) – reuns Oct 17 '17 at 21:30

Consider a maximal gap that follows a very large prime $p$.

• Maximal gap sizes are $O(\log^2 p)$ (by Cramer's conjecture).

• Almost all maximal gaps are asymptotically equivalent to $\log^2 p$ (a modified form of Shanks conjecture).

• Hence, there are $O(\log^2 p)$ composite integers inside our maximal gap.

• The expected number of distinct prime factors of one such composite integer is $\sim\log\log p$ (by the Erdos-Kac theorem).

• Therefore the expected total number of distinct prime factors dividing at least one integer inside the gap is $f(p)=O(\log\log p \cdot \log^2 p)$

• On the other hand, $\pi(\sqrt{p})\sim {\sqrt{p}\over\log \sqrt{p}}$ (by the prime number theorem).

• Thus $f(p) = o(\pi(\sqrt{p}))$, i.e. we expect only a zero proportion of primes below $\sqrt{p}$ to be factors of some integer inside the gap.

On probabilistic grounds we conclude that gaps of the second type are much more common. In fact we should expect that gaps of the first type are only a zero proportion of all maximal gaps.

Moreover, we should expect only finitely many gaps of the first type. This is provable if Cramer's conjecture is true. Let $\Pi$ be the product of all composites inside the gap. What's the order of magnitude of $\log\Pi$? Firstly, $\Pi$ is a product of $\sim\log^2⁡p$ integers each of size $\sim p$; so $$\log\Pi \sim \log(p^{\log^2⁡p}) \sim \log^2⁡p \cdot \log p = \log^3⁡p.$$ On the other hand, $\Pi$ is a product of all prime factors of these composites. By assuming that all primes below $\sqrt{p}$ participate in the product (and small primes participate many times) we would get a different asymptotic size for the same product: $$\log\Pi > \log(\sqrt{p}\#) \sim \sqrt{p} \quad (\# \mbox{ denotes primorial).}$$

But $$\lim_\limits{p\to\infty}{\log^3 p \over \sqrt{p}}=0.$$

That's a contradiction -- unless there are only finitely many examples of a maximal gap near $p$, containing composites divisible by every prime below $\sqrt{p}$.

• Do you mean we should "expect" in a probabilistic sense that only finitely many are of the first type? Or that one can prove there are only finitely many? If the latter, one would immediately wonder how many. – Michael Hardy Oct 22 '17 at 18:54
• . . . . . or perhaps I should say: Can one prove that if Cramér's conjecture is true, then only finitely many of these exist? – Michael Hardy Oct 22 '17 at 19:04
• I think it's provable if Cramer's conjecture is true. Reason along these lines: what's the product of all composites inside the gap? Firstly, it's a product of $O(\log^2p)$ integers each of size $~p$. On the other hand it's a product of all prime factors of these numbers. By assuming that all primes below $\sqrt{p}$ participate in the product (and small primes participate many times) we would get a different asymptotic size for the same product. A contradiction, unless there are only finitely many examples of such a maximal gap / such a product. – Alex Oct 22 '17 at 19:16
• Incorporated a conditional proof (assuming Cramer's conjecture) into the answer. – Alex Oct 22 '17 at 20:17

The short story is the divisor is larger than the gap and this may true for other maximal gaps. The rest of the story: $9587 / 83 = 115.5$ and the next prime number is $113$ or $127.$ $83 \times 127 = 10541$ or $83 \times 113 = 9379.$ $9587 / 89 = 107.7$ the next prime numbers are $107$ or $109.$ $9587 / 97 = 98.8$ and the next prime numbers are $97$ or $101.$ These calculations show how they were not related to the gap of $34$ between $9551$ and $9587.$

• "the divisor is larger than the gap"? Which divisor? A divisor of which number? – Michael Hardy Jan 12 '18 at 20:58
• The square root of 9587 is 97 and is a prime number divisor for 9587. The gap between 9587 and 9551 is 36. Any time that the a prime number divisor is larger than the gap it may not be used within the gap. This may be the case for other maximal gaps. – Ray Jan 14 '18 at 15:01
• You wrote: "The square root of 9587 is 97 and is a prime number divisor for 9587." If you're saying $97$ is a divisor of $9587,$ you are mistaken. It looks as if you meant that the largest prime number not exceeding the square root of $9587$ is larger than the gap. If you intended someone reading you answer to understand that "the largest prime number not exceeding the square root of $9587$" was what you meant by "the divisor", that's rather optimistic. – Michael Hardy Jan 14 '18 at 15:44
• In my first example, the largest prime number not exceeding the square root of the largest number within the gap is smaller than the size of the gap, and if one somehow knows only that, then one can deduce that that gap is of the first kind. In the second example, one does not have that particular means of deducing that all primes not exceeding $97$ will be included, and in fact they are not all there. If that is what you're trying to say, then it does not address the question of whether there are infinitely many of the first kind. My guess is there are only finitely many. And$\,\ldots\qquad$ – Michael Hardy Jan 14 '18 at 15:53
• $\ldots\,$maybe my first example is the last one. $\qquad$ – Michael Hardy Jan 14 '18 at 15:53