A Sieve for Twin Primes
Jon S. Birdsey, Geza Schay

TL;DR
This paper introduces a new sieve algorithm for twin primes, provides heuristic estimates for their counts, and compares these estimates with actual data, offering a simpler correction factor than previous methods.
Contribution
The paper presents a novel sieve algorithm for twin primes and introduces a simpler heuristic correction factor for estimating their distribution.
Findings
The sieve algorithm effectively generates twin primes.
Heuristic estimates closely match actual counts up to 8009.
A new correction factor simplifies twin prime distribution estimates.
Abstract
We present an algorithm analogous to the sieve of Eratosthenes that produces the list of twin primes. Next, we count the number of twin primes resulting from the construction with two different heuristic arguments. The first method is essentially the same as the one in Hardy and Wright. However, the second method is novel. It results in the same asymptotic formula but it uses a simpler correction factor than theirs. Though we have no theory for the accuracy of our estimates, we compute them both without and with the correction factor and they turn out to be close to the actual counts up to 8009.
| 5 | 7 |
| 11 | 13 |
| 17 | 19 |
| 23 | 25 |
| 29 | 31 |
| 11 | 13 | 17 | 19 | 29 | 31 |
| 41 | 43 | 47 | 49 | 59 | 61 |
| 71 | 73 | 77 | 79 | 89 | 91 |
| 101 | 103 | 107 | 109 | 119 | 121 |
| 131 | 133 | 137 | 139 | 149 | 151 |
| 161 | 163 | 167 | 169 | 179 | 181 |
| 191 | 193 | 197 | 199 | 209 | 211 |
| 11 | 13 | 17 | 19 | 29 | 31 | 41 | 43 | 59 | 61 | 71 | 73 | 101 | 103 | 107 | 109 | 137 | 139 | 149 | 151 | 167 | 169 | 179 | 181 | 191 | 193 | 197 | 199 | 209 | 211 |
| 221 | 223 | 227 | 229 | 239 | 241 | 251 | 253 | 269 | 271 | 281 | 283 | 311 | 313 | 317 | 319 | 347 | 349 | 359 | 361 | 377 | 379 | 389 | 391 | 401 | 403 | 407 | 409 | 419 | 421 |
| 431 | 433 | 437 | 439 | 449 | 451 | 461 | 463 | 479 | 481 | 491 | 493 | 521 | 523 | 527 | 529 | 557 | 559 | 569 | 571 | 587 | 589 | 599 | 601 | 611 | 613 | 617 | 619 | 629 | 631 |
| 641 | 643 | 647 | 649 | 659 | 661 | 671 | 673 | 689 | 691 | 701 | 703 | 731 | 733 | 737 | 739 | 767 | 769 | 779 | 781 | 797 | 799 | 809 | 811 | 821 | 823 | 827 | 829 | 839 | 841 |
| 851 | 853 | 857 | 859 | 869 | 871 | 881 | 883 | 899 | 901 | 911 | 913 | 941 | 943 | 947 | 949 | 977 | 979 | 989 | 991 | 1007 | 1009 | 1019 | 1021 | 1031 | 1033 | 1037 | 1039 | 1049 | 1051 |
| 1061 | 1063 | 1067 | 1069 | 1079 | 1081 | 1091 | 1093 | 1109 | 1111 | 1121 | 1123 | 1151 | 1153 | 1157 | 1159 | 1187 | 1189 | 1199 | 1201 | 1217 | 1219 | 1229 | 1231 | 1241 | 1243 | 1247 | 1249 | 1259 | 1261 |
| 1271 | 1273 | 1277 | 1279 | 1289 | 1291 | 1301 | 1303 | 1319 | 1321 | 1331 | 1333 | 1361 | 1363 | 1367 | 1369 | 1397 | 1399 | 1409 | 1411 | 1427 | 1429 | 1439 | 1441 | 1451 | 1453 | 1457 | 1459 | 1469 | 1471 |
| 1481 | 1483 | 1487 | 1489 | 1499 | 1501 | 1511 | 1513 | 1529 | 1531 | 1541 | 1543 | 1571 | 1573 | 1577 | 1579 | 1607 | 1609 | 1619 | 1621 | 1637 | 1639 | 1649 | 1651 | 1661 | 1663 | 1667 | 1669 | 1679 | 1681 |
| 1691 | 1693 | 1697 | 1699 | 1709 | 1711 | 1721 | 1723 | 1739 | 1741 | 1751 | 1753 | 1781 | 1783 | 1787 | 1789 | 1817 | 1819 | 1829 | 1831 | 1847 | 1849 | 1859 | 1861 | 1871 | 1873 | 1877 | 1879 | 1889 | 1891 |
| 1901 | 1903 | 1907 | 1909 | 1919 | 1921 | 1931 | 1933 | 1949 | 1951 | 1961 | 1963 | 1991 | 1993 | 1997 | 1999 | 2027 | 2029 | 2039 | 2041 | 2057 | 2059 | 2069 | 2071 | 2081 | 2083 | 2087 | 2089 | 2099 | 2101 |
| 2111 | 2113 | 2117 | 2119 | 2129 | 2131 | 2141 | 2143 | 2159 | 2161 | 2171 | 2173 | 2201 | 2203 | 2207 | 2209 | 2237 | 2239 | 2249 | 2251 | 2267 | 2269 | 2279 | 2281 | 2291 | 2293 | 2297 | 2299 | 2309 | 2311 |
| p | Actual | Equation 7 | r | Equation 15 |
|---|---|---|---|---|
| 101 | 404 | 394 | 1.03975 | 410 |
| 199 | 1150 | 1143 | 1.01694 | 1162 |
| 307 | 2288 | 2332 | 0.99588 | 2323 |
| 401 | 3578 | 3618 | 0.99050 | 3683 |
| 503 | 5170 | 5263 | 0.98667 | 5193 |
| 601 | 6974 | 7103 | 0.98036 | 6964 |
| 701 | 8946 | 9186 | 0.97882 | 8992 |
| 797 | 11128 | 11426 | 0.97493 | 11140 |
| 907 | 13674 | 14223 | 0.97287 | 13837 |
| 1009 | 16556 | 17053 | 0.97038 | 16548 |
| 1999 | 53556 | 55038 | 0.96144 | 52916 |
| 3001 | 107610 | 111342 | 0.95734 | 106592 |
| 4001 | 176914 | 184081 | 0.95390 | 175595 |
| 5003 | 261086 | 272412 | 0.95202 | 259343 |
| 6007 | 358978 | 375972 | 0.95005 | 357192 |
| 7001 | 469528 | 492326 | 0.94945 | 467437 |
| 8009 | 594636 | 625062 | 0.94773 | 592388 |
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAnalytic Number Theory Research · History and Theory of Mathematics · Mathematics and Applications
A Sieve for Twin Primes
Jon S. Birdsey and Geza Schay
Abstract
We present an algorithm analogous to the sieve of Eratosthenes that produces the list of twin primes.
Next, we count the number of twin primes resulting from the construction with two different heuristic arguments. The first method is essentially the same as the one in [HW]. However, the second method is novel. It results in the same asymptotic formula but it uses a simpler correction factor than [HW].
Though we have no theory for the accuracy of our estimates, we compute them both without and with the correction factor and they turn out to be close to the actual counts up to .
A famous unproved problem in number theory is the twin prime conjecture, which says that the number of twin primes, that is, primes that differ from each other by 2, is infinite. A stronger form, still not completely proved, due to Hardy and Wright (See [HW], p. 372.) gives an asymptotic formula for the number of twin primes under a real number as
In this paper we present a new approach to the problem by proposing a new kind of sieve, which produces the twin primes, and we use it to count their number under with two different heuristic arguments. The first method is essentially the same as the one in [HW]. However, the second method is novel. It is based on Dirichlet’s theorem on primes in arithmetic progressions (see e.g. [A], p. 146), and results in the same asymptotic formula as the one given in [HW], but it uses a simpler correction factor than theirs. Though we have no theory for the accuracy of our estimates, we compute them, both without and with the correction factor, and they turn out to be close to the actual counts up to .
1 The Double Sieve.
The following property of twin primes is well known:
Lemma 1
All twin primes greater than are of the form and for the same
Proof. Clearly, the numbers greater than congruent to 0,2,3, and are composite, and so all primes greater than must be of the form Now for the same the two numbers differ by 2, but for and differ by more than 2.
Since we want to study twin primes and those are of the form , we sift the set of such numbers. For the sake of convenience we call the two numbers , for any positive integer twins of each other, regardless of whether they are primes or not.
For any prime let denote the set of all positive integers of the form obtained by sifting out those with prime factors less than together with their twins.
We construct these sets successively as follows.
First, because this is the set of all positive numbers with prime factors However, with an eye on the upcoming construction of we write as a table of two columns and five rows (see Table 1.), with the numbers in the first column and the numbers in the second column for and consider the rest of as the numbers of this table for Here 111 -primorial
To construct , we proceed as follows: In , we delete the multiples of 5, that is, 5 and 25 (shown in dark orange) and the twins of these multiples, that is, 7 and 23.(shown in light orange), and in we delete all the numbers in the residue classes of these four numbers Notice that, apart from the number 5, among the deleted residue classes only those of 7 and 23 contain primes, and, except for 7, these are nontwin primes, because their twins are multiples of 5.
has 5 rows and 2 columns, and in each column we delete 2 numbers. So, we have undeleted numbers left. We write a table for (see Table 2) consisting of six columns headed by the six numbers that remained undeleted in and seven rows that are obtained by continuing the residue classes of the headers of the columns. is the set of the numbers of this table for Here
To construct , we proceed similarly: In , we delete the multiples of 7 (shown in dark orange in ) and the twins of these multiples (shown in light orange), plus all the numbers in the residue classes of these twelve numbers Thus the deleted numbers include all the nontwin primes that are twins of multiples of 7 and no other primes. has 7 rows and 6 columns, and, by the Chinese remainder theorem, in each column we have a multiple of 7 and a twin of a multiple of 7, which we delete. So, in we have undeleted numbers left.
From the undeleted numbers in , we form the first row of shown in Table 3. Below this row we write 10 more rows by adding for to each header. is the first complete set of residues of
We continue building for all successive primes in a similar fashion.
Lemma 2
For every number in must be a twin prime, and every twin prime is in
Proof. Consider for some given Then is the smallest composite number with all factors and so no composite can be in
If is a nontwin prime then its twin is composite and hence cannot be in
So, if there are numbers in under then they must be twin primes.
Furthermore, if is a twin prime then it is a member of This is so, because in the construction of we have sifted out all multiples of the primes and their twins, but no twin prime is one of those.
Thus, our construction provides a sieve for the twin primes analogous to the sieve of Eratosthenes, as illustrated in Tables 1-3, which start with the twin primes between and for We have no proof, however, that the construction will give twin primes for every no matter how large. We have proved only that if there are numbers between and in then they are the twin primes of that interval.
Based on the construction above, in the next two sections we shall estimate the number of twin primes in under in two ways. First, by counting the number of deletions in each step of the construction and computing the density of the undeleted numbers left that way.
The second way of counting the number of twin primes in under is by counting the number of primes deleted under in the steps of the construction of and subtracting that from the total number of primes under
2 Counting all deletions under
In we delete entries in each column, and so we keep entries out of numbers. Hence the density of the undeleted numbers in is These numbers become the entries of and so is also the density of and of
In we delete entries out of 7 in each column, and so the density of the undeleted numbers in becomes which is then also the density of and of Continuing in this way, and writing for the th prime, we obtain the density of and for as
[TABLE]
This density is essentially the same222[HW] gives the number of pairs, we give the density of individual primes. as the one on p. 372 in [HW] and has the same shortcoming, namely that it is the density of over the huge interval but we need the density of over the much shorter interval where it is the same as the density of the twin primes there. As detailed in [HW], the corresponding ratio of the number of all primes relative to in the short interval to that in the long interval is known to be about by Mertens’ theorem. (Thm. 429, lc. Here is Euler’s constant.) Thus it is conjectured there that for twin primes the corresponding correction factor should be This amounts to assuming the statistical independence of the two numbers in a twin pair. (See [P].)
We try to avoid this problem by counting just the primes deleted under in the construction, since those are all nontwin primes. We do this in the next section. Unfortunately, however, we have no theory to determine the accuracy of our approximation. Empirically it turns out to be very good, though, and with a plausible correction factor, which has no square as the one in the first method, it becomes the same as the one above.
3 Counting deleted primes.
Let number of primes under deleted from when we build from for
In there are 2 columns in the first period, and in each column there is one entry that is the twin of a multiple of 5, namely 23 in the first column and 7 in the second. Thus, the primes that we delete from are the primes under of the two residue classes and plus the single prime According to Dirichlet’s theorem on primes in arithmetic progressions (see e.g. [A], p. 146), each residue class that is relatively prime to the modulus has an approximately equal share of the primes under that is, about primes. Thus, for large we delete
[TABLE]
primes from under . This number is just an approximation, because the fraction is correct only over integer multiples of the period and Dirichlet’s theorem is only asymptotically true. The same considerations apply to the estimates below as well.
Similarly, from under we delete about
[TABLE]
primes, because has a period of 210, the first period has columns, and in each column we delete one multiple of and one twin of such a multiple, which is prime to 210. (All entries of are prime to and and the twin of a multiple of 7 in is prime also to 7, and so to )
From we delete about
[TABLE]
primes under .
Similarly, for general with the number of primes deleted from under is
[TABLE]
Thus, if we sum these expressions over we get a telescoping sum and the total number of primes deleted under is
[TABLE]
and so the number of twin primes left in under that is, in the interval is about
[TABLE]
The second expression in Equation 7 can also be interpreted as the ratio of the number of twins relatively prime to to that of all numbers relatively prime to in the interval times the number of primes in (which has the same order of magnitude as that in Thus, while we did not assume that the density of twin primes is the same in the short interval as in the long one, we obtained a result that is equivalent to the ratio of the densities of the twin relative primes and of all relative primes being the same in the two intervals. (Clearly, in the numbers relatively prime to are the same as the primes there.)
Apparently, we can improve the estimate above by applying the same correction factor that appears when comparing the numbers of all relative primes in the two intervals:
[TABLE]
Here is the length of the short interval and the product is the density of all relative primes in the long interval. Thus, would be the number of primes in the interval if the density there were the same.
Hence
[TABLE]
Denoting by we can also write
[TABLE]
By Mertens’ theorem,
[TABLE]
and by the prime number theorem,
[TABLE]
Thus,
[TABLE]
Applying the correction factor to the estimate in Equation 7, we get
[TABLE]
In Table 4 we compare the estimate in Equation 7 and this estimate to the actual count of twin primes in the interval . As one can see, the numbers from Equation 7 are pretty close to the actual counts, but those from Equation 15 are much closer. (See also Fig. 1.)
If we apply the asymptotic estimate for the number of all primes under then from Equation 15 we obtain
[TABLE]
as an asymptotic estimate for the number of twin primes under This result equals the estimate in Equation 22.20.1 in [HW], where the number of pairs is counted, accounting for the factor of 2 in place of our 4 for the count of the individual primes.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[HW] G.H. Hardy and E.M. Wright, An Introduction to the Theory of Numbers, 4th ed. Oxford.
- 2[P] George Pólya, Am. Math. Monthly 66 (1959), 375-84.
- 3[A] Tom M. Apostol, Introduction to Analytic Number Theory, Springer-Verlag, Berlin, 1976.
