# Possible method to prove infinite twin prime conjecture

I have an idea looking more and more promising that may lead to proving the infinite twin prime conjecture. My idea would set up a correspondence between primes and twin prime pairs. Since primes have been proven infinite, twin primes would be shown infinite as well. Here it is:

For every prime $p>7$ there exists at least one unique twin prime pair $(p_t,p_t+2)$ created using only primes less than $p$ as follows:

$$(p_t,p_t+2)=(3\times5\times P_p\times p-4,\ \ 3\times 5\times p\times P_p-2)$$

or

$$(p_t,p_t+2)=(3\times5\times P_p\times p+2,\ \ 3\times5\times p\times P_p+4)$$

where $P_p$ is some product of individual primes ($p_n$) and their powers (although recent developments indicate powers may be unnecessary!) such that each fits the following condition:

$$5<p_n<p$$

Here's a few examples:

$(3\times5\times43-4,\ \ 3\times5\times43-2)=(641,643)$

$(3\times5\times7^2\times11\times47+2,\ \ 3\times5\times7^2\times11\times47+4)=(379997,379999)$

My request is for one of the following:

1. Someone to refine our program for a brute force testing method trying to find a counter-example to disprove my conjecture. Here's the code:

NEW AND IMPROVED Wolfram Notebook

1. Someone to develop a proof of my conjecture; perhaps something related to the fact that the multitude of combinations/permutations etc. of primes ($5<p_p<p$) and their powers requires that there be at least one twin prime pair created. Perhaps a proof by contradiction? I.e. $p$ exists such that no twin prime is created is proven absurd, thus each $p$ maps to a unique twin prime, and as primes are infinite, so are twin primes? Need some help here! Maybe someone with rep to spare set a bounty?

EDIT (2/15/16) Thanks to @dbanet, I now have code needing some refinements. Still, what's astonishing is that we've checked the first $10,000$ primes and each has its own unique twin prime pair... and it didn't even require powers of primes; everything is to the 1st power! This fact alone should lend high credence to the conjecture that each prime may be mapped to (at least one) unique twin prime pair. I'm considering perhaps removing powers of primes from the original question.

Here's the list up to 109 for verification. You can check each by adding $4$ or subtracting $2$ from the first in the pair and looking at the prime factors. All will include $3$, $5$ , $p$, and primes between $5$ and $p$ all to the $1$st power (prime#, prime, twin prime):

4, 7, {101},{103} 5, 11, {1151},{1153} 6, 13, {191},{193} 7, 17, {4337},{4339} 8, 19, {281},{283} 9, 23, {347},{349} 10, 29, {431},{433} 11, 31, {461},{463} 12, 37, {17207},{17209} 13, 41, {617},{619} 14, 43, {641},{643} 15, 47, {1225997},{1225999} 16, 53, {37361},{37363} 17, 59, {881},{883} 18, 61, {55817},{55819} 19, 67, {3616997},{3616999} 20, 71, {1061},{1063} 21, 73, {1091},{1093} 22, 79, {6141857},{6141859} 23, 83, {5922461},{5922463} 24, 89, {546625097},{546625099} 25, 97, {1451},{1453} 26, 101, {134837},{134839} 27, 103, {13888001},{13888003} 28, 107, {1607},{1609} 29, 109, {16969661},{16969663}

EDIT (2/15/16)PM Got a new list of twin primes because of https://mathematica.stackexchange.com/questions/107417/memory-limit-hit-optimize-code-for-finding-twin-primes .

Here's the list of primes $2000-10000$ with the corresponding twin prime pairs! https://dl.dropboxusercontent.com/u/76769933/8000%20twin%20primes.txt

And just for kicks here's the $100,000,000$th prime with the first found (probably not only) twin prime unique to it: $2038074743$ -- $(126984732620985857058143952617,$ $126984732620985857058143952619)$

• Is there any restriction on $P_p$? From what is in the post $P_p$ can be as big as you want, so chances are you are going to hit a twin prime pair given that it is currently not proved there are not infinitely many of them and that we keep finding them. Feb 14, 2016 at 3:53
• @dbanet No restriction other than that mentioned (it can only include primes and their powers between 5 and $p$). Again, the goal is to show they're infinite. Most I've worked with though, require just one or two factors. For programming, an upper bound of 5 factors and 5th powers should more than suffice. Feb 14, 2016 at 4:10
• I liked the beginning of this proof. It is like the analogy of proving infinite primes through Fermat numbers. All Fermat numbers are relatively prime, which means they correspond with different prime numbers. Since there are an infinite number of Fermat numbers, there are an infinite number of primes. Was that your inspiration for this proof ? Feb 14, 2016 at 4:57
• "$P_p$ is some product of individual primes...and their powers" makes it sound like $P_p$ can be any number, since any number can be factored into primes. Feb 14, 2016 at 5:19
• The title of this post is misleading: there is nothing in this question about a possible proof. It might conceivably be a construction of infinitely many twin primes (not a very practical one though), but there not even a hint of a proof that this is true. Feb 14, 2016 at 6:17

Wolfram Language code to test whether does $p$ provide the twin prime number pair via your conjecture or not is as follows.

twinPrimesQ[tp_]:=tp[[1]]+2==tp[[2]]&&PrimeQ[tp[[1]]]&&PrimeQ[tp[[2]]];
primesList[p_]:=Module[{out={Prime[3]},i},
For[i=4,Prime[i]<=p,i=i+1,
out=Append[out,Prime[i]];
];
out
];
testPrime[p_,pl_]:=Module[{out,found=False,twinPrimes,primeFactors,primeFactorsPowers,i},
twinPrimes={
{3 5 prod p-4,3 5 prod p-2},
{3 5 prod p+2,3 5 prod p+4}
};
primeFactors=primesList[p];
primeFactorsPowers=Tuples[Range[0,pl],primeFactors//Length];
For[i=1,i<=Length[primeFactorsPowers],i=i+1,
out=twinPrimes/.prod->Product[primeFactors[[k]]^primeFactorsPowers[[i]][[k]],{k,1,primeFactors//Length}];
found=twinPrimesQ[out[[1]]]||twinPrimesQ[out[[2]]];
If[found,Break[]];
];
If[found,out~Select~(twinPrimesQ[#]&)//First,False]
];

This defines a function twinPrime[p,pl] where p=$\,p$ and pl is the maximum power of prime factors of $P_p$ to search upon. The function returns the first found twin pair or False if it has failed.

For example:

You can try this online with Mathics.

To confirm or disprove your conjecture for ranges of primes, you can use

out=List[]; For[i=4,i<=7,i=i+1,out=out~Append~{i,Prime[i],testPrime[Prime[i],1]}]; out//TableForm

adjusting the bounds of search (values of j in terms of consecutive number of primes) and maximum power of prime factors. This will output a table with three columns: the id of the prime being tested, the prime itself and the first twin prime pair found (or False if none).

• Wow this is cool! I don't think I'm using it right though. I'm getting the following: " out=List[]; For[j=4,j<=7,j=j+1,out=out~Append~{j,Prime[j],testPrime[Prime[j],1]}]; out//TableForm 45677111317If[twinPrimeQ[{7871,7873}]||twinPrimeQ[{7877,7879}],First[Select[out$125,twinPrimesQ[#1]&]],False]If[twinPrimeQ[{4121,4123}]||twinPrimeQ[{4127,4129}],First[Select[out$127,twinPrimesQ[#1]&]],False]If[twinPrimeQ[{5846,5848}]||twinPrimeQ[{5852,5854}],First[Select[out$129,twinPrimesQ[#1]&]],False]If[twinPrimeQ[{8921,8923}]||twinPrimeQ[{8927,8929}],First[Select[out$131,twinPrimesQ[#1]&]],False] " Feb 14, 2016 at 6:30
• It gives me a load of code rather than the twin prime or false for the 3rd collumn. The first 2 show correctly... Feb 14, 2016 at 6:31
• Strange. It works for me if I just open the link. Make sure you evaluate (Shift-Enter) the first cell to have the functions defined before you actually use them in the second and the third cells. i.imgur.com/7jPdlHy.png Feb 14, 2016 at 6:52
• Hmm... Never used it before so must still be doing something wrong: Feb 14, 2016 at 6:56
• Here's what I get: imgur.com/n5tGk1J I'm right clicking your link, opening in new tab, clicking the last line of the first cell and hitting Shift-Enter, bar turns orangish, doing the same for second and third cells, then that's what I'm getting. Feb 14, 2016 at 7:02

I don't see at all how the idea in this question would get us any closer to proving the twin prime conjecture. I know that sometimes, ideas that appear to get you no closer actually do get you closer. For example, Bertrand's postulate states that there is no prime number that is more than double the previous prime number. There's actually a proof of Bertrand's postulate that's not very long, and it's gotten by combining many results each of which appears to not be at all useful for proving Bertrand's postulate. The proof can be found in the Wikipedia article Proof of Bertrand's postulate.

I have another idea. The notion of $$Z_n$$ has been invented by the mathematical community. In $$Z_n$$, the only numbers are the integers from 0 to $$n - 1$$. Addition in $$Z_n$$ is also defined as follows. To add two numbers in $$Z_n$$, you take their sum using regular addition then subtract $$n$$ if the result is greater than or equal to $$n$$.

In $$Z_{2 \times 3 \times 5}$$, in otherwords $$Z_{30}$$, you have 3 pairs of number 2 apart that are coprime to 30. Now, let's see what happens when we take all the pairs of numbers 2 apart that are coprime to 210 in $$Z_{210}$$. Take all the pairs that are 1 more and 1 less than a multiple of 30. Exactly one of those pairs has a multiple of 7 in the higher number and exactly one of them has a multiple of 7 in the lower number. Furthermore, the one with a multiple of 7 in the higher number is necessarily distinct from the one with a multiple of 7 in the lower number. A similar thing is true for all pairs that are 11 more and 13 more than a multiple of 30. The same goes for all pairs that are 17 more and 19 more than a multiple of 30. This proves that exactly $$3 \times 5$$ such pairs exist in $$Z_{210}$$. Similarly, it can be proven that exactly $$3 \times 5 \times 9$$ such pairs exist in $$Z_{2,310}$$ and so on. The problem is 169 is less than 2,310 so pairs of number 2 apart that are coprime to 2,310 and less than 2,310 are not necessarily twin primes. Maybe some day, we will be able to find a proof of certain random properties of the distribution of such pairs in $$Z_n$$ where $$n$$ is the product of all prime numbers less than a very large prime number $$p$$ and prove from the random properties that some of those pairs are less than $$p^2$$ and are therefore twin primes.