## JSH: Prime gap equation, corrected

My prime residue axiom that primes show no preference by residue, can lead beyond twin primes probability to a general equation for prime gaps.

The prime gap equation given a natural number x and even gap g is

probPrimeGap = ((p_j - 2)/(p_j - 1)*...*(1/2))*(1 - ((p_j - 2)/(p_j-1)*…*(1/2))n*Corr

where n equals (g/2)-1, j is the number of primes up to sqrt(x+g), or sqrt(x-g) if g is negative, p_j is the jth prime, and Corr corrects for any odd primes that are factors of g, if there are any, and if there are none Corr=1, otherwise it adjusts to (p-1)/p for that prime versus (p-2)/(p-1).

Let's try it out. Between 5^2 and 7^2 there are 6 primes. For a prime gap of 4, n=1, and the probability is given then by:

probPrimeGap = ((5 - 2)/(5 - 1))*1/2*(1 - ((5 - 2)/(5 - 1))*1/2) = (3/4)(1/2)(1 - (3/4)(1/2)) = 0.375*0.625 = 0.234375

And 6*0.234375 = 1.40625, so 1 case with a prime gap of 4 is expected.

The primes are 29, 31, 37, 41, 43, 47 and you'll notice, one case with a 4 gap as predicted: 37, 41

As has been noted with my twin primes probability equation the estimate should usually be an over count, but I hypothesize that the effect is less with gaps larger than 2. Notice the equation does default to the twin primes probability equation with g=2.

There is no other known prime gap equation.