~~The Hot Twins Project~~

**The Twin Primes Project**

I thought this blog post would just be a journal entry about the Twin Primes project during July-August of ’17. And that, Like many of these posts, it’s probably of minor or no interest to anyone but the writer (of course, this is true of 99.57% of all of the blogs out there). That said… I just finished writing this post. It came out good/interesting. See if you agree.

Lock The Gates!!

This project started as simply an attempt to explore various aspects of Twin Primes in the hopes that an interesting project and/or insight would result.

For the new reader, if you are not already familiar with Twin Primes then spend just a few minutes and follow these links as they provide clear explanations and background:

https://en.wikipedia.org/wiki/Twin_prime

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

The first thing done as part of this project was to modify my * PrimeTest* C# program to not only look for primes, but to also identify Twin Primes in the process. The vast majority of the work for identifying Twin Prime pairs was already done by the

*program merely by identifying/finding the primes. The*

**PrimeTest***program had a function coded in it that, when given an integer, would return a boolean that indicates whether or not the given number was a prime.*

**PrimeTest**The name of the function was/is **IsPrime****()** and it implements the **Miller-Rabin prime testing algorithm** and it uses the **BinInteger** class available with Microsoft’s C# and .Net libraries. The **IsPrime()** routine is also used in some of my other programs (I had cut and pasted the code). Anyway, as part of this project I thought it would be a good thing to move that **IsPrime()** functionality to a C# class library I had earlier started building for these projects; so I did (move it that is). And updated existing programs to use the IsPrime() from the classlib.

The modified PrimeTest program was able to provide some insights into how often and when Prime Twins occur but, each additional Twin Primes result I wanted got more and more tedious to implement in the code because I had to be careful to not damage existing functionality. After some time this prompted me to write a brand new program just for Twin Primes. Of course, the name is TwinPrimes.exe.

After constantly mulling over the notion of Twin Primes for some weeks, and gathering information much of which was the result of the running of the new TwinPrimes.exe program, I came to some conclusions.

Like others, it’s my conjecture as well that there are an infinite number of Twin Prime pairs. I come to that conclusion based on the following:

**-1-** First, it’s based on the conjecture that primes are distributed essentially randomly among the odd numbers although they “thin out” according to the Prime Number Theorem. Also see 2 recent blog postings about primes that are the sum of 2 squares.

https://itbegsthequestion.com/gerrys-sum-of-2-squares-theorem/ and

https://itbegsthequestion.com/sumof2squares-and-random-primes/

**-2-** So, in general, the “density” of primes is 1/ln(N). Or in other words, the probability of an integer between 1 and N being prime is 1/ln(N). That said, and again assuming “random” distribution of primes, the probability of 2 primes landing next to each other would be “about”

(1/ln(N)) x (1/ln(N)) or **1/ln(N)**^{2}

In reality, the probability of 2 primes “randomly” landing next to each other and thus forming a Twin Prime pair is greater than the above because each time it happens we must remove those two primes from the pool of primes and we must remove the “slots they occupy” from the pool of potential landing places. With this in mind, you may want to read the following:

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

http://primes.utm.edu/glossary/xpage/TwinPrimeConstant.html

Of course, we know the above is not completely accurate and is somewhat overly simplified but it’s good enough for understanding why there are an infinite number of Twin Prime pairs!! It’s also good for estimating the count of Twin Prime pairs in order to reinforce our understanding based on the above principles. In addition, **actually counting**** Twin Prime pairs using the TwinPrimes.exe program provides even more support/confirmation **that the notion of estimating Twin Prime pair counts via the **above principles** is correct/reasonable.

The “**above principles**” is, again, based on “random” distribution of primes and the resulting probabilities of 2 primes “landing next to each other.”

Below is an excerpt from a spreadsheet I made with some data/results from running the TwinPrimes.exe program.

As you can see from the spreadsheet, the **actual** count of Twin Prime pairs exceeds the (overly?) simplified “calculated” values of **1/ln(N)**^{2} (which was to be expected).

Following the spreadsheet is a corresponding chart comparing the actual count of Twin Prime pairs vs the calculated count (using **1/ln(N)**^{2} ). N ranges from 1 to 1 Billion.

Summary:

If I wasn’t before, I am convinced now, that the Twin Primes conjecture is true (that there are infinite Twin Prime pairs).

At the beginning of this post I didn’t think it would be very interesting. By the end (now) I think it’s definitely interesting (although many readers may (will?) think otherwise).

**Open The Gates!!**

## Leave a Reply