## JSH: Prime gap equation

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

probPrimeGap(x) = probPrime(x)*((p_j - 2)/(p_j - 1)*…*(1/3))*(1 - probPrime(x)*((p_j - 2)/(p_j-1)*…*(1/3))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.

First as shown in my post on twin primes if you have x a prime, then you have the probability that x+2 does NOT have a prime p that is less than or equal to sqrt(x+2) as a factor, is (p-2)/(p-1), but if x may not be prime, you need the probability that it is prime.

You just multiply all the odds of something not happening together to get the odds that none of them happen. So for the first piece of my prime gap equation I just multiplied the probability that x is prime times (p-2)/(p-1) for each prime less than or equal to sqrt(x+g), where for any primes that are factors of g you just have (p-1)/p as there is 0 probability that p can add to another prime and give a number divisible by itself.

For the second piece I simply consider the probability if x is prime that x+2 is NOT prime, and then that x+4 is NOT prime, and so forth up until before the gap, like with g=10, that goes up to x+8, so n=4, as it turns out each probability is roughly the same, and that's how I get the equation, as I just subtract the probability that x+g is prime from 1.

Copied from my math blog post "Prime Gap Equation" of August 9, 2006.