# Determining an upper bound for a plot of twin primes

Since this is long and requires a lot of explanation, let me briefly and vaguely state my question at the onset: how would I go about determining an upper bound for the plot pictured near the bottom of my post?

This question is related to a previous question here. It's not required that you read the previous question, but may clarify some of what I'm talking about.

Alterating my statement slightly from what I had in the previous question. My goal is to find some way to show infinitely many twin primes using the following:

If each prime were a bucket filled with at least one unique twin prime, infinite primes (proven) would imply infinite twin primes (conjectured only). Bucket twin primes as follows:

$(6pn-1, 6pn+1)$ where $p$ is a prime, and $n$ is some positive integer less than $p$.

For those with knowledge of Mathematica, I've written the following code that finds the first twin prime for each $p$ by testing values of $n$ starting at 1:

a=1;b=6000000;
Do[p=Prime[pnum];
new=Do[If[And[PrimeQ[6*p*n+1],PrimeQ[6*p*n-1]],Return[n]],{n,1,p}];
Do[If[new>Last[t],{AppendTo[data,{pnum,new}],AppendTo[t,new]}],1],
{pnum,a,b}];


Simply put, this code find a twin prime for the first 6,000,000 primes. It then creates an ordered pair for it of the form (# of prime, $n$ value of first twin).

Running the code, several things are found. First, every bucket through the 6,000,000th prime is filled with a twin prime. Also, each twin prime found is unique. Why? Because as long as a twin is found before $n$ reaches $p$, the factors of $6np$ will always include $6$, $p$, and all other factors less than $p$.

Therefore, to prove the twin prime conjecture, all that would need to be done is prove that for a twin prime must be found for a value of $n$ less than $p$.

Intuitively, this would seem to be the case. Consider with me $p=11$. Lets look for values of $p$ such that neither $6np-1$ nor $6np+1$ is divisible by $5$. For $n=1$, $6np=66$. Since $65$ is divisible by $5$, $n=1$ is a fail. The next fail will be $n=4$, $6np=264$. It can be shown that $6np \pm 1$ is divisible by $5$ for every $n\equiv \pm 1\pmod{5}$. Similarly, $n$ is divisible by $7$ for every $n\equiv \pm 2\pmod{7}$. In other words, only $2$ of every $5$ values of $n$ will be divisible by $5$ following a repeating pattern. The same goes for $7$ and any other prime. This could be used to create a sort of sieving for twin primes generated with each $p$. This takes some thinking through, but ponder on this for a while and I think you'll agree that for large values of $p$, it will become increasing more difficult to "cover" every single value of $n$ that is less than $p$.

And that is exactly what is found when my code above is plotted. Notice, I have the code set to only store an ordered pair if a value of $n$ yielding a first twin is higher than any previous value of $n$ that generated the first twin for some other $p$. The goal is to examine the question, "How large can $n$ possibly get before a twin is created. Notice the plot below: The plot says this: For every one of the first 6,000,000 primes, there exists an $n$ less than $p$ that generates a twin. Also, notice that although the increasing value of $n$ is steep to begin with, it begins to flatten. Within the first 6,000,000 primes, no value of $n$ ever even reaches 2,000 before a twin is generated, and the values of $n$ appear to continue to plateau! This plot includes a blue line which is a logarithmic fit of the ordered pairs. The plot and fit are generated by the following code:

logfit = NonlinearModelFit[data, j*Log[(k*x)^2 ]+l*x, {j,k,l}, x];
Show[ListPlot[data,PlotRange->All,PlotStyle->{Red,PointSize[Tiny]},AxesLabel->{"prime number","n"},ImageSize->Large],
Plot[logfit[x],{x,1,b}]]


Finally, here is my question: How do I move forward? I'm convinced that all the pieces to prove the twin prime conjecture are within this method. The logical step would seem to be to try to find an upper bound for $n$ in relation to $p$. This is where my knowledge of number theory proves insufficient. Would someone give me what steps I should take toward showing that $n$ must remain below $p$?

Thanks so much for reading!

• If you are interested in sieves and how they work, there is a paper talking about sieves and their relation to twin primes here: drive.google.com/file/d/0B5KQFxR7gj3JdEFTTjEycE5JQVE/view – abiessu Oct 28 '17 at 14:54
• The point made in the paper is actually the opposite of what you have stated here: a sieve becomes more dense over whatever set of numbers is being sieved as the numbers increase, and this continual increase in density is what demonstrates the infinity of the complement set. – abiessu Oct 28 '17 at 15:01
• @abiessu True, but not quite my point. This is going to sound very novice (because it is) but I'm going to try anyway. Consider a sieve of primes only in this sense. Say we start knowing that 2 is prime and don't know if anything else is prime. We do know that we can sieve out all multiples of 2 for numbers less than 2^2 and what's left will be primes though (not including 1 of course). This tells us 3 must be prime. Now we can sieve numbers less than 3^2. Eliminating multiples of 2 and 3, we get that 5 and 7 must be prime. Now we sieve numbers less than 7^2. Hopefully you see my point... – Elem-Teach-w-Bach-n-Math-Ed Oct 28 '17 at 15:38
• Although yes, the density of the sieve increases as more numbers are required to be sieved out, so also does the gap in which we hope to find a number not "covered" by the sieve. If the density does not increase at a fast enough rate to eventually cover everything in the larger gap, new primes are generated. This is really a poor analogy to what's going on with the sieve I talk about above, but illustrates a little better what I'm talking about. – Elem-Teach-w-Bach-n-Math-Ed Oct 28 '17 at 15:43
• I do see your point and I have been down this road before... in order to formalize what you’re talking about, you’ll have to have a way to count the results you’re getting as well as prove that your count is accurate. One way to approach these issues is to bind your sieve into an algebraic form, as in the paper referenced above. – abiessu Oct 28 '17 at 15:52