### Tuesday, February 02, 2010

## JSH: Hiding random?

It has long been a matter of debate how random is associated with primes with it well established that the prime distribution itself—the count of prime numbers—is NOT random. But primes may still have random behavior which can be easily seen with twin primes.

To understand though you need to know about probability as well as just a little bit about residues.

Given a prime, like 3, it has two residues, as 0 isn't a residue, so for instance 7 mod 3 =3D 1. The "mod" is clock arithmetic.

If x is prime and greater than 3 the probability that x+2 is prime is given by:

prob = ((p_j - 2)/(p_j -1))*((p_{j-1} - 2)/(p_{j-1} - 1))*…*(1/2)

where j is the number of primes up to sqrt(x+2), and p_j is the jth prime, p_{j-1} is the prime before it and so forth.

The result is easy as it is just multiplying the probability for each prime that it is NOT true that

x + 2 ≡ 0 mod p

which probability is just the result of dividing one minus the number of non-zero residues by the total number of residues together to get the total probability that a prime plus 2 is also prime.

So let's try it out. Between 5^2 and 7^2, there are 6 primes. The probability then is given by:

prob = ((5-2)/(5-1))*((3-2)/(3-1) =3D (3/4)*(1/2) = 0.375

And 6*0.375 =3D 2.25 so you expect 2 twin primes in that interval. The primes are 29, 31, 37, 41, 43, 47 and you'll notice, two twin primes as predicted: 29,31 and 41, 43.

For a bigger interval, here's another example:

Using all the primes up to 100, I get:

prob =3D 0.1558 to 4 significant digits.

So that says that the probability that for a prime between 97^2 and 100^2 that adding 2 to it gives a prime is about 15.58% and there are 66 primes in that interval so there should be about 10 twin primes, and a quick count shows that there are:

(9419, 9421), (9431, 9433), (9437, 9439), (9461, 9463), (9629, 9631), (9677, 9679), (9719, 9721), (9767, 9769), (9857, 9859), (9929, 9931)

So the probability from assuming the primes have no preference for a residue gives you a good estimate and for these examples it was really close but it can wander off as it's a random thing.

The important difference here with what mathematicians do with their own twin primes research is that I separate the prime distribution itself off, by calculating a probability and multiplying that times a known count of primes.

But consider what math people do by looking at the literature, and especially one particular equation. Here's a link to MathWorld:

http://mathworld.wolfram.com/TwinPrimes.html

eqn: (3)

Looking at it, it appears that they tossed in the prime distribution, clearly seen squared, of all things, with x/ln x. And you have the probability formula wrapped up in there:

((p_j - 2)/(p_j -1))*((p_{j-1} - 2)/(p_{j-1} - 1))*…*(1/2)

where you can see it by simplifying 1 - 1/(p-1)^2, as that's p(p-2)/(p-1)^2, so you get this excess p/(p-1).

So the equation I give above is part of equations in known literature, as part of what is called the twin primes constant.

But it's obfuscated.

Also by not separating out the count of primes you get a lot of extra which is extraneous.

Now it could be a mistake. But now you know.

So we can just toss off the extra math crap, focus on the random piece and have mathematically a random distribution.

Mathematically perfectly random.

But then the mathematicians lose a few things—some supposedly open problems—so it's an interesting question as to whether or not they'll agree with physicists being practical here!

Regardless, now is available a perfectly random distribution. Mathematically perfectly random, using prime numbers.

The main thing was just to isolate the prime distribution away, and focus on residues of primes relative to each other, and random just jumps out at you.

To understand though you need to know about probability as well as just a little bit about residues.

Given a prime, like 3, it has two residues, as 0 isn't a residue, so for instance 7 mod 3 =3D 1. The "mod" is clock arithmetic.

If x is prime and greater than 3 the probability that x+2 is prime is given by:

prob = ((p_j - 2)/(p_j -1))*((p_{j-1} - 2)/(p_{j-1} - 1))*…*(1/2)

where j is the number of primes up to sqrt(x+2), and p_j is the jth prime, p_{j-1} is the prime before it and so forth.

The result is easy as it is just multiplying the probability for each prime that it is NOT true that

x + 2 ≡ 0 mod p

which probability is just the result of dividing one minus the number of non-zero residues by the total number of residues together to get the total probability that a prime plus 2 is also prime.

So let's try it out. Between 5^2 and 7^2, there are 6 primes. The probability then is given by:

prob = ((5-2)/(5-1))*((3-2)/(3-1) =3D (3/4)*(1/2) = 0.375

And 6*0.375 =3D 2.25 so you expect 2 twin primes in that interval. The primes are 29, 31, 37, 41, 43, 47 and you'll notice, two twin primes as predicted: 29,31 and 41, 43.

For a bigger interval, here's another example:

Using all the primes up to 100, I get:

prob =3D 0.1558 to 4 significant digits.

So that says that the probability that for a prime between 97^2 and 100^2 that adding 2 to it gives a prime is about 15.58% and there are 66 primes in that interval so there should be about 10 twin primes, and a quick count shows that there are:

(9419, 9421), (9431, 9433), (9437, 9439), (9461, 9463), (9629, 9631), (9677, 9679), (9719, 9721), (9767, 9769), (9857, 9859), (9929, 9931)

So the probability from assuming the primes have no preference for a residue gives you a good estimate and for these examples it was really close but it can wander off as it's a random thing.

The important difference here with what mathematicians do with their own twin primes research is that I separate the prime distribution itself off, by calculating a probability and multiplying that times a known count of primes.

But consider what math people do by looking at the literature, and especially one particular equation. Here's a link to MathWorld:

http://mathworld.wolfram.com/TwinPrimes.html

eqn: (3)

Looking at it, it appears that they tossed in the prime distribution, clearly seen squared, of all things, with x/ln x. And you have the probability formula wrapped up in there:

((p_j - 2)/(p_j -1))*((p_{j-1} - 2)/(p_{j-1} - 1))*…*(1/2)

where you can see it by simplifying 1 - 1/(p-1)^2, as that's p(p-2)/(p-1)^2, so you get this excess p/(p-1).

So the equation I give above is part of equations in known literature, as part of what is called the twin primes constant.

But it's obfuscated.

Also by not separating out the count of primes you get a lot of extra which is extraneous.

Now it could be a mistake. But now you know.

So we can just toss off the extra math crap, focus on the random piece and have mathematically a random distribution.

Mathematically perfectly random.

But then the mathematicians lose a few things—some supposedly open problems—so it's an interesting question as to whether or not they'll agree with physicists being practical here!

Regardless, now is available a perfectly random distribution. Mathematically perfectly random, using prime numbers.

The main thing was just to isolate the prime distribution away, and focus on residues of primes relative to each other, and random just jumps out at you.