0

If one wants to calculate the twin primes, one method is a kind of expanded sieve of eratosthenes. Stepwise one writes all numbers up to a primorial $p_k\# = \prod \limits_{i=1}^k p_i$ and deletes (after deletion of all even numbers and all numbers divisible by 3) all numbers which contains $p_k$ as a divider and their associate numbers. All numbers are according to their construction of the form $6n\pm 1$, and the two numbers for a specific $n$ are associated to each other.

So one gets the following numbers

$3\#: 1; 5\\ 5\#: 1; 11/13; 17/19; 29\\ 7\#: 1; 11/13; 17/19; 29/31; \dots\\ \vdots$

If one wants now to calculate the number $N_k$ of numbers that are left after the k-th deletion, one gets

$N_k = p_k\# \prod \limits_{i=2}^k (1-\frac{2}{p_i})$

My question is now, why is this true?

buja
  • 107
  • 1
    I do not understand the part "for calculating twin primes" in the title. Do you continue the sieve until only the (large enough) twin primes will remain ? – Peter Sep 04 '22 at 16:40
  • 2
    How do you define "associate numbers"? Are the associate numbers of $n$ equal to $n\pm 2$? – Steven Clark Sep 04 '22 at 16:46
  • 1
    @Peter: because this sieve is analog to the eratosthenes sieve, you get only the twin primes less then $p_{k+1}^2$, but the twin primes less then $p_k$ are deleted. – buja Sep 04 '22 at 16:56
  • OK, this makes sense. – Peter Sep 04 '22 at 16:58
  • @StevenClark: I define the „associate numbers“ in the text above: „All numbers are according to their construction of the form $6n\pm 1$, and the two numbers for a specific $n$ are associated to each other.“ so, for instance, 5 is associated to 7 and 7 to 5 (here is $n=1$) or 23 is associated to 25 and 25 to 23 (here is $n=4$). – buja Sep 04 '22 at 16:59
  • I still don't understand deleting "all numbers which contains $p_k$ as a divider and their associate numbers". My initial thought was why are $23$ and $25$ not on your list for $7#$ where $k=4$ and $p_k=7$? Neither is divisible by $2$, $3$, or $p_k=7$. They are associate numbers of each other of the form $6 n\pm 1$, but what does this have to do with deleting associate numbers of multiples of $p_k=7$? – Steven Clark Sep 04 '22 at 22:38
  • 1
    Then I thought perhaps you really meant "all numbers which contains $p_i$ as a divider (where $p_i\le p_k$) and their associate numbers", but this doesn't account for deleting the numbers $167$ and $169$ from the list for $7#$ where $167\in\mathbb{P}$ and $169=13^2$, so I still don't understand your algorithm. – Steven Clark Sep 04 '22 at 22:38
  • 1
    Also, your formula may be consistent with your algorithm, but neither one of them is generally accurate for calculating twin primes which was illustrated in my previous comment. – Steven Clark Sep 05 '22 at 03:01
  • @StevenClark: thank you for your interest. the pair (23/25) isn‘t in the list for 7# because it was deleted in 5#. The pair (167/169) instead is in the list for 7# because 167 and 169 have both no dividers less then 7. A better understanding for the algorithm is, that one not only delete numbers and their associate, one delete an arithmetic progression. For instance instead of deleting 5 and 7 you are deleting all numbers of $5#\cdot m +5$ and $5#\cdot m +7$. This is the or has an impact for higher $k$. Maybe this idea helps. – buja Sep 05 '22 at 04:32
  • 1
    Thanks for the feed back. Your statement "all numbers which contains $p_k$ as a divider and their associate numbers" was misleading because as I said above I believe your algorithm is actually "all numbers which contains $p_i$ as a divider (where $p_i≤p_k$) and their associate numbers". Your algorithm does not filter out all numbers that are not twin-primes in the interval $p_k+2<x\le p_k#$, so unfortunately your formula for $N_k$ (assuming it always exactly matches your algorithm) is not accurate for predicting the number of twin-primes in the interval $p_k+2<x\le p_k#$. – Steven Clark Sep 05 '22 at 14:46

1 Answers1

1

This may not be a complete answer but is too long for a comment and perhaps provides some insight into the relationship between the twin-prime sieve and the sieve of Eratosthenes.


For the sieve of Eratosthenes the number of elements left after removing all primes up to $p_k$ and their multiples from the set $\left\{1,2,3,...p_k\#\right\}$ is given by

$$E_k=p_k\#\ \prod\limits_{i=1}^k \left(1-\frac{1}{p_i}\right)=\prod\limits_{i=1}^k \left(p_i-1\right)\tag{1}$$

which can be written in terms of the more general Euler totient function

$$\phi(n)=n \prod\limits_{p|n}\left(1-\frac{1}{p}\right)\tag{2}$$

as

$$E_k=\phi\left(p_k\#\right).\tag{3}$$


OEIS entry A066264 gives the number of composites < $p_k\#$ with all prime factors > $p_k$ which corresponds to

$$E_k-1-\left(\pi\left(p_k\#\right)-\pi\left(p_k\right)\right).\tag{4}$$


For the twin-prime sieve the number of elements left after removing all multiples of primes up to $p_k$ and their associates from the set $\left\{1,2,3,...p_k\#\right\}$ is given by

$$N_k=p_k\#\ \prod\limits_{i=2}^k \left(1-\frac{2}{p_i}\right)=2 \prod\limits_{i=2}^k \left(p_i-2\right)\tag{5}$$

which can be written in terms of the more general function

$$\phi_2(n)=n \prod\limits_{p>2\,\land\,p|n}\left(1-\frac{2}{p}\right)\tag{6}$$

as

$$N_k=\phi_2\left(p_k\#\right).\tag{7}$$


I believe $\phi_2(n)$ is related to $\phi(n)$ as follows

$$\phi_2(n)=\sum\limits_{d|n} (-1)^{d-1}\ \mu(rad(d))\ \phi\left(\frac{n}{d}\right)\tag{8}$$

where $\mu(n)$ is the Möbius function and $rad(n)$ is the radical of an integer, so $N_k$ can be computed by evaluating formula (8) above for $\phi_2(n)$ at $n=p_k\#$ which is square-free and therefore $rad(d)=d$ for this case. So $N_k$ is related to $E_k$ as follows:

$$N_k=E_k+\sum\limits_{d>1\,\land\,d\,|\,p_k\#} (-1)^{d-1}\ \mu(d)\ \phi\left(\frac{p_k\#}{d}\right)\tag{9}$$


Note that $\mu(rad(n))=(-1)^{\nu(n)}$ where $\nu(n)$ is the number of distinct primes dividing $n$ (see OEIS entry A001221), so formula (8) above can also be evaluated as follows.

$$\phi_2(n)=\sum\limits_{d|n} (-1)^{d-1}\ (-1)^{\nu(d)}\ \phi\left(\frac{n}{d}\right)\tag{10}$$


When evaluated at $n=p_k\#$, formula (10) above can be simplified to

$$N_k=\phi_2(p_k\#)=2 \sum\limits_{d\,\left|\,\frac{p_k\#}{2}\right.} (-1)^{\nu(d)}\ \phi\left(\frac{\frac{p_k\#}{2}}{d}\right)\tag{11}$$

which combines the contributions of odd and even related divisors $d$ and $2 d$ since

$$(-1)^{2 d-1}\ (-1)^{\nu(2 d)}\ \phi\left(\frac{n}{2 d}\right)=(-1)^{d-1}\ (-1)^{\nu(d)}\ \phi\left(\frac{n}{d}\right)\tag{12}$$

when $(n \bmod 4)=2$ which is the case for $n=p_k\#$.


When $k>1$ formula (11) above can be simplified further as follows

$$N_k=\phi_2(p_k\#)=2 \sum\limits_{d\,\left|\,\frac{p_k\#}{6}\right.} (-1)^{\nu(d)}\ \phi\left(\frac{\frac{p_k\#}{6}}{d}\right)\tag{13}$$


The following table provides insight into the relationship between formula (13) above and the operation of the twin-prime sieve where $k=4$, $p_k=7$, $p_k\#=210$, $m=\frac{pk\#}{6}=35$, $d$ is a divisor of $m$, and $c(k,d)$ in the last column represents the number of times the divisor $d$ appears in a pair of associates when the smallest prime dividing the related associate is greater than $p_k$.

$$\begin{array}{ccc} d & 2 (-1)^{\nu (d)} \phi \left(\frac{m}{d}\right) & (-1)^{\nu (d)} c(k,d) \\ 1 & 48 & \text{-} \\ 5 & -12 & -12 \\ 7 & -8 & -8 \\ 35 & 2 & 2 \\ \end{array}$$

The first row in the Table above removes all primes up to $p_k$ and their multiples equivalent to the sieve of Eratosthenes. What remains is to remove the associates of primes $p_3=5$ up to $p_k$ and their multiples which have no prime divisor $\le p_k$ which is accomplished by the remaining rows in the table. The second row in the table removes the associates of $p_3=5$ and it's multiples which have no prime divisor $\le p_k$. The third row in the table removes the associates of $p_4=7$ and it's multiples which have no prime divisor $\le p_k$. The last row in the table compensates for the fact that two associates were removed twice, once by the divisor $p_3=5$, and a second time by the divisor $p_4=7$.

Steven Clark
  • 8,744
  • thank you for your answer. i try to ask my question in another way: the number of elements that are left in the twin prime sieve after removing all multiples of primes up to $p_k$ and their associates is without a doubt $N_k=p_k# \frac{1}{3}\prod \limits_{i=3}^k (1-\frac{x}{p_i})$ with $1<x\leq 2$. my question is why $x=2$? (the case $x=1$ for the erathostenes sieve is clear.) – buja Sep 13 '22 at 08:51
  • Why do you indicate $1<x\leq 2$? The formula is not correct for $1<x<2$, only for $x=2$, and since $(1-\frac{2}{p_2})=(1-\frac{2}{3})=\frac{1}{3}$ then $N_k=p_k# \frac{1}{3}\prod \limits_{i=3}^k (1-\frac{2}{p_i})=p_k# \prod \limits_{i=2}^k (1-\frac{2}{p_i})$. Granted my answer above assumes your formula is correct (and then shows how to derive it from $E_k$ associated with the sieve of Eratosthenes), but why do you ask why your formula is correct when you say you have no doubt it is correct? If you have no doubt it is correct, then presumably you already have a proof of it's correctness. – Steven Clark Sep 13 '22 at 15:34
  • your answer is only another notation not a proof. I doubt about the correctness of the formula because its validity is so sophisticated if you follow the removing of single $p_i$ and their multiples. And this is what i want to understand. I even think, that it is better to write $N_k=p_k#\frac{1}{3}\prod \limits_{i=3}^k (1-\frac{x_i}{p_i}) \text{ with } 1<x_i \leq 2$. In the Eratosthenes sieve you can see the correctness of $x_i = 1$ with the inclusion–exclusion principle. For the twin prime sieve you can't use this the same way. – buja Sep 14 '22 at 06:15
  • @Buja I've verified my formula (8) up to $n=10,000$, and hence I believe my formulas are correct just as you believe your formula is correct, but neither of seem to have a rigorous proof of either formula. – Steven Clark Sep 14 '22 at 15:49
  • @buja Why do you continue to write $N_k=p_k#, \frac{1}{3}\prod \limits_{i=3}^k \left(1-\frac{x_i}{p_i}\right)$ with $1<x_i \leq 2$?, For example for $k=3$ and $x_i=\frac{3}{2}$, clearly $p_k#, \frac{1}{3}\prod \limits_{i=3}^k \left(1-\frac{x_i}{p_i}\right)=30, \frac{1}{3} \left(1-\frac{3/2}{5}\right)=7$ whereas $N_k=p_k# \prod\limits_{i=2}^k \left(1-\frac{2}{p_i}\right)=30 \left(1-\frac{2}{3}\right) \left(1-\frac{2}{5}\right)=6$. – Steven Clark Sep 14 '22 at 15:49
  • for small numbers $x_i =2$ is true, i know. with a little programme i verified this for $i\leq 10$, this is until $29#$. but this is not a proof. thats why i continue writing the formula with $x_i$. you can‘t proof the correctness of $x_i =2$ for all $i$ by calculation. – buja Sep 14 '22 at 16:02
  • @buja I verified my formula (11) is equivalent to your formula up to $p_{20}#$ (using $x_i=2$). My formula (13) is directly related to the operation of the twin-prime sieve as described in my updated answer above, so assuming your formula is correct for all $p_k#$, perhaps it can be proven by relating it to my formula (13). – Steven Clark Sep 24 '22 at 21:02