Message Boards Message Boards

Twin prime conjecture data collection

Posted 6 years ago

I wanted to share some code I used in Mathematica that could be useful to other people who study the gaps between prime numbers or for anyone interested in proving the twin prime conjecture.

a = Table[Prime[i], {i, 2, 10000000}];
b = Table[a[[i + 1]] - a[[i]], {i, Length[a] - 1}];
c = Tally[b];
d = Sort[c, #1[[1]] < #2[[1]] &];
e = Transpose[d];
BarChart[e[[2]], ChartLabels -> e[[1]]]

The first line of code is where you input the start Nth prime and the last Nth prime that you will use for this analysis. The second line of code generates a list of gaps starting with the 3rd prime minus the 2nd prime (5 - 3 = 2). for every gap of 2 found, there exists a pair of twin primes on either side of that gap. The third line accumulates the total number of appearances for each unique gap. The fourth line of code is a sort needed to prepare the data for visualization with low numbers to the left. The fifth line of code is needed to make the list structure orthogonal to BarChart with chart labels.

If you do mod 10 to each of the labels on the bottom, you will have the sequence

{2,4,6,8,0,2,4,6,8,0,2,4,6,8,0,2,4,6,8,0,2,4,6,8,0,....}

you can then use a similar technique to arrive at a BarChart for the labels

{2,4,6,8,0}

You can then use this information to make a model of a weighted markov chain that will predict the probability that any prime ending with

{1,3,7,9}

will have a prime above or below ending with

{1,3,7,9}

I believe that there is evidence here to prove the twin prime conjecture but unfortunately it is not the form of proof that most mathematicians are looking for. The proof of infinite prime numbers is really only a proof that the prime numbers are not finite. it is not a proof of infinity directly. currently no one will accept that the total number of twin primes is finite or infinite. All you have to do is look at the graph. The accuracy of the model can only increase with the amount of prime numbers you put into it. therefor it is convergent on PDF of all prime gaps. If the twin primes simply dried up beyond 179424673, then you would see the BarChart making radical changes in shape that are completely inconsistent with all the empirical data collected up to 179424673. You can shrink the window size and observe the same pattern in the distribution of gaps.

Attachment

Attachments:
POSTED BY: John Doe
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract