# Some Properties and Algorithms for Twin Primes
## 2 Twin Primes
In summary, the values of \(k\) which are in (6) but not in (9) (as for example 4) generate a prime in \(2k-1\) and a composite number in \(2k+1\). The values which are in (9) but not in (6) (as for example 5) generate, instead, a composite number in \(2k-1\) and a prime number in \(2k+1\). The values of \(k\) that are in both sequences (as for example 17) generate composite numbers in both \(2k-1\) and \(2k+1\). Finally, there are values of \(k\) which are neither in (6) nor in (9). These values of \(k\) generate prime numbers in both columns of the table and, therefore, generate twins. To understand how many twin primes there are, we must find how many numbers are missing in the union of (6) and (9). Since we are interested in twin primes and not prime numbers, we merge the matrices (6) and (9) achieving the following matrix, which will allow us to identify twin prime numbers  
\[C=\left( \begin{array}{cccccccccccc}4&5&7&8&10&11&13&14&16&17&19&\ldots\\ 7&8&12&13&17&18&22&23&27&28&32&\ldots\\ 10&11&17&18&24&25&31&32&38&39&45&\ldots\\ 13&14&22&23&31&32&40&41&49&50&58&\ldots\\ 16&17&27&28&38&39&49&50&60&61&71&\ldots\\ 19&20&32&33&45&46&58&59&71&72&84&\ldots\\ \ldots&\ldots&\ldots&\ldots&\ldots&\ldots&\ldots&\ldots&\ldots&\ldots&\ldots& \ldots\\ \end{array} \right) \tag{10}\]  
Indeed, any number that does not fit in \(C\) (as for example 6) corresponds to a value of \(k\) which gives us a pair of twins. Let us call \(r_{n}\) the complement rows. In other words  
\[r_{1}=1,2,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75, 78,\ldots\  
\[r_{n}=\left[\cup_{i=1}^{n+1}\{i\}\right]\cup\left[\cup_{i=1}^{n-1}\{(2i+1)n\pm \gamma_{i-1}\},\gamma_{i-1}=i-1,i=n-1,\ \forall n\in\mathbb{N}\right]. \tag{12}\]  
**Definition. **: _Given the sequence \(r_{i}\), we call the first hole of \(r_{i}\) and denote it by \(\dot{r}_{i}\) the first missing element so that \(r_{i}\) does not coincide with \(\mathbb{N}\)._  
**Theorem of the localizations of the first hole. ** _Given the sequence \(r_{n}\), we have that \(\dot{r}_{n}=3n+1\ \forall n\in\mathbb{N}\)._  
Proof. : We want to show that \(\dot{r}_{n+1}=3+\dot{r}_{n}\). Let  
\[P(n):\dot{r}_{n}=3n+1.\]  
The base case  
\[P(1)=\dot{r}_{1}=4\]  
is true, as you can verify. For the inductive step, we assume that \(P(n)\) is true for some integer \(n\geq 1\) and use this to prove that \(P(n+1)\) is true. We have that  
\[P(n+1)=3(n+1)+1=3n+1+3=\dot{r}_{n}+3.\]  
Then, we may conclude that \(P(n)\) is true for all integers \(n\geq 1\). \(\square\)  
It is easy to deduce the following result. **Corollary. **: _For the sequences \(r_{i}\) is valid that \(\underset{n\rightarrow+\infty}{lim}r_{n}=\mathbb{N}\)._  
Proof. : From the theorem of the localizations of the first hole, we have that \(\dot{r}_{n+1}=3+\dot{r}_{n}\ \forall n\in\mathbb{N}\). Therefore,  
\[\underset{n\rightarrow+\infty}{\lim}\dot{r}_{n}=\underset{n\rightarrow+ \infty}{\lim}3n+1=+\infty\]  
and this means that \(r_{n}\rightarrow\mathbb{N}\). \(\square\)  
**Definition. **: _We define the jump extension \(\dot{r}_{n}^{e}\) as the number of missing elements in \(r_{n}\) between two successive subsequences starting from \(\dot{r}_{n}\). That is_  
\[\dot{r}_{n}^{e}=[(2k_{n}+1)m+(n-1)]-[(2k_{n}+1)m-(n-1)],\ \forall n\in \mathbb{N}.\]  
**Definition. **: _We call the set of jumps for level \(n\) the set \(r_{n}^{j}\) defined as_  
\[r_{n}^{j}=\mathbb{N}/r_{n}.\]  
For example, \(r_{1}^{j}=\{4,5,7,8,10,11,\ldots\}\). **Definition. **: _We define jump size \(\dot{r}_{n}^{s}\) the distance between a subsequence \(r_{n}\) and its successive. In other words, the distance between one hole and the successive corresponding one_  
\[\dot{r}_{n}^{s}=\{[(2k_{n}+1)m+(n-1)]+4\}-\{[(2k_{n}+1)m-(n-1)]+1\}. \tag{13}\]  
We observe that the jump size of \(r_{1}\) is 3. In fact, \(\dot{r}_{1}^{s}=7-4=10-7=\ldots=3\). Instead, for \(r_{2}\) is 5. Indeed, \(\dot{r}_{2}^{s}=12-7=5\). From (12) it is possible to verify that the following is valid  
**Theorem of the invariance of the jump extension.