Just as a prime has a twin prime, there is a “consecutive twin prime” in a twin prime. For example, a set of twin primes whose difference is 4 so that the next twin prime of the twin prime {5,7} is {11,13} is defined here as “consecutive twin primes”. This time, too, prime numbers greater than 5 are considered.
The following is a program that searches for consecutive twin primes.
Twin prime numbers can be determined by the following four equations.
\begin{eqnarray}
n&=&6 s_1^2+(6 s_1-1)(m_1-1)\tag{1a} \\
n&=&6 s_2^2+6 s_2+1+(6 s_2+1)(m_2-1)\tag{1b} \\
n&=&6 s_3^2-2 s_3+(6 s_3-1)(m_3-1)\tag{1c}\\
n&=&6 s_4^2+2 s_4+(6 s_4+1)(m_4-1)\tag{1d}
\end{eqnarray}
\begin{equation}n=1,2,3\cdots\end{equation}
Give these four equations the same integer n. When there is no integer solution for s and m, a twin prime is born from the integer n.
In equation (1), n is expressed as n_t when there is no integer solution for s and m. Using n_t, the twin prime is given by equation (2).
\begin{equation}
{\rm Twin\ prime}= \left \{
\begin{array}{l}
6n_t-1 \\
6n_t+1
\end{array}
\right.\tag{2}
\end{equation}
\begin{equation}n_t: {\rm In\ Equation\ (1),{\it n}\ when\ there\ is\ no\ integer\ solution\ for\ {\it s}\ and\ {\it m}.}\end{equation}
Now consider (n_t + 1). If n_t is a twin prime number and (n_t + 1) is also a twin prime number, the difference is (6 (n_t + 1) -1) -(6 n_t + 1) = 4.
Here is a program that searches for consecutive twin primes. The frequency of consecutive twin primes is quite low, so we expanded the search range from n to (n + 1000). As a result, calculation time may be required. You may not be able to search at once. In that case, enter n again according to the instructions.
n = 1;
Clear[nt1, nt2, nd];
If[n > 0 && IntegerQ[n],
Do[{dat11 =
FindInstance[
6*s11^2 + (6*s11 - 1)*(m11 - 1) == n && 0 < s11 &&
0 < m11, {s11, m11}, Integers];
dat12 =
FindInstance[
6*s12^2 + 6*s12 + 1 + (6*s12 + 1)*(m12 - 1) == n && 0 < s12 &&
0 < m12, {s12, m12}, Integers];
dat13 =
FindInstance[
6*s13^2 - 2*s13 + (6*s13 - 1)*(m13 - 1) == n && 0 < s13 &&
0 < m13, {s13, m13}, Integers];
dat14 =
FindInstance[
6*s14^2 + 2*s14 + (6*s14 + 1)*(m14 - 1) == n && 0 < s14 &&
0 < m14, {s14, m14}, Integers]};
nn = n + 1;
{dat21 =
FindInstance[
6*s21^2 + (6*s21 - 1)*(m21 - 1) == nn && 0 < s21 &&
0 < m21, {s21, m21}, Integers];
dat22 =
FindInstance[
6*s22^2 + 6*s22 + 1 + (6*s22 + 1)*(m22 - 1) == nn && 0 < s22 &&
0 < m22, {s22, m22}, Integers];
dat23 =
FindInstance[
6*s23^2 - 2*s23 + (6*s23 - 1)*(m23 - 1) == nn && 0 < s23 &&
0 < m23, {s23, m23}, Integers];
dat24 =
FindInstance[
6*s24^2 + 2*s24 + (6*s24 + 1)*(m24 - 1) == nn && 0 < s24 &&
0 < m24, {s24, m24}, Integers]};
If[dat11 == {} && dat12 == {} && dat13 == {} && dat14 == {},
nt1 = n, nt1 = "There is no solution in this section."];
If[dat21 == {} && dat22 == {} && dat23 == {} && dat24 == {},
nt2 = nn, nt2 = "There is no solution in this section."];
If[dat11 == {} && dat12 == {} && dat13 == {} && dat14 == {} &&
nt1 > 0 && dat21 == {} && dat22 == {} && dat23 == {} &&
dat24 == {} && nt2 > 0, Break[]], {n, n, n + 1000}];
Print["====== The calculation results are shown below. ======"];
Print["n= ", n];
Print["nt(1)= ", nt1];
Print["nt(2)= ", nt2];
If[IntegerQ[nt1] && IntegerQ[nt2], nd = nt2 - nt1, nd = 0];
If[nd > 0, Print["Twin prime(1)= ", {6*nt1 - 1, 6*nt1 + 1}],
Print["Twin prime(1)= There are no twin primes in the interval,at \
(n)~(n+1000)."]];
If[nd > 0, Print["Twin prime(2)= ", {6*nt2 - 1, 6*nt2 + 1}],
Print["Twin prime(2)= There are no twin primes in the interval,at \
(n)~(n+1000)."]];
If[nd > 0,
Print["PrimeQ= ", {PrimeQ[6*nt1 - 1], PrimeQ[6*nt1 + 1],
PrimeQ[6*nt2 - 1], PrimeQ[6*nt2 + 1]}],
Print["PrimeQ= {-,-,-,-}"]];
If[nd > 0,
Print["If you want to find the next consecutive twin primes, start \
with n= ", nt1 + 1],
Print["If you want to continue, start with n= ", n + 1001]],
Print["***** ! Please enter a positive integer. *****"]];
This is an example of n = 1, but the calculation result is as follows.
====== The calculation results are shown below. ======
n= 1
nt(1)= 1
nt(2)= 2
Twin prime(1)= {5,7}
Twin prime(2)= {11,13}
PrimeQ= {True,True,True,True}
If you want to find the next consecutive twin primes, start with n= 2
n is the input value, and nt (1) is n that satisfies the condition of being a twin prime. nt (2) is n that satisfies the condition that 1 is added to nt (1) and it is a twin prime. The first twin prime is shown as {\rm Twin \;prime}\; (1) = {5,7}. The second twin prime is shown as {\rm Twin \;prime}\; (2) = {11,13}. The difference is 11-7 = 4, which is a continuous twin prime number. “{\rm PrimeQ}” has confirmed that the four numbers are prime. If you continue the calculation, it indicates n to start next.
Let’s check with a slightly larger number. Try n = 3141592654. This is not a very large number, but consecutive twin primes will not hit easily. I recalculated 11 times and finally found it.
====== The calculation results are shown below. ======
n= 3141602664
nt(1)= 3141603117
nt(2)= 3141603118
Twin prime(1)= {18849618701,18849618703}
Twin prime(2)= {18849618707,18849618709}
PrimeQ= {True,True,True,True}
If you want to find the next consecutive twin primes, start with n= 3141603118
The answers were {18849618701,18849618703} and {18849618707,18849618709}. It started from n = 3141592654, but it seems that there were over 10,000 Barren zones.
For reference, the following table shows the continuous twin prime numbers included in the interval from n = 1 to n = 101217. One thing you will notice immediately after looking at this table is that the last digit of n is limited to "2" or "7", except when n = 1. This is a matter of course if you think a little. By applying this, I was able to write a program that could calculate a little faster, but I was too late to notice.
\begin{array}{|c|c|c|}
\hline
n\;(=nt\;(1))& {\rm Twin \ prime\ (1)}&{\rm Twin \ prime \ (2)} \\
\hline
1 & \text{{5,7}} & \text{{11,13}} \\\
2 & \text{{11,13}} & \text{{17,19}}\\\
17 & \text{{101,103}} & \text{{107,109}}\\\
32 & \text{{191,193}} & \text{{197,199}}\\\
137 & \text{{821,823}} & \text{{827,829}}\\\
247 & \text{{1481,1483}} & \text{{1487,1489}} \\\
312 & \text{{1871,1873}} & \text{{1877,1879}} \\\
347 & \text{{2081,2083}} & \text{{2087,2089}}\\\
542 & \text{{3251,3253} }& \text{{3257,3259}} \\\
577 & \text{{3461,3463}} & \text{{3467,3469}}\\\
942 & \text{{5651,5653}} & \text{{5657,5659}}\\\
1572 & \text{{9431,9433}} & \text{{9437,9439}}\\\
2167 & \text{{13001,13003}} & \text{{13007,13009}}\\\
2607 & \text{{15641,15643}} & \text{{15647,15649}}\\\
2622 & \text{{15731,15733}} & \text{{15737,15739}}\\\
2677 & \text{{16061,16063}} & \text{{16067,16069}}\\\
3007 & \text{{18041,18043}} & \text{{18047,18049}}\\\
3152 & \text{{18911,18913}} & \text{{18917,18919}}\\\
3237 & \text{{19421,19423}} & \text{{19427,19429}}\\\
3502 & \text{{21011,21013}} & \text{{21017,21019}}\\\
3712 & \text{{22271,22273}} & \text{{22277,22279}}\\\
4217 & \text{{25301,25303}} & \text{{25307,25309}}\\\
5287 & \text{{31721,31723}} & \text{{31727,31729}}\\\
5807 & \text{{34841,34843}} & \text{{34847,34849}}\\\
7297 & \text{{43781,43783}} & \text{{43787,43789}}\\\
8557 & \text{{51341,51343}} & \text{{51347,51349}}\\\
9222 & \text{{55331,55333}} & \text{{55337,55339}}\\\
10497& \text{{62981,62983}} & \text{{62987,62989}}\\\
11202& \text{{67211,67213}} & \text{{67217,67219}}\\\
11582 & \text{{69491,69493}} & \text{{69497,69499}}\\\
12037 & \text{{72221,72223}} & \text{{72227,72229}}\\\
12877 & \text{{77261,77263}} & \text{{77267,77269}}\\\
13282 & \text{{79691,79693}} & \text{{79697,79699}}\\\
13507 & \text{{81041,81043}} & \text{{81047,81049}}\\\
13787 & \text{{82721,82723}} & \text{{82727,82729}}\\\
14802 & \text{{88811,88813}} & \text{{88817,88819}}\\\
16307 & \text{{97841,97843}} & \text{{97847,97849}}\\\
16522 & \text{{99131,99133}} & \text{{99137,99139}}\\\
16852 & \text{{101111,101113}} & \text{{101117,101119}}\\\
18307 & \text{{109841,109843}} & \text{{109847,109849}}\\\
19422 & \text{{116531,116533}} & \text{{116537,116539}}\\\
19882 & \text{{119291,119293}} & \text{{119297,119299}}\\\
20367 & \text{{122201,122203}} & \text{{122207,122209}}\\\
22577 & \text{{135461,135463}} & \text{{135467,135469}}\\\
24027 & \text{{144161,144163}} & \text{{144167,144169}}\\\
26212 & \text{{157271,157273}} & \text{{157277,157279}}\\\
27617 & \text{{165701,165703}} & \text{{165707,165709}}\\\
27807 & \text{{166841,166843}} & \text{{166847,166849}}\\\
28527 & \text{{171161,171163}} & \text{{171167,171169}}\\\
31272 & \text{{187631,187633}} & \text{{187637,187639}}\\\
32477 & \text{{194861,194863}} & \text{{194867,194869}}\\\
32622 & \text{{195731,195733}} & \text{{195737,195739}}\\\
33582 & \text{{201491,201493}} & \text{{201497,201499}}\\\
33637 & \text{{201821,201823}} & \text{{201827,201829}}\\\
36227 & \text{{217361,217363}} & \text{{217367,217369}}\\\
37557 & \text{{225341,225343}} & \text{{225347,225349}}\\\
40007 & \text{{240041,240043}} & \text{{240047,240049}}\\\
40617 & \text{{243701,243703}} & \text{{243707,243709}}\\\
41267 & \text{{247601,247603}} & \text{{247607,247609}}\\\
41332 & \text{{247991,247993}} & \text{{247997,247999}}\\\
42977 & \text{{257861,257863}} & \text{{257867,257869}}\\\
43402 & \text{{260411,260413}} & \text{{260417,260419}}\\\
44447 & \text{{266681,266683}} & \text{{266687,266689}}\\\
44802 & \text{{268811,268813}} & \text{{268817,268819}}\\\
46007 & \text{{276041,276043}} & \text{{276047,276049}}\\\
47457 & \text{{284741,284743}} & \text{{284747,284749}}\\\
47547 & \text{{285281,285283}} & \text{{285287,285289}}\\\
49052 & \text{{294311,294313}} & \text{{294317,294319}}\\\
49312 & \text{{295871,295873}} & \text{{295877,295879}}\\\
49912 & \text{{299471,299473}} & \text{{299477,299479}}\\\
50082 & \text{{300491,300493}} & \text{{300497,300499}}\\\
50332 & \text{{301991,301993}} & \text{{301997,301999}}\\\
54357 & \text{{326141,326143}} & \text{{326147,326149}}\\\
55737 & \text{{334421,334423}} & \text{{334427,334429}}\\\
56822 & \text{{340931,340933}} & \text{{340937,340939}}\\\
57732 & \text{{346391,346393}} & \text{{346397,346399}}\\\
57997 & \text{{347981,347983}} & \text{{347987,347989}}\\\
59042 & \text{{354251,354253}} & \text{{354257,354259}}\\\
59817 & \text{{358901,358903}} & \text{{358907,358909}}\\\
60202 & \text{{361211,361213}} & \text{{361217,361219}}\\\
62542 & \text{{375251,375253}} & \text{{375257,375259}}\\\
64782 & \text{{388691,388693}} & \text{{388697,388699}}\\\
64927 & \text{{389561,389563}} & \text{{389567,389569}}\\\
65377 & \text{{392261,392263}} & \text{{392267,392269}}\\\
65802 & \text{{394811,394813}} & \text{{394817,394819}}\\\
66257 & \text{{397541,397543}} & \text{{397547,397549}}\\\
66292 & \text{{397751,397753}} & \text{{397757,397759}}\\\
67022 & \text{{402131,402133}} & \text{{402137,402139}}\\\
67127 & \text{{402761,402763}} & \text{{402767,402769}}\\\
\text{Continue} & \text{Continue} &\text{Continue}\\
\hline
\end{array}
\begin{array}{|c|c|c|}
\hline
n\; (=nt\;(1))& {\rm Twin \ prime\ (1)}&{\rm Twin \ prime \ (2)}\\
\hline
\text{Continued} & \text{Continued} & \text{Continued} \\\
68672 & \text{{412031,412033}} & \text{{412037,412039}}\\\
69842 & \text{{419051,419053}} & \text{{419057,419059}}\\\
70142 & \text{{420851,420853}} & \text{{420857,420859}}\\\
71207 & \text{{427241,427243}} & \text{{427247,427249}}\\\
73762 & \text{{442571,442573}} & \text{{442577,442579}}\\\
74057 & \text{{444341,444343}} & \text{{444347,444349}}\\\
75422 & \text{{452531,452533}} & \text{{452537,452539}}\\\
77242 & \text{{463451,463453}} & \text{{463457,463459}}\\\
77527 & \text{{465161,465163}} & \text{{465167,465169}}\\\
77912 & \text{{467471,467473}} & \text{{467477,467479}}\\\
78347 & \text{{470081,470083}} & \text{{470087,470089}}\\\
79502 & \text{{477011,477013}} & \text{{477017,477019}}\\\
81762 & \text{{490571,490573}} & \text{{490577,490579}}\\\
82602 & \text{{495611,495613}} & \text{{495617,495619}}\\\
83372 & \text{{500231,500233}} & \text{{500237,500239}}\\\
85102 & \text{{510611,510613}} & \text{{510617,510619}}\\\
86467 & \text{{518801,518803}} & \text{{518807,518809}}\\\
89407 & \text{{536441,536443}} & \text{{536447,536449}}\\\
89462 & \text{{536771,536773}} & \text{{536777,536779}}\\\
89917 & \text{{539501,539503}} & \text{{539507,539509}}\\\
91527 & \text{{549161,549163}} & \text{{549167,549169}}\\\
93202 & \text{{559211,559213}} & \text{{559217,559219}}\\\
93902 & \text{{563411,563413}} & \text{{563417,563419}}\\\
95007 & \text{{570041,570043}} & \text{{570047,570049}}\\\
95442 & \text{{572651,572653}} & \text{{572657,572659}}\\\
97652 & \text{{585911,585913}} & \text{{585917,585919}}\\\
99137 & \text{{594821,594823}} & \text{{594827,594829}}\\\
99612 & \text{{597671,597673}} & \text{{597677,597679}}\\\
101217 & \text{{607301,607303}} & \text{{607307,607309}}\\\
\text{Omitted below} & \text{Omitted below} &\text{Omitted below}\\
\hline
\end{array}
<<------------------------------------>>
I have posted five reports so far, including this one. All content is related to prime numbers. The target was limited to prime numbers of 5 or more. If you look at this alone, you may feel like I’m avoiding "2" and "3". I don’t hate "2" and "3". I respect this number, "2" and "3".
I used four equations in these reports.
\begin{eqnarray}
n&=&6 s_1^2+(6 s_1-1)(m_1-1) \\
n&=&6 s_2^2+6 s_2+1+(6 s_2+1)(m_2-1) \\
n&=&6 s_3^2-2 s_3+(6 s_3-1)(m_3-1)\\
n&=&6 s_4^2+2 s_4+(6 s_4+1)(m_4-1)
\end{eqnarray}
This equation consists only of "1", "2", "3" and "\tfrac{1}{2}". "2" and "3" are both prime numbers. However, "2" and "3" are not only elements of prime numbers, but they feel like numbers with a special role beyond that. I feel that "2" and "3" make rules to determine prime numbers greater than 5.
Also, in the process of deriving this formula, I could get a glimpse of a geometrically simple structure. This geometrical structure was found in the part related to the prime number of (6n + 1) type and was not recognized in (6n-1) type. I felt the existence of symmetry and asymmetry.
I am not a mathematician, so there are limits to the pursuit of these. (I worked as an optical engineer for 50 years and now I retire.)