# Brute force evidence of possible proof of twin prime conjecture

Trying to avoid shelling out hundreds of dollars so I'm using what I can for free online. This is what I've come up with so far:

https://dl.dropboxusercontent.com/u/76769933/TwinPrimes%203Podd.cdf

Trying to use this to demonstrate a possible way to prove the twin prime conjecture:

For every prime $p$ greater than 2, there exists one or more twin primes as follows: $(3pn-4, 3pn-2)$ where $n$ is some positive odd less than or equal to $p$.

With the free version, I can only go so far.

My questions are these:

1. Would someone help test for a counter-example. Maybe refine this code to only print if a counter-example exists in the first million or so primes.
2. Would someone perhaps plot Length[twin] vs. $p$ to show that as $p$ increases, so does the number of twins found.

I realize this question requires simultaneously a lot of knowledge of primes and Mathematica, as well as requiring you to look through code to fully understand the question, so thanks in advance.

• Just messed with this some. Found this: as $p$ increases, so does the number of twin primes. I've also found that it is highly unlikely a counter-example will be found. The highest % through odds before a twin prime is found is 78%; the next highest being only 40%, with the average percent dropping heavily as $p$ increases. The proof of the twin prime conjecture is right here in the math; a nugget waiting to be dug up by someone who simply understands what's going on. – Elem-Teach-w-Bach-n-Math-Ed Mar 28 '16 at 4:35
• If this result is original, it is extremely impressive and paper-worthy. I do wonder, however, if it's an already known result. In either case, I suggest keeping this question open. – barrycarter Mar 28 '16 at 6:05
• I get worried when I see phrases such as "one or more unique xxx". It's just not clear what that means. – Daniel Lichtblau Mar 29 '16 at 14:42
• @DanielLichtblau Which is the unclear part? "One or more" or "unique"? Let me know and I'll clarify. – Elem-Teach-w-Bach-n-Math-Ed Mar 29 '16 at 18:26
• (3) I do not much like the subject header. This is not a proof of anything. – Daniel Lichtblau Mar 30 '16 at 2:41

No counterexample.

ClearAll[p]
p = 2;
primes = Reap[While[p <= 1000000, Sow[p = NextPrime[p]]]][[2, 1]];

Do[
Table[
If[PrimeQ[3*primes[[i]]*j - 4 (* or 2 *)],
Continue[]
]
,
{j, 1, primes[[i]], 2}
];
Return[i]
,
{i, 1, Length@primes}
] // AbsoluteTiming


{76.1693, Null}

twinPrimes = Table[
{
primes[[i]],
Pick[#, PrimeQ@#, True] &@(3*primes[[i]]*Cases[Range@primes[[i]], _?OddQ] - 4),
Pick[#, PrimeQ@#, True] &@(3*primes[[i]]*Cases[Range@primes[[i]], _?OddQ] - 2)
},
{i, 10}
];

twinPrimes // MatrixForm ListLinePlot[
{
{#[], Length@#[]} & /@ twinPrimes,
{#[], Length@#[]} & /@ twinPrimes
},
AxesLabel -> {"prime number", "twins amount"},
ImageSize -> Large
] • Technically, aren't these the primes under one million and not the first one million primes? – barrycarter Mar 28 '16 at 5:15
• @barrycarter You are correct. These are primes under 1M (around 79K primes). Maybe later I will check more primes. – Alexey Golyshev Mar 28 '16 at 5:44
• True, but still, awesome work! Thanks for not ignoring a question on hold! As I commented on the original question, the indication is strong that no counter-example will be found. Maybe a graphic plot like my 2nd question would help show this? – Elem-Teach-w-Bach-n-Math-Ed Mar 28 '16 at 5:51
• @user3363795 Updated. Plot of the first 2K twinPrimes. – Alexey Golyshev Mar 28 '16 at 6:10
• That plot is sick! I knew this was convincing evidence of the twin prime conjecture, but that is awesome! It appears nearly linear! – Elem-Teach-w-Bach-n-Math-Ed Mar 29 '16 at 0:43

Ok, so I found I can go a little further on lab.wolframcloud.com/app. Here's what I've done with a lot of ideas from @Alexey Golyshev.

• This might be better asymptotically: In:= curve = FindFit[data, x/(b*Log[x])^2, {b}, x]; new = x/(b*Log[x])^2 /. curve Out= (5.45108297312 x)/Log[x]^2 – Daniel Lichtblau Mar 30 '16 at 2:10