11

Every odd number lies between two even numbers. Accordingly we have two categories of consecutive even number pairs; those pairs which surround primes and those pairs which surround odd composites. Some even numbers can belong to both categories as explained in the example below.

E.g: The pair $(8,10)$ will fall in the category of composite since it contains the odd composite number $9$. The pair $(10, 12)$ belongs to the category of primes since they contain the prime $11$. Hence there will be some overlap on the boundaries of primes as is the case with $10$ in this example. As primes thin out, such overlaps will also thin out accordingly.

Data: Experimental data shows that the even numbers which surround a prime have on a average about $28\%$ more divisors and $7\%$ more distinct prime factors than the even numbers which surround odd composites. For numbers up to $3.5 \times 10^7$,

  1. The average number of divisors of the even pairs surrounding primes is $35.39$ while that of those which surround odd composite numbers is only $27.70$.
  2. Moreover, difference between the average number of distinct prime factors of these two categories seems to converge to a value in the neighborhood of $0.27$

Question 1: How or why does the act of surrounding a prime give the two surrounding even numbers a higher number of divisors and distinct prime factors?

Note: This question was motivated by the following question on twin primes in MSE.

Code

n = 3
pa = pb = ca = cb = 0
ip = ic = 0
target = step = 10^6
while true:
    if is_prime(n) == True:
        ip = ip + 1
        pb = pb + len(divisors(n-1))
        pa = pa + len(divisors(n+1))
    else:
        ic = ic + 1
        cb = cb + len(divisors(n-1))
        ca = ca + len(divisors(n+1))
    if n > target:
        print n, ip, pb, pa, ir, cb, ca, pb/ip.n(), (pb/ip)/(cb/ic).n(), pb/ip.n() - cb/ic.n()
        target = target + step
    n = n + 2
  • 1
    What do you mean with "surround" in this context ? In which category would $10$ fall ? I ask because $9$ is composite and $11$ prime. – Peter Dec 30 '19 at 10:54
  • How do you define these two cases? If $e+1$ is prime and $e-1$ is composite, does $e$ "surround a prime" or "surround a composite number"? – joriki Dec 30 '19 at 10:54
  • @Peter The surrounding pair $(10, 12)$ would belong to the category of primes since they contain the prime $11$. The surrounding pair $(8,10)$ will fall in the category of composite since it contains the odd composite number $9$. Hence there will be overlap on the boundaries of primes. – Nilotpal Sinha Dec 30 '19 at 10:57
  • But you provided statistics. You must be able to tell us how you categorized the numbers in generating those statistics? The statistics are for numbers, not for pairs of numbers. – joriki Dec 30 '19 at 10:58
  • @joriki As explained in the example, the two categories will have overlaps but these overlaps become fewer as primes thin out. As a matter of fact, I ran an older version of the code where an even number was put in the category which it encountered first. In this version $10$ would belong to the category of composites since it first appears in the pair $(8,10)$ containing the composite $9$. However this differentiation did not actually change the observed effect except of numerical value of decimals. Hence I simplified it by allowing overlaps. – Nilotpal Sinha Dec 30 '19 at 11:09
  • 3
    You are not defining a property of even numbers; you are defining a property of pairs of consecutive even numbers. I think you should clear this up if you want to make any progress. Perhaps what you are really interested in is even numbers that are adjacent to a prime? – TonyK Dec 30 '19 at 11:09
  • Do you have statistics for a simplified case: number of divisors of even numbers which are neighbours of primes against those even numbers which are not neighbours of primes? – z100 Dec 30 '19 at 11:15
  • @z100 The current run will stop at one billion. I will revert the code back to the old version and run this mutually exclusive case. – Nilotpal Sinha Dec 30 '19 at 11:25
  • 2
    If I understand correctly, you are computing the function $\sigma_0(2n)+\sigma_0(2n+2)$ and finding that it is typically larger when $2n+1$ is prime than it is when $2n+1$ is composite. Do I understand correctly? – Barry Cipra Dec 30 '19 at 11:27
  • @BarryCipra Yes both $\sigma_0(2n) + \sigma_0(2n+2)$ and $\omega_0(2n) + \omega_0(2n+2)$ – Nilotpal Sinha Dec 30 '19 at 11:30
  • 1
    One element of an explanation might lie in the fact that for large primes, one of the two surrounding even numbers is always divisible by $3$, one of them is divisible by $5$ about half the time, one by $7$ about a third of the time, and so on. – Barry Cipra Dec 30 '19 at 11:44
  • If a number has a many factors, then the numbers before and after it cannot have those factors. For example, $100!$ has many factors, of which $101! + 1$ will have none. So, numbers with lots of factors tend to be surrounded by numbers with much less factors, and therefore potentially prime numbers. – FlipTack Dec 30 '19 at 17:22
  • @FlipTack This reasoning is not sufficinet since there are infinitely many primes, even if a number has many prime factors, those before or after it can also many prime factors form the infinitely many primes – Nilotpal Sinha Dec 30 '19 at 17:48
  • @NilotpalKantiSinha There are infinitely many primes, but you're not just picking from the list of prime numbers, you're picking from the list of prime numbers less than or equal to the square root of your number. In this way the "highly composite" numbers "hog" all the possible prime factors, so the nearby numbers are more likely to be prime. No, I'm not trying to provide a rigorous argument or proof, just some intuition. – FlipTack Dec 30 '19 at 17:51
  • I gave an answer analogous to my answer here to the question that motivated you to ask this question. – joriki Dec 30 '19 at 18:25

1 Answers1

11

On the random model of the primes, the probability for an even number $n$ to be divisible by an odd prime $p$ is a priori $\frac1p$. If we know that $n$ is adjacent to a prime $q$, this is increased to $\frac1{p-1}$, since we know that $q$ is not divisible by $p$, which excludes one of the non-zero values of $n\bmod p$.

The expected number of distinct prime factors of an even number $n$ is roughly

$$ 1+\sum_{3\le p\le n^r}\frac1p\;, $$

where $r=\mathrm e^\gamma$ (see Asymptotic distance between $x^2+1$ primes?). Conditional on $n$ being adjacent to a prime $q$, this becomes

\begin{eqnarray} 1+\sum_{3\le p\le n^r}\frac1{p-1} &=& 1+\sum_{3\le p\le n^r}\frac1p+\sum_{3\le p\le n^r}\left(\frac1{p-1}-\frac1p\right) \\ &=& 1+\sum_{3\le p\le n^r}\frac1p+\sum_{3\le p\le n^r}\frac1{p(p-1)} \\ &\approx& 1+\sum_{3\le p\le n^r}\frac1p+\sum_{3\le p}\frac1{p(p-1)} \;, \end{eqnarray}

where we can remove the upper limit on the right-hand sum for large $n$ since this series converges (whereas the sum over $\frac1p$ diverges). To evaluate it, we can write

\begin{eqnarray} \sum_{3\le p}\frac1{p(p-1)} &=& \sum_p\frac1{p(p-1)}-\frac12 \\ &=& \sum_{s=2}^\infty \sum_p\frac1{p^s}-\frac12 \\ &=& \sum_{s=2}^\infty P(s)-\frac12\;, \end{eqnarray}

where $P(s)$ is the Prime zeta function.

Wolfram|Alpha evaluates the left-hand series to approximately $0.773157$, so the expected excess of distinct prime factors for a large even number adjacent to a prime is about $0.273157$, in agreement with your data. (This is the excess over the average, not the excess over the even numbers not adjacent to primes that you computed; but since the density of primes goes to $0$, this distinction doesn't matter in the limit.)

We can perform a similar analysis to find the (in this case multiplicative) excess of divisors for even numbers adjacent to primes. A number with prime factorization $\prod_ip_i^{k_i}$ has $\prod_i(k_i+1)$ divisors, so the logarithm of the number of divisors is $\sum_i\log(k_i+1)$.

For a given odd prime $p$, a priori an even number $n$ has probability $\frac{p-1}p$ of containing $0$ factors of $p$, probability $\frac1p\cdot\frac{p-1}p$ of containing $1$ factor of $p$, and generally probability $\frac1{p^k}\frac{p-1}p$ of containing $k$ factors of $p$. Conditional on $n$ being adjacent to a prime, it has probability $\frac{p-2}{p-1}$ of containing no factors of $p$, probability $\frac1{p-1}\frac{p-1}p=\frac1p$ of containing $1$ factor of $p$, and generally probability $\frac1{p^k}$ of containing $k\gt0$ factors of $p$.

Thus the expected excess in the logarithm of the number of divisors given that $n$ is adjacent to a prime is

\begin{eqnarray} \sum_{3\le p}\sum_{k=0}^\infty\frac{\log(k+1)}{p^{k+1}} &=& \sum_{3\le p}\sum_{k=2}^\infty\frac{\log k}{p^k} \\ &=& \sum_{k=2}^\infty (P(k)-2^{-k})\log k \\ &\approx& 0.226201\;. \end{eqnarray}

Thus, a large even number adjacent to a prime is expected to have approximately $\mathrm e^{0.226201}\approx1.253828$ times as many divisors as usual. The slight discrepancy to the factor of $1.28$ from your data is likely due to the fact that you averaged the divisor counts themselves and not their logarithms (as the geometric mean is less than the arithmetic mean).

As above, this is the excess over the average, but since the density of primes goes to zero, this converges to the excess over the even numbers not adjacent to primes.

joriki
  • 242,601
  • "which excludes one of the non-zero values of $n\bmod p$." By "one of the non zero values" do you mean that $n$ can't be equal to $p-1 mod p$? Did I understand you correctly? – Jeanba Dec 30 '19 at 13:01
  • 2
    @Jeanba: It depends on which side the adjacent prime is. If $n=q-1$, the residue $p-1\bmod p$ is excluded, and if $n=q+1$, the residue $1\bmod p$ is excluded. – joriki Dec 30 '19 at 13:02