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:


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.

  • $\begingroup$ 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. $\endgroup$ – Elem-Teach-w-Bach-n-Math-Ed Mar 28 '16 at 4:35
  • $\begingroup$ 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. $\endgroup$ – barrycarter Mar 28 '16 at 6:05
  • 1
    $\begingroup$ I get worried when I see phrases such as "one or more unique xxx". It's just not clear what that means. $\endgroup$ – Daniel Lichtblau Mar 29 '16 at 14:42
  • 1
    $\begingroup$ @DanielLichtblau Which is the unclear part? "One or more" or "unique"? Let me know and I'll clarify. $\endgroup$ – Elem-Teach-w-Bach-n-Math-Ed Mar 29 '16 at 18:26
  • 1
    $\begingroup$ (3) I do not much like the subject header. This is not a proof of anything. $\endgroup$ – Daniel Lichtblau Mar 30 '16 at 2:41

No counterexample.

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

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

{76.1693, Null}

twinPrimes = Table[
    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

enter image description here

  {#[[1]], Length@#[[2]]} & /@ twinPrimes,
  {#[[1]], Length@#[[3]]} & /@ twinPrimes
 AxesLabel -> {"prime number", "twins amount"},
 ImageSize -> Large

enter image description here

  • 2
    $\begingroup$ Technically, aren't these the primes under one million and not the first one million primes? $\endgroup$ – barrycarter Mar 28 '16 at 5:15
  • $\begingroup$ @barrycarter You are correct. These are primes under 1M (around 79K primes). Maybe later I will check more primes. $\endgroup$ – Alexey Golyshev Mar 28 '16 at 5:44
  • $\begingroup$ 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? $\endgroup$ – Elem-Teach-w-Bach-n-Math-Ed Mar 28 '16 at 5:51
  • $\begingroup$ @user3363795 Updated. Plot of the first 2K twinPrimes. $\endgroup$ – Alexey Golyshev Mar 28 '16 at 6:10
  • $\begingroup$ That plot is sick! I knew this was convincing evidence of the twin prime conjecture, but that is awesome! It appears nearly linear! $\endgroup$ – 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.

[Updated 3/29 18:21] Download and run this notebook: https://dl.dropboxusercontent.com/u/76769933/Twinprimeplotting.nb

to get this: ![enter image description here

Don't know how much further I can go with this. Need someone to stand on my shoulders and take this further!

  • $\begingroup$ Added best fit line and parabola. That parabola is so close to a line, there must be something going on here. I may post this on math.stackexchange just to see if someone can explain why this line holds so well. $\endgroup$ – Elem-Teach-w-Bach-n-Math-Ed Mar 30 '16 at 0:25
  • $\begingroup$ "so close to a line" - did you have a look at the coefficient of determination? $\endgroup$ – J. M. is in limbo Mar 30 '16 at 1:59
  • $\begingroup$ This might be better asymptotically: In[43]:= curve = FindFit[data, x/(b*Log[x])^2, {b}, x]; new = x/(b*Log[x])^2 /. curve Out[44]= (5.45108297312 x)/Log[x]^2 $\endgroup$ – Daniel Lichtblau Mar 30 '16 at 2:10
  • $\begingroup$ To understand where that suggested fit arose, take a series at infinity of the integral estimate I put in a comment under the original post. $\endgroup$ – Daniel Lichtblau Mar 30 '16 at 2:43
  • $\begingroup$ @J.M. Sorry, elem. math teacher with only a Bach. degree. Define "coefficient of determination", and how I would find it. $\endgroup$ – Elem-Teach-w-Bach-n-Math-Ed Mar 30 '16 at 5:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.