Why do even numbers which surround primes have more divisors than those which surround composites?

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

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.