!
" # $ % &$
%
% ' %
( ) % %
%
! %
' #
* +
* +
* + *,-.
/ + 01
, 22
!"#$
% " ! &
' &
(
)*! & " " *)+,-!
./
"
0 1 2,)*
3 4 !
3 2,)5 % "
' & (
" " 2,)5
! &
Twin Prime
ON THE TWIN PRIME CONJECTURE
On The Twin Prime Conjecture and Prime Sieving Algorithms
Abdisalam, H. Muse
Amoud University
Twin Prime
ii
Twin Prime
iii
DEDICATION
This work is dedicated to my beloved parents: Mariam Iman and Hassan Musa whose
tireless effort and determination laid down the foundation of my education.
Twin Prime
iv
AKNOWLEDGEMENTS
My sincere gratitude goes to Allah, the almighty, for his grace that granted me the power
and insight to complete this work. Special thanks to Kikete Wabuya Dennis and Dr. Oso Willis.
Yuko, of the Department of Education for the assistance they have given me during the course
work.
I owe an immense debt of gratitude to my supervisor, Kikete Wabuya Dennis for his sound
advice and valuable guidance, for his effort and for offering his expertise and professionalism,
along with an encouraging positive outlook.
Special acknowledgement is given to my parents, sisters and brothers and all my friends.
Finally, my deep gratitude is to my wife Hawa Abdilahi who, without her understanding and
patience I could have never completed this research.
Abdisalam H. Muse
Twin Prime
v
TABLE OF CONTENTS
DEDICATION ............................................................................................................................... iii
AKNOWLEDGEMENTS.............................................................................................................. iv
TABLE OF CONTENTS ................................................................................................................ v
LIST OF TABLES ........................................................................................................................ vii
LIST OF NOTATIONS ............................................................................................................... viii
ABSTRACT ................................................................................................................................... ix
CHAPTER ONE: INTRODUCTION ............................................................................................. 1
1.1
Background of the study .................................................................................................. 1
1.2
Statement of the problem ................................................................................................. 3
1.3
Objectives of the study ..................................................................................................... 4
1.4
Significance of the study .................................................................................................. 5
1.5
Scope of the Study............................................................................................................ 6
CHAPTER TWO: LITERATURE REVIEW ................................................................................. 7
2.1
Introduction ...................................................................................................................... 7
2.2
Infinitude of Prime Numbers and Twin Primes ............................................................... 7
2.3
Sieve Theory and Prime Sieving Algorithm .................................................................. 10
CHAPTER THREEE: PRIME NUMBERS AND TWIN PRIMES ............................................. 13
3.0
Introduction .................................................................................................................... 13
Twin Prime
vi
3.1
Important Theorems of Prime Numbers......................................................................... 13
3.2
Twin Prime Conjecture and Related Problems .............................................................. 24
3.2.1
Related Problems ........................................................................................................ 25
3.2.2
Twin Prime Conjecture ............................................................................................... 29
CHAPTER FOUR: PRIME SIEVING ALGORITHM AND SIEVE METHODS ...................... 32
4.0
Introduction .................................................................................................................... 32
4.1
Prime Sieving algorithm................................................................................................. 32
4.1.1 Sieve of Eratosthenes ....................................................................................................... 33
(XOHU¶V6LHYH .................................................................................................................... 35
4.1.3 Sieve of Fabio................................................................................................................... 36
4.1.4 Sieve of Sundaram ........................................................................................................... 40
4.1.5 Sieve of Atkin................................................................................................................... 41
4.1.6 Sieve of Pritchard ............................................................................................................. 42
4.1.7
4.2
4.2.1
Twin Prime Sieving Algorithms ................................................................................. 45
Sieve methods ................................................................................................................ 52
Complexity and Time consumption of Sieving Algorithms ....................................... 53
CHAPTER FIVE: CONCLUSION............................................................................................... 56
REFERENCES ............................................................................................................................. 57
APPENDIX I: ANECDOTAL EVIDENCE OF THE INFINITY OF THE TWIN PRIMES ...... 61
Twin Prime
vii
LIST OF TABLES
Table 1: Consecutive twin primes between 11 and 1,155«««««««««««««««
Twin Prime
viii
LIST OF NOTATIONS
The following notations shall be used throughout this thesis.
Pn
:
the nth prime number
ʌ [
:
the number of prime number less than or equal to x
n - ʌ [
:
the number of composite number less than or equal to x
ࢥ (n)
:
WKH(XOHUTXRWLHQWIXQFWLRQVJLYLQJWKHQXPEHURIPޒQ
such that (m, n) = 1
ı Q
:
the number-of-divisors function
a|b
:
a divides b
DڢE
:
a does not divide b
DŁE S
:
a is congruent to b modulo p
[a, b]
:
the lowest common multiple of a and b
(a, b)
:
the highest common factor of a and b
[x]
:
the roof of x, the smallest integer greater than x
Twin Prime
ix
ABSTRACT
Twin Prime Conjecture, proposed in (c. 300
BCE),
is one of the oldest open questions in
mathematics. Much work has been done on the problem, and despite significant progress, a
solution remains elusive. This work is devoted to present the current state of knowledge about the
Twin Prime Conjecture and also the prime sieving algorithms and sieve methods to prove the
correctness of the conjecture. In this study will combined Twin Prime Conjecture and Prime
Sieving Algorithms to prove the infinitude of the twin prime pairs, this study is divided into five
chapters. The first chapter is devoted to an introduction, the second is devoted to the literature
review, and chapter 3 devoted to prime numbers and twin primes, Chapter 4 presents the prime
sieving algorithms and sieve methods. Finally, the chapter 5 is devoted to the conclusions based
on this study.
Twin Prime
CHAPTER ONE
INTRODUCTION
1.1 Background of the study
Number theory is the branch of mathematics concerned with the study of the properties
of the integers. It is one of the oldest parts of mathematics, alongside geometry, and has been
studied at least since the ancient Mesopotamians and Egyptians. Problems in number theory are
often easy to understand but are solved using sophisticated techniques from different branches
of mathematics such as algebra and analysis. Number theory as other fields in mathematics is
divided into several classes according to the methods used and the type of questions investigated
(Apostol, 2013)
There are many unsolved conjectures in number theory one can mention Riemann
+\SRWKHVLV /DQGDX¶V&RQMHFWXUH /DJUDQJH¶VFRQMHFWXUH WKH*ROGEDFK
conjecture (1742), and also exists another Goldbach conjecture known as GoldbDFK¶V RGG
conjecture (Burton, 2006).
The most important unsolved problem in number theory is Twin Prime Conjecture
also known as (XFOLG¶V twin prime conjecture, in number theory, assertion that there are
infinitely many twin primes, or pairs of primes that differ by 2. For example, 3 and 5, 5 and 7,
11 and 13, and 17 and 19 are twin primes. As numbers get larger, primes become less frequent
and twin primes rarer still. Greek mathematician Euclid (300 B.C) gave the oldest known proof
that there exist an infinite number of primes, and he conjectured that there are an infinite number
of twin primes (Hosch, 2010).
Very little progress was made on this conjecture until 1919, when Norwegian
mathematician Viggo Brun showed that the sum of the reciprocals of the twin primes converges
Twin Prime
2
to a sum, now known as %UXQ¶V constant. In 1994 American mathematician Thomas Nicely was
using a personal computer equipped with the then new Pentium chip from the Intel
Corporation when he discovered a flaw in the chip that was producing inconsistent results in his
FDOFXODWLRQVRI%UXQ¶VFRQVWDQW1HJDWLYHSXEOLFLW\IURPWKH mathematics community led Intel
to offer free replacement chips that had been modified to correct the problem. In 2010 Nicely
JDYHDYDOXHIRU%UXQ¶VFRQVWDQWRI.902160583209 ± 0.000000000781 based on all twin primes
less than 2 × 1016(Hosch, 2010).
The next big breakthrough occurred in 2003, when American mathematician Daniel
Goldston and Turkish mathematician Cem Yildirim SXEOLVKHGDSDSHU³Small Gaps Between
Primes´ WKDW HVWDEOLVKHG WKH H[LVtence of an infinite number of prime pairs within a small
difference (16, with certain other assumptions, most notably that of the Elliott-Halberstam
conjecture). Although their proof was flawed, they corrected it with Hungarian mathematician
JánosPintz in 2005.
In 2013, American mathematician Yitang Zhang from the university of New
Hampshire proved that there are infinitely many pairs of prime numbers separated by a distance
greater than 2, but less than 70 million. Thus he proved that the number of pairs of prime
numbers (Pi, Pi+1 = Pi + n) is infinite, where 2 ޒQ /DWHU -DPHV 0D\QDUG
improved this result to 600. In 2014, a group of scientists under the direction of Terence Tao
(Polymath project), improved this result to 246 (Goldston, Pintz & Yildirim, 2011).
The question of whether there exist infinitely many twin primes still remains an open
problem in pure mathematics. In this research, we intend to give an exposition of the problem
and study the infinitude of the twin primes in the real number system ring.
Twin Prime
3
1.2
Statement of the problem
The twin prime conjecture is an interesting unsolved problem in mathematics. Despite its
apparent simplicity, there exist no conclusive answers to the TXHVWLRQ³$UHWKHUHLQILQLWHO\PDQ\
WZLQSULPHV"´6RPHEDVLFSURSHUWLHVRISULPHQXPEHUVDQGDSSDUHQWWUHQGVVXJJHVWWKDWWKHUHDUH
infinitely many primes. However, to this point, no one has found a way to prove this. In this study,
we investigate the infinitude of the twin prime pairs and prime sieving algorithm. We also intended
to give an exposition of the most important prime sieving algorithms. We would try to prove the
correctness of the presented algorithms and compute the complexity of any sieving algorithm.
Twin Prime
4
1.3
Objectives of the study
The general objective of this study was to investigate the infinitude of the twin prime
conjecture in the real number system ring, with a view of getting the exact number of twin primes.
The specific objectives of this study were to:
1. Discuss and prove some important theorems on the prime numbers as they will be used
throughout this study.
2. Describe the current knowledge about the twin prime numbers and related problems.
3. Give an exposition of the most important prime sieving algorithms.
4. To prove the correctness of the presented counting algorithms, compute their complexity
and deduce theoretical bounds on the complexity of any sieving algorithm.
Twin Prime
5
1.4
Significance of the study
The aim of this study, which focused on The Infinitude of the Twin Prime Conjecture, is
to contribute towards enhancement of teaching and learning of number theory, algebra and
topology in university mathematics. The findings of the study are therefore significant to
Mathematics researchers who will use this study as the basis for further study in other fields. By
finding the number of twin primes in the ring R, a major milestone in pure mathematics would
have been achieved.
Twin Prime
6
1.5
Scope of the Study
This study on the twin prime conjecture and prime sieving algorithm will be based on just
the small gaps between prime numbers. The study will specifically focus on the gap two where
Pn+1 ± Pn = 2
Twin Prime
7
CHAPTER TWO
LITERATURE REVIEW
2.1
Introduction
This chapter discusses previous literature relevant to this study. This study was carried with
the realization that there were infinitely many pairs of twin primes. So, most of the literature
presented is collected information from some books and papers, and in most cases the original
sentences is reserved.
2.2
Infinitude of Prime Numbers and Twin Primes
Two of the oldest problems in the theory of numbers, and indeed in the whole of
mathematics, are the so-called twin prime conjecture and binary Goldbach problem. The first of
WKHVHDVVHUWVWKDW³WKHUHH[LVWLQILQLWHO\PDQ\SULPHVSVXFKWKDWSLVDSULPH´DQGWKHVHFRQG
WKDW³HYHU\HYHQQDWXUDOQXPEHU1IURPVRPHSRLQWRQZDUGFDQEHH[SUessed as the sum of two
SULPHV´ Halberstam & Richert, 2013)
(XFOLG¶V SURRI RI WKH LQILQLWXGH RI SULPHV LV ZHOO-known and any professional
mathematician can reproduce it from memory. It is an easy and intuitive result which raises the
question as to how these numbers are distributed. Looking through the sequence of primes we
note that there seem to be rather a large number of primes whose differences is precisely two ± 3
and 5; 11 and 13; 347 and 349 ± but the earliest example of the question as to whether there are
infinitely many of these so ± called twin primes was first posed in a more general form by de
Polignac.
dePolignac (1849) stated that for every positive even natural number k, there are infinitely
many consecutive prime pairs p and Sƍ such that pƍ í p = k (i.e. there are infinitely many prime
gaps of size k). The case k = 2 is the twin prime conjecture.
Twin Prime
8
However, in 1919 Vigo Brun showed that the sum of reciprocals of the twin primes was
convergent. This famous result, called Brun's theorem, was the first use of the Brun sieve and
helped initiate the development of modern sieve theory. The convergence of the sum of reciprocals
of twin primes follows from bounds on the density RIWKHVHTXHQFHRIWZLQSULPHV%UXQ¶VFRQVWDQW
is defined to be the sum of the reciprocals of all twin primes
B = ቀଷ ହቁ + ቀହ ቁ + ቀଵଵ ଵଷቁ +ቀଵ ଵଽቁ + ቀଶଽ ଷଵቁ + ቀସଵ ସଷቁ «
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
ଵ
If this series were divergent, then a proof of the twin prime conjecture would follow immediately.
Brun proved, however, that the series is convergent and thus B is finite. His result demonstrates
the scarcity of twin primes relative to all primes (whose reciprocal sum is divergent), but it does
shed light on whether the number of twin primes is finite or infinite. Selmer (1942), Fröberg
(1961), Bohman (1973), Shanks & Wrench (1974), Brent (1975, 1976), Nicely (1995, 2001),
Sebah (2002), and others successively improved numerical estimates of B, the most recent
FDOFXODWLRQVJLYH% «
Hardy and OLWWOHZRRG SURSRVHG D YHU\ VLPLODU FRQMHFWXUH WR GH 3ROLJQDF¶V
conjecture. Consider any set of numbers (a1, a2«ak), called a constellation. We say that this
constellation is admissible if it does not contain a complete set of residues modulo any prime
number p. for example, (0,2) or (0,2,6,8,12) are admissible, whereas (0,2,4) is not. Note also, that
we have only to check primes p N. A prime k-tuple for any admissible constellation consists of
k numbers (b1 + a1, b1 + a2, «bk + ak), such that for every i [ א1«N] ai + bi is a prime. Now
the reason for admissibility is obvious otherwise it would be possible for a tuple to contain at least
one number divisible by some prime p. Hardy and Littlewood also conjectured asymptotic density
for the number of primes p not greater than x, such that p + n (for a fixed even n) is also a prime,
Twin Prime
9
an assumption suggested by the prime number theorem and would imply the twin prime conjecture,
but remains unresolved.
Fröberg (1961) attempts to improve the Hardy ± Littlewood conjecture for twin primes by
replacing 1/log2x by {p(x)}2. Bombieri ± Vinogradov (1965) gives an upper bound for the average
QXPEHURISULPHVOHVVWKDQDJLYHQ[ࣅԳLQDSDUWLFXODUUHVLGXHPRGXORTޒԷ for some Է ޒx.
Elliott ± Halberstam (1970) conjectured that the Bombieri ± Vinogradov Theorem holds
for all Է ޒx (log x) ±C. However no proof is yet known. The minimum distance of bounded gaps
is considerably reduced if one assumes the full Elliott ± Halberstam Conjecture, though the
existence of such a minimum depends only on Bombieri ± Vinogradov.
Goldston, Pintz and Yildrim (2005) showed that there are infinitely many primes less than
the predicted average spacing; however, the authors could not demonstrate conclusively that there
is some upper bound on this gap. Their method was based on the idea of sieving, which is used to
select numbers that satisfy certain properties.
7DR FUHDWHG D ³Polymath project´ DQ RSHQ RQOLQH FROODERUDWLRQ WR LPSURYH WKH
bound that attracted dozens of participants. For weeks, the project moved forward at a breathless
SDFH³$WWLPHVWKHERXQGZDVJRLQJGRZQHYHU\WKLUW\PLQXWHV´7DRUHFDOOHd. By July 27, the
team had succeeded in reducing the proven bound on prime gaps from 70 million to 4,680.
Zhang (2014) proved that there are infinitely many pairs of primes that differ by less than
70 million. The proof of this amazing result was verified with high confidence by several experts
in the field and accepted for publication. Zhang's theorem is a huge step forward in the direction
of the twin prime conjecture. We now know for the first time that there are actually infinitely many
Twin Prime
10
pairs of primes that differ by some fixed number. The proof does not specify any specific number,
only that there is at least one that is less than 70 million.
Maynard (2014) provided the significantly lower number of 600. There is now great
excitement that a combination of Maynard's techniques with Zhang's will push this bound down
even further. Again in 2014, a group of scientists under the direction of Terence Tao (Polymath
project), improved this result to 246. The problem of the infinitude of the twin primes in the real
number systems seems not to have been solved to date. We intend to continue with the enumeration
of the twin primes in this study.
2.3
Sieve Theory and Prime Sieving Algorithm
Sieve theory has been used in attempts to prove that there exists infinitely many twin
primes. Many authors have worked with this method (Ribenboim, 2012). The theory of sieves has
become an important and sophisticated tool in the theory of numbers during the past 52 years.
Many important and deep results have been proved related to such unanswered questions as the
7ZLQ3ULPHV3UREOHPDQG*ROGEDFK¶V&RQMHFWXUH)RUWKHPRVWSDUWVLHYHVKDYHEHHQHPSOR\HG
in problems concerning primes (Andrews, 1972).
The first and most famous example was the Sieve of Eratosthenes. The sieve of
Eratosthenes is one of the most efficient ways to find all of the smaller primes. It does so by
iteratively marking as composite (i.e., not prime) the multiples of each prime, starting with the
multiples of 2. The multiples of a given prime are generated as a sequence of numbers starting
from that prime, with constant difference between them that is equal to that prime (Horsley,
1772). This is the sieve's key distinction from using trial division to sequentially test each
candidate number for divisibility by each prime (2¶1HLOO, 2009).
Twin Prime
11
The ancient Sieve of Eratosthenes that computes the list of prime numbers is inefficient
in the sense that some composite numbers are struck out more than once; for instance, 21 is struck
out by both 3 and 7. The great Swiss mathematician Leonhard Euler invented a sieve that
strikes out each composite number exactly once, at the cost of some additional bookkeeping
(Mollin, 2000).
Sundaram (1934) discovered a new method of prime sieving algorithm. The
algorithm, ʹ݇ ͳ is prime where k can be written as ݅ ݆ ʹ݆݅ where i and j are integers. We
can rewrite this:
2 ሺ݅ ݆ ʹ݆݅ሻ ͳ ൌ ʹ݅ ʹ݆ Ͷ݆݅ ͳ
ൌ ሺʹ݅ ͳሻሺʹ݆ ͳሻ
Both ʹ݅ ͳ and ʹ݆ ͳ are odd numbers, and any number that can be written as the
product of two odd numbers are composite.Of the odd numbers, those that cannot be written as the
SURGXFW RI WZR RGG QXPEHUV DUH SULPH :H¶YH ILOWHUHG HYHU\WKLQJ WKDW Fan be written asሺʹ݅
ͳሻ ሺʹ݆ ͳሻ so we are left with the odd prime numbers. This algorithm only gets the odd prime
numbers, but fortunately there is only one even prime number, 2.
Pritchard (1980) showed how to replace multiplications with addition, thus improving on
the sieve of Eratosthenes at the bit-complexity level. He also showed how to reduce the storage
requirements to 0(n / log log n) bits.
Giraldo-Franco & Dyke (2001) presented an interesting prime sieve called Fabio's sieve.
In this sieve the list of prime numbers was found using only regular and independent patterns. It
is a new tool used to prove some of the conjectures that still are unsolved about primes.
Atkin & Bernstein (2004) propose a completely different approach called sieve of Atkin.
They use quadratic forms to separate primes from composite numbers.The sieve of Atkin is a
Twin Prime
12
modern algorithm for finding all prime numbers up to a specified integer. Compared with the
ancient sieve of Eratosthenes, which marks off multiples of primes, the sieve of Atkin does some
preliminary work and then marks off multiples of squares of primes, thus achieving a better
theoretical asymptotic complexity.
One of the original purposes of sieve theory was to try to prove conjectures in number
theory such as the twin prime conjecture. While the original broad aims of sieve theory still are
largely unachieved, there have been some partial successes, especially in combination with other
number theoretic tools. Brun, Zhang, Maynard, and Polymath all worked with sieves.
Twin Prime
13
CHAPTER THREEE
PRIME NUMBERS AND TWIN PRIMES
3.0
Introduction
This chapter discusses basic important theorems on the prime numbers and their proofs
that we need to prove important facts about twin primes and prime sieving algorithms. We also
discuss the current knowledge about the twin prime conjecture and we show few related problems
in the number theory.
3.1
Important Theorems of Prime Numbers
Definition 3.1.1:
An integer n is called prime if n > 1 and if the only positive divisors of n are 1 and n. (If n > 1 and
if n is not prime, then n is called composite. A composite number is a product of prime numbers).
Example
The prime numbers less than 100 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
61, 67, 71, 73, 79, 83, 89, and 97.
Number of Prime Numbers:
There would seem to be an infinite number of prime numbers. In fact, the Greek
mathematician Euclid proved this over 2000 years ago, and many other more complicated proofs
H[LVW ,W¶V DFWXDOO\ QRW WKDW GLIILFXOW WR SURYH (Ribenboim, 1995). Below we present several of
these.
Twin Prime
14
Theorem 3.1.1: (infinitude of prime numbers)
There exist an infinite number of primes
3URRI (XFOLG¶V3URRI
Suppose that P1=2 < P2 = 3 < ... < Pr are all of the primes. Let P = P1P2...Pr+1 and let p be a prime
dividing P; then p cannot be any of P1, P2, ..., Pr, otherwise P would divide the difference
P - P1P2... Pr = 1, which is impossible. So this prime p is still another prime, and P1, P2... Pr would
not be all of the primes.
Proof 2: (Kummer's Restatement of Euclid's Proof)
Suppose that there exist only finitely many primes p1 < p2 < ... < pr.
Let N = p1.p2.....pr. The integer N-1, being a product of primes, has a prime divisor pi in common
with N; so, pi divides N - (N-1) =1, which is absurd!
Proof 6DLGDN¶V3URRI
Let n > 1 be a positive integer. Since n and n+1 are consecutive integers, they must be coprime,
and hence the number N2= n(n + 1) must have at least two different prime factors. Similarly,
since the integers n(n+1) and n(n+1)+1 are consecutive, and therefore coprime, the number
N3 = n(n + 1)[n(n + 1) + 1] must have at least 3 different prime factors. This can be continued
indefinitely.
Twin Prime
15
Primes in arithmetic progression
The arithmetic progression of odd numbers 1, 3, 5, . . . ,2n + 1, . . . contains infinitely many primes.
It is natural to ask whether other arithmetic progressions have this property.
'LULFKOHW¶VWKHRUHPIRUSULPHVRIWKHIRUPQ-1 and 4n+1
Theorem 3.1.2:
There are infinitely many primes of the form 4n-1
Proof:
We argue by contradiction. Assume there are only a finite number of such primes,
let p be the largest, and consider the integer
N = 2, 2. 3. 5.7.. . p - 1.
The product 3 .5 . . . p contains all the odd primes < p+1 as factors.
Since N is of the form 4n - 1 it cannot be prime because N > p.
# Prime p divides N, so all the prime factors of N must exceed p.
But all of the prime factors of N cannot be of the form 4n + 1 because the product of two such
numbers is again of the same form.
Hence some prime factor of N must be of the form 4n - 1.
This is a contradiction.
Twin Prime
16
Theorem 3.1.3
There are infinitely many primes of the form 4n+1
Proof:
/HW1EHDQ\LQWHJHU!:HZLOOVKRZWKDWWKHUHLVDSULPHS!1VXFKWKDWSŁ PRG
Let
PŁ 1 2 + 1.
1RWHWKDWPLVRGGPޓ/HWSWKHVPDOOHVWSULPHIDFWRURIP1RQHRIWKHQXPEHUV
2,
3 «1GLYLGHVPVRQޓ1DOVRZHKDYH
(N!)2 Ł-1 (mod P).
Raising both members to the (P ± 1)/2 power we find
(N!)P-1 Ł -1)(p - 1)/2(mod P).
But (N!)P-1 Ł PRG3 E\WKH(XOHU± Fermat theorem. So
(-1)(P - 1)/2 Ł PRG3
Now the difference (-1)(p ± 1)/2 ± 1 is either 0 or -2 and it cannot be -2.
Because it is divisible by p. so it must be 0. That is,
(-1)(p ± 1)/2 = 1.
But this means that (p ± LVHYHQVRSŁ PRG ,QRWKHUZRUGVZHKDYHVKRZQWKDWIRU
HDFKLQWHJHU1!WKHUHLVDSULPHS!1VXFKWKDWSŁ PRG 7KHUHIRUHWKHUHDUHLQILQLWHO\
many primes of the form.
Simple arguments like those just given for primes of the form 4n ± 1 and 4n + 1 can also be adapted
to treat other special arithmetic progressions, such as 5n - 1,8n - 1,8n - 3 and 8n + 3
But there is a theorem which is much harder than the cases above since it works for the general
progression k.n+h
Twin Prime
17
Theorem 3.1.4: (Dirichlet)
If k > 0 and (h, k) = 1 there are infinitely many primes in the arithmetic progression kn + h,
n
= 0, 1, 2 . . .
Theorem 3.1.5: (Green and Tao 2004)
)RUHYHU\LQWHJHUNWKHSULPHQXPEHUVFRQWDLQDQDULWKPHWLFSURJUHVVLRn of length k
Then, Green and Tao prove a stronger statement than that given theorem above. They
show that not only do the primes contain arbitrarily long arithmetic progressions, but so does any
sufficiently dense subset of the primes:
Theorem 3.1.6: (Green and Tao) (stronger)
If A is a subset of prime numbers with
ת ܣሼͳǡ ܰሽሽ
൰ Ͳ
൬
ߨሺܰሻ
ே՜ஶ
ZKHUHʌ 1 LVWKHQXPEHURISULPHVLQ^1`WKHQIRUHYHU\LQWHJHUN
A contains an arithmetic progression of length k.
6XEVWLWXWLQJWKHVHWRIDOOLQWHJHUVIRUWKHVHWRISULPHVLQWKLV7KHRUHPRQHREWDLQV6]HPHUHGL¶V
Theorem.
Theorem 3.1.7: (Finite Szemeredi)
/HWįEHDUHDOQXPEHUDQGOHWNEHDQLQWHJHU
There exists No įN VXFKWKDWLI1!1o įN DQG$LVDVXEVHWRI^1`ZLWK_$_į1WKHQ
A contains an arithmetic progression of length k.
In fact what Green and Tao did was to take a mix of many proofs of Szemeredi's theorem and
showing that this mix could be adapted to work for primes instead of all integers.
Twin Prime
18
Definition 3.1.2: Co-prime or relatively prime numbers
A pair of numbers not having any common factors other than 1 or -1 (or alternatively their gcd is
1 or -1).
Example: 15 and 28 are co-prime, because the factors of 15 (1,3,5,15), and the factors of 28
(1,2,4,7,14,28) are not in common (except for 1).
Definition 30HUVHQQH¶V3ULPH
Prime numbers of the form 2n-1 where n must itself be prime.
Example:
3, 7, 31, 127 etc. are Mersenne primes.
N.B:
Not all such numbers are primes. For example, 2047 (i.e. 211-1) is not a prime number. It is
divisible by 23 and 89.
Theorem 3.1.8:
If for some positive integer n, 2n-1 is prime, then so is n.
Proof.
Let r and s be positive integers, then the polynomial xrs-1 is xs-1 times xs(r-1) + xs(r-2) + ... + xs +
1. So if n is composite (say r.s with 1<s<n), then 2n-1 is also composite (because it is divisible
by 2s-1).
Notice that we can say more: suppose n>1. Since x-1 divides xn-1, for the latter to be prime the
former must be one. This gives the following.
Twin Prime
19
Corollary 3.1.1:
Let a and n be integers greater than one. If an-1 is prime, then a is 2 and n is prime.
Usually the first step in factoring numbers of the forms an-1 (where a and n are positive integers)
is to factor the polynomial xn-1. In this proof we just used the most basic of such factorization
rules.
Definition 3.1.4: Perfect Numbers
Any positive integer that is equal to the sum of its distinct proper factors (factors other than the
number itself).
Example:
6 (proper factors: 1, 2, 3) is a perfect numbers because 1 +2 +3 = 6
28 (proper factors: 1, 2, 4, 7, 14) is also a Perfect number, because 1 +2 +4 +7 +14 = 28)
Theorem 3.1.9:
If 2k-1 is a prime number, then 2k-1(2k-1) is a perfect number and every even perfect number has
this form.
Proof:
Suppose first that p = 2k-1 is a prime number, and set n = 2k-1(2k-1). To show n is perfect we need
only show ߪ(n)= 2n. Since ߪ is multiplicative and ߪ(p) = p+1 = 2k, we know
ߪ (n) = ߪ (2k-1).ߪ (p) = (2k-1)2k = 2n.
This shows that n is a perfect number.
On the other hand, suppose n is any even perfect number and write n as 2k-1m where m is an
odd integer and k>2. Again ߪ is multiplicative so
ߪ (2k-1m) = ߪ (2k-1).ߪ (m) = (2k-1).ߪ (m).
Twin Prime
20
Since n is perfect we also know that
ߪ (n) = 2n = 2km.
Together these two criteria give
2km = (2k-1).ߪ (m),
so 2k-1 divides 2km hence 2k-1 divides m, say m = (2k-1)M. Now substitute this back into the
equation above and divide by 2k-1 to get 2kM = ߪ (m). Since m and M are both divisors of m we
know that
2kM = ߪ (m) > m + M = 2kM,
so ߪ (m) = m + M. This means that m is prime and its only two divisors are itself (m) and one
(M). Thus m = 2k-1 is a prime and we have prove that the number n has the prescribed form.
Theorem 3.1.10: Wilson's theorem
Let p be an integer greater than one. p is prime if and only if (p-1)! = -1 (mod p).
Proof:
It is easy to check the result when p is 2 or 3, so let us assume p > 3. If p is composite, then its
positive divisors are among the integers
1, 2, 3, 4, ... , p-1
and it is clear that gcd((p-1)!,p) > 1, so we cannot have (p-1)! = -1 (mod p).
However if p is prime, then each of the above integers are relatively prime to p. So for each of
these integers a there is another b such that ab = 1 (mod p). It is important to note that this b is
unique modulo p, and that since p is prime, a = b if and only if a is 1 or p-1. Now if we omit 1
and p-1, then the others can be grouped into pairs whose product is one showing
2.3.4.....(p-2) = 1(mod p)
Twin Prime
21
(or more simply (p-2)! = 1 (mod p)). Finally, multiply this equality by p-1 to complete the proof.
This beautiful result is of mostly theoretical value because it is relatively difficult to
calculate (p-1)! In contrast it is easy to calculate ap-1, so elementary primality tests are built using
)HUPDW¶V/LWWOH7KHRUHPUDWKHUWKDQ:LOVRQ¶V
Theorem 3.1.11: Fermat's Little Theorem.
Let p be a prime which does not divide the integer a, then ap-1 = 1 (mod p).
Proof:
Start by listing the first p-1 positive multiples of a:
a, 2a, 3a, ... (p -1)a
Suppose that ra and sa are the same modulo p, then we have r = s (mod p), so the p-1 multiples
of a above are distinct and nonzero; that is, they must be congruent to 1, 2, 3, ..., p-1 in some order.
Multiply all these congruences together and we find
a.2a.3a.....(p-1)a = 1.2.3.....(p-1) (mod p)
or better, a(p-1)(p-1)! = (p-1)! (mod p). Divide both side by (p-1)! to complete the proof.
Sometimes Fermat's Little Theorem is presented in the following form:
Corollary 3.1.2:
Let p be a prime and a any integer, then ap = a (mod p).
Proof:
The result is trival (both sides are zero) if p divides a. If p does not divide a, then we need only
multiply the congruence in Fermat's Little Theorem by a to complete the proof.
Twin Prime
22
Another interesting thing about Prime numbers:
After 2, 3, and 5, prime numbers take on some characteristic behavior. Finding prime
QXPEHUVFDQEHPDGHDOLWWOHELWHDVLHUE\WKLVVLPSOHWKHRUHPWKDW¶VDOVRQRWWRREDG
Theorem 3.1.8:
All primes greater than 3 are of the form 6n+1 or 6n-1, where n is a counting number.
Proof:
2 and 3 are primes. Then all multiples of 2 and 3 greater than 2 and 3 are not primes, 5 is of the
form 6n-1, where n = 1. 5 is prime. Then all multiples of 5 greater than 5 are not primes. Then
consider modular arithmetic in base 6:
There are six subdivisions of the counting numbers mod 6:
PRG« QQLVDFRXQWLQJQXPEHU
PRG« QQLVDFRXQWLQJQXPEHU
PRG« QQLVDFRXQWLQJQXPEHU
PRG« Qn is a counting number
PRG« QQLVDFRXQWLQJQXPEHU
PRG« QQLVDFRXQWLQJQXPEHU
Any counting number that is equivalent to 0 mod 6, 2 mod 6, or 4 mod 6 is even, and thus is
divisible by 2. 6n/2 = 3n, (6n+2) / 2 = 3n +1, (6n +4) / 2 = 3n +2. 3n, 3n +1, and 3n +2 are all
counting numbers. Thus any such number is not prime, unless it is 2 itself.
Any counting number that is equivalent to 3 mod 6 is divisible by 3, since (6n +3)/3 = 2n +1, a
counting number. Thus any such number is not prime, unless it is 3 itself.
Twin Prime
23
Any counting number that is equivalent to 1 mod 6 or 5 mod 6 then may be prime or may not be
SULPH1RWDOOQXPEHUVRIWKHIRUPQRUQŁ Q-1) mod are prime, but all primes greater
than 3 fall into one of those two categories.
How this relates to Twin Primes
Since primes can only be written as 6n + 1 or 6n ± 1 when they are greater than 3, it is blatantly
obvious that for twin primes to exist, they have to be a pair of numbers that can be written as (6n
-1, 6n + 1). Otherwise, there is no way for them to be primes and still be two apart.
Twin Prime
24
3.2
Twin Prime Conjecture and Related Problems
One charm of the integers is that easily stated problems, which often sound simple, are
often very difficult and sometimes even hopeless given the state of our current knowledge. For
instance, in a 1912 lecture at an international mathematical congress, Edmund Landau mentioned
four old conjectures that appeared hopeless at that time (Suranyi & Erdös , 2003 ).
1. *ROGEDFK¶V Conjecture: Every positive even integer greater than two is the sum of two
primes.
2. Twin Prime Conjecture: there are infinitely many twin primes.
3. /HJHQGUH¶V&RQMHFWXUHEHWZHHQDQ\FRQVHFXWLYHVTXDUHWKHUHLVDSULPHQXPEHU
4. /DQGDX¶V&RQMHFWXUHWKHUHDUHinfinitely many primes of the form n2 + 1.
Today, his statement could be reiterated. During the more than 100 years that have passed,
much intensive research has been conducted on all of these conjectures, and all these problems
remain open , proving that landau was right. The first three of them are related, they concern primes
in some intervals and the fourth conjecture that n2 + 1 is prime for infinitely many integers n is
VRPHWLPHVFDOOHG/DQGDX¶VFRQMHFWXUHVLQFHKHGLVFXVsed it in his address to the 1912 International
Congress as one of the particularly challenging unsolved problems about prime numbers. We will
concentrate on the second problem, i.e.
Conjecture 3.1.1 (Twin Prime Conjecture).³There are infinitely many twin primes of the form
p and P+´
Usually the pair (2, 3) is not considered to be a pair of twin primes. Since 2 is the only
even prime, this pair is the only pair of prime numbers that differ by one; thus twin primes are as
closely spaced as possible for two primes. The first pairs of twin primes are (3, 5), (5, 7), (11, 13),
(17, 19), (29, 31), (41, 43)(59, 61), (71, 73), (101, «« with 5
Twin Prime
25
being the only prime being in two pairs. Every twin prime pair except (3, 5) is of the form
(6n í 1, 6n + 1) for some natural number n; that is, the number between the two primes is a multiple
of 6.No one has come up with a proof of this result although most mathematicians do seem to
believe it is true.
Twin primes become increasingly rare as one examines larger ranges, in keeping with the
general tendency of gaps between adjacent primes to become larger as the numbers themselves get
larger. However, it is a longstanding conjecture that there are infinitely many twin primes. Work
of Yitang Zhang in 2013, as well as work by James Maynard, Terence Tao and others, has made
substantial progress towards proving this conjecture, but at present it remains unsolved.
3.2.1 Related Problems
*ROGEDFK¶V&RQMHFWXUH
$QRWKHU IDPRXV XQVROYHG SUREOHP LQ QXPEHU WKHRU\ LV WKH *ROGEDFK¶V &RQMHFWXUH ,Q
Christian Goldbach hazarded the guess that
Conjecture 3.1.2 *ROGEDFK¶V&RQMHFWXUH
³(YHU\SRVLWLYHHYHQinteger greater WKDQWZRFDQEHZULWWHQDVDVXPRIWZRSULPHV´
This is easy to confirm for the first few even integers:
4=2+2
6=3+3
8=3+5
10 = 3 + 7 = 5+ 5
12 = 5 + 7
14 = 3 + 11 = 7 + 7
16 = 3 + 13 = 5 + 11
Twin Prime
26
18 = 5 + 13 = 7 + 11
20 = 3 + 17 = 7 + 13
22 = 3 + 19 = 5 + 17 = 11 + 11
24 = 5 + 19 = 7 + 17 = 11 + 13
26 = 2 + 23 = 7 + 19 = 13 + 13
.
.
.
100 = 47 + 53
.
.
.
1000 = 491 + 509
.
.
.
Again this result has not been proven. Mathematicians have been trying to prove this result for
over 270 years. Computers have verified this result for all the even integers up to 4x1018. The
QHDUHVWSURSRVLWLRQWR*ROGEDFK¶VFRQMHFWXUHWKDWKDVEHHQSURYHQLV³(YHU\HYHQLQWHJHU!LV
the sum of six oU IHZHU SULPHV´ 7KHUH DOVR H[LVWV DQRWKHU *ROGEDFK FRQMHFWXUH NQRZQ DV
*ROGEDFK¶V2GG&RQMHFWXUHZKLFKFODLPV
Conjecture 3.2.3 (*ROGEDFK¶V2GG&RQMHFWXUH
³(YHU\RGGLQWHJHUJUHDWHUWKDQFDQEHZULWWHQDVWKHVXPRIWKUHHSULPHV´
This conjecture LV DOVR FDOOHG *ROGEDFK¶V ZHDN FRQMHFWXUH EHFDXVH LI Goldbach's strong
conjecture (concerning sums of two primes) is proven, it would be true. In 2013, Harald
Helfgott proved Goldbach's weak conjecture; previous results had already shown it to be true for
all odd numbers greater than VRPHVWDWHWKHFRQMHFWXUHDV³(YHU\RGGQXPEHUJUHDWHUWKDQFDQ
EH H[SUHVVHG DV WKH VXP RI WKUHH RGG SULPHV´ 7KLV YHUVLRQ H[FOXGHV EHFDXVH WKLV
requires the even prime 2. Helfgott's proof covers both versions of the conjecture.
Twin Prime
27
Conjecture 3.2.4 /DJUDQJH¶V Conjecture):
³(YHU\RGGLQWHJHUJUHDWHUWKDQFDQEHZULWWHQDVDVXPRISTZKHUHSDQGTDUHERWKSULPHV
For example: 7 = 3 + 2(2)
, 9 = 5 + 2(2), 11 = 5 + 2(3), 13 = 3 + 2(5), 15 = 5 + 2(5 « Again
there is no proof of this.
Conjecture 3.2. /HJHQGUH¶V&RQMHFWXUH :
³There is a prime number between n2 and (n + 1)2 for every positive integer Q´
Legendre's conjecture, proposed by Adrien-Marie Legendre.The conjecture is one of Landau's
problems (1912) on prime numbers; as of 2016, the conjecture has neither been proved nor
disproved.
Conjecture 3.2.6 /DQGDX¶V&RQMHFWXUH
³7KHUHDUHLQILQLWHO\PDQ\SULPHVRIWKHIRUPQ2 ´
,QRWKHUZRUGV³Are there infinitely many primes p such that p í LVDSHUIHFWVTXDUH"´
Landau gave the following conjecture in 1912, for example 22 +1 = 5, 42 +1 = 17, 62 «
if we tweak the n2+1 to n2 ± 1 we find there is only one prime, 3 which is of this form.
All 6 of these problems have remained unproven for hundreds of years, or in the case of
twin prime conjecture for thousands of years.
Conjecture 3.2.7 (GH3ROLJQDF¶V&RQMHFWXUH): stated in 1849 by de Polignac
³/HWQEHDSRVLWLYHHYHQLQWHJHU7KHQQFDQEHUHSUHVHQWHGDVDGLIIHUHQFHRIWZRFRQVHFXWLYH
prime numbers in infinitely many ways. Stated differently: the number of prime gaps of size n,
i.e,, pairs of consecutive prime numbers Pk and Pk+1 with Pk+1 ± Pk = n, is infinite.
special case with n =2 is the Twin Prime Conjecture.
The
Twin Prime
28
Theorem 3 'H3ROLJQDF¶V Conjecture).
For any even integer r WKHUHH[LVWLQ¿QLWHO\PDQ\SULPHVS such that p + r is also a prime.
Proof.
Let r אN be an even number. Consider the following Application: f: P ĺ= acting as f(p) = p + r.
We take Z with the topology of arithmetical progression and P with the induced topology of Z.
First we prove that f is a continuous application. Then for O ؿZ we will proof that fí(O) is an
open of Z (because P is open in Z). Let x אfí (O) then f(x) אO; we search d > 0 such that Nx,d ك
Ií 1(O). Since O is an open then there is b > 0such that N f(x),b كO. let y אN x, d then there is n א
Z such that y= x + nd. We have then f(y) = x + r + nd = f(x) + nd. We take d = b > 0 therefore f(y)
אO. We conclude that f is a continuous applications.
:HSURYHQRZWKDWWKHUHLVDQLQ¿QLW\RISULPHS such that p +r is also prime. Since P is an open
subset of Z and f is continuous then fí (P) = {p אP/ p + r אP} is an open for the topology Z. Then
LWLVLQ¿QLWH Henceforth the De 3ROLJQDF¶V&RQMHFWXUHLVWUXH
For the case r = 2 it supports that twin prime conjecture is also true.
Definition 3.2.1: Cousin Primes
Cousin primes are pairs of primes which differ by four. (are pairs of primes of the form p, p+4)
Example:
The Cousin primes below 300 are
(3, 7), (7, 11), (13, 17), (19, 23), (37, 41), (43, 47), (67, 71), (79, 83), (97, 101), (103, 107), (109,
113), (127, 131), (163, 167), (193, 197), (223, 227), (229, 233), (277, 281)
Twin Prime
29
Definition 3.2.2: Sexy Primes
Sexy Primes are pairs of primes which differ by six. (are pairs of the form p, p+6)
Example:
The sexy primes below 300 are:
(5,11), (7,13), (11,17), (13,19), (17,23), (23,29), (31,37), (37,43), (41,47), (47,53), (53,59),
(61,67), (67,73), (73,79), (83,89), (97,103), (101,107), (103,109), (107,113), (131,137), (151,157),
(157,163), (167,173), (173,179), (191,197), (193,199), (223,229), (227,233), (233,239), (251,257),
(257,263), (263,269), (271,277), (277,283)
3.2.2 Twin Prime Conjecture
Definition 3.2.3: Twin prime numbers
A couple of primes (p, q) are said to be twin if q = p + 2. Except for the couple (2, 3), this is clearly
the smallest possible distance between two primes.
Example:
The first few twin prime pairs are: (3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), (59, 61), (71,
73), (101, 103), (107, 109), (137, 139),
Definition 3.2.4: Isolated Prime
An isolated prime (also known as single prime or non-twin prime) is a prime number p such that
neither p í 2 nor p + 2 is prime. In other words, p is not part of a twin prime pair.
example, 23 is an isolated prime, since 21 and 25 are both composite.
Example:
The first few isolated primes are2, 23, 37, 47, 53, 67, 79, 83, 89, 97, ...
For
Twin Prime
30
Theorem 3.2.2:
There is an infinitude of twin prime Pairs
Proof:
Twin primes are of the form 6n ± 1 except (3,5). As of now we are not thinking about (3,5)
as we are interested in infinite number of twin prime exists or not. Now we call a number twin
prime generator if it generated a twin prime. For example 12 is a twin prime generator because 11
and 13 constitute twin prime. So, 6n is twin prime generator.
Now, if we divide 6n by 5 we find WKDWWKHJHQHUDWRU¶VODVWGLJLWFDQQRWEHRUEHFDXVH
RWKHUZLVH¶VQH[WQXPEHUDQG¶VSUHYLRXVQXPEHULVGLYLVLEOHE\DQGFDQQRWJHQHUDWHWZLQ
prime. So, last digit of twin primes can be wither 0, 2, or 8. Now, working with 0. 10, 20 are not
twin prime generator because they are not divisible by 3. So, either previous one or next number
will be divided by 3 not generating twin primes. for example here, 9 and 21. Twin prime generator
must be divisible by 3 so it takes form 6n. So 30 is a twin prime generator. So, twin prime generator
is of the form 30n + 30 except (3,5); (5;7); (11, 13); (17, 19). As of now we are not thinking about
those as we are interested in infinite number of twin prime exists or not.
1RZOHW¶VGLYLGHQE\,ILWGRHVQ¶W give +1 or -1 as remainder then it is a twin
prime generator with respect to 7. If it gives +1 or -1 as remainder then the previous number or the
next number will be divisible by 7 and not a twin prime generator.
Now, if we divide 30 (n+1) by 7 then n can EH«ZKLFKLVDVHULHVRIFRPPRQ
difference 7which gives -DVDUHPDLQGHU QFDQEH«ZKLFKLVDVHULHVRIFRPPRQ
GLIIHUHQFHDJDLQZKLFKJLYHVDVDUHPDLQGHU/HW¶VFDOOWKHWZRVHWVWRJHWKHU^`.
Twin Prime
31
Similarly, if we divide LWE\WKHQVHULHVLV«ZKLFKLVDVHULHVRIFRPPRQ
GLIIHUHQFHZKLFKJLYHVDVUHPDLQGHU «ZKLFKLVVHULHVRIFRPPRQGLIIHUHQFH
which gives -DVUHPDLQGHU/HW¶VFDOOWKHWZRVHWVWRJHWKHU{11}.
Similarly, for 13 the VHULHVLV«IRU- VHULHVLV«IRU/HW¶VFDOO
the two sets together {13}.
Similarly, we can find for other prime numbers which on division of 30 (n+1) gives ±1 as
remainder.
Now as we see the prime number is increasing (property of natural number) so the common
difference will also increase. Now we need to find numbers which are not part of these series taken
simultaneously.
As the prime number series diverges as it goes on increasing then there must be some
integers which are not part of these series. So that we can find n and substitute to get a twin prime
generator. Once twin prime generator is found then twin primes can be found.
,IWKHQXPEHUVZKLFKJLYHVUHPDLQGHULVFDOOHGVHW^Q` ^`ޕ««ޕ`^ޕ`^ޕWKHQ
{n} must be subset of {Z} the set of integers. {Z} ± ^Q`JLYHVWKHQ¶VIRUZKLFKQLVD
generator of twin prime. Exclude the numbers which gives ±1 as remainder with quotient 1 because
they are prime.
Obviously {Z} ± {n} is non-empty because 1 is an element of the set as 59 and 61 twin
prime itself. And {Z} ± {n} is infinite as the series of {n} continues to go on so we will find
corresponding {Z} ± {n}.
This similar case also goes with the numbers 12 + 30n and 18 + 30n. Then Twin primes
are LQ¿QLWH Henceforth the Twin Prime Conjecture is true.
Twin Prime
32
CHAPTER FOUR
PRIME SIEVING ALGORITHM AND SIEVE METHODS
4.0
Introduction
In this chapter we discuss, the important prime sieving algorithms. Although the most
popular is the Sieve of Eratosthenes, we showed that it is not the most optimal algorithm for this
SUREOHP:HDOVRSURYHDZHDNVWDWHPHQWRI%UXQ¶VWKHRUHP)URPWKLVIDFWLWIROORZVGLUectly
that the sum of inverses of twin primes converges to a finite value. To achieve this remarkable
UHVXOWZHXVHG%UXQ¶VFRPELQDWRULDOVLHYH± a relatively modern tool in number theory.
4.1
Prime Sieving algorithm
A prime sieve or prime number sieve is a fast type of algorithm for finding primes. There
are many prime sieves. The simple sieve of Eratosthenes (250, BCE), the sieve of
Sundaram (1934), the still faster but more complicated sieve of Atkin (Atkin & Bernstein, 2004),
and various wheel sieves (Pritchard, 1994) are most common.
A prime sieve works by creating a list of all integers up to a desired limit and progressively
removing composite numbers (which it directly generates) until only primes are left. This is the
most efficient way to obtain a large range of primes; however, to find individual primes,
direct primality tests are more efficient (Johnson. 2015) Furthermore, based on the sieve
formalisms, some integer sequences are constructed which they also could be used for generating
primes in certain intervals.
Twin Prime
33
4.1.1 Sieve of Eratosthenes
The most basic and historically the first method used to obtain a list of prime numbers up
to some limit is the sieve of Eratosthenes (Buchert, 2011). Sieve of Eratosthenes is one of a number
of prime number sieves, is a simple, ancient algorithm for finding all prime numbers up to any
given limit. It does so by iteratively marking as composite (i.e., not prime) the multiples of each
prime, starting with the multiples of 2 (Dietzfelbinger, 2004).
Algorithm 4.1.1: Sieve of Eratosthenes
Assume we want to make a list of prime numbers up to a given integer n by Eratosthenes'
method:
1. Create a list of consecutive integers from 2 through n: (2, 3, 4, ..., n).
2. Initially, let p equal 2, the smallest prime number.
3. If p2 > n the algorithm terminates. Primes are numbers that were not marked out
4. Enumerate the multiples of p by counting to n from 2p in increments of p, and mark them
in the list (these will be 2p, 3p, 4p, ...; the p itself should not be marked).
5. Find the first number greater than p in the list that is not marked. If there was no such
number, stop. Otherwise, let p now equal this new number (which is the next prime), and
repeat from step 4.
6. When the algorithm terminates, the numbers remaining not marked in the list are all the
primes below n.
Twin Prime
34
Example 4.1.1:
To find all the prime numbers less than or equal to 30, proceed as follows.
First generate a list of integers from 2 to 30:
Iteration 0: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
7KHILUVWQXPEHULQWKHOLVWLV6RLVSULPH:H¶OOHQFORVHLW7KHQXQGHUOLQHWKHDOOPXOWLples of
2.
Iteration 1: ཱ 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
1RZZHUHSHDW7KHQH[WQXPEHURQWKHOLVWZLOOEHSULPHDQGLW¶VPXOWLSOHVVKRXOGEH double
underlined it.
Iteration 2: ཱ ི 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Since ξ͵Ͳ ޒDQGWKHQH[WHOHPHQWRQWKHOLVWLVWKLVLVRXUODVWVWHS:HHQFORVHDQGFURVV
out any multiples of 5 that are left, and everything left must be a prime. So we get
Iteration 3: ཱ ི 4 ུ 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Result: ཱ ི 4 ུ 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
The primes are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. In particular there are 10 primes here, and 7
primes bigger than 5 (the largest prime we used to find them).
Twin Prime
35
4.1.2 (XOHU¶V6LHYH
Euler's proof of the zeta product formula contains a version of the sieve of Eratosthenes in
which each composite number is eliminated exactly once (Sorenson, 1990). The same sieve was
rediscovered and observed to take linear time by Gries & Misra (1978). It, too, starts with a list of
numbers from 2 to n in order. On each step the first element is identified as the next prime and the
results of multiplying this prime with each element of the list are marked in the list for subsequent
deletion. The initial element and the marked elements are then removed from the working
sequence, and the process is repeated.
Algorithm 4.1.2: Sieve of Euler
The algorithm starts with a list of numbers from 2 to n and goes as follows:
1. Create a list of consecutive integers from 2 through n: (2, 3, 4, ..., n).
2. Initially, let p equal 2, the smallest prime number.
3. If p2 > n the algorithm terminates. Primes are the numbers that remain
4. Otherwise build a new list by multiplying every element of original list by p. remove every
element from this list from the original list.
5. Go to the step 1.
As we can see only the step 3 is substantially different. We remove numbers instead of crossing
them out and they are not considered afterwards. Nevertheless, the number of iterations will be the
same as before.
Twin Prime
36
Example 4.1.2:
To find all the prime numbers less than or equal to 30, proceed as follows.
First generate a list of integers from 2 to 30:
Iteration 0: 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Iteration 1: ཱ 3 5 7 9 11 13 15 17 19 21 23 25 27 29
Iteration 2: ཱ ི 3 5 7 11 13
17 19
23 25 29
Iteration 3: ཱ ི ུ 7 11 13
17 19
23 29
Result: ཱ ི ུ 7 8 11 13
17 19
23 29
$VDUHVXOWLPSOHPHQWDWLRQVRI(XOHU¶VVLHYHWHQGWREHVORZHUWKDQWKHVLHYHRI(UDWRVWKHQHV
4.1.3 Sieve of Fabio
Giraldo-Franco & Dyke (2001) presented an interesting prime sieve called Fabio's sieve.
This sieve gives a better way to find the prime numbers than the above two sieves. The list of
prime numbers was found using only regular and independent patterns. It is a new tool used to
prove some of the conjectures that still are unsolved about primes.
Algorithm 4.1.3: Sieve of Fabio
Here is the Algorithm or pseudo code for the new sieve.
7RILQGDOOWKHSULPHQXPEHUVOHVVWKDQRUHTXDOWRDJLYHQLQWHJHUVQE\XVLQJWKH)DELR¶VVLHYH
do:
Twin Prime
37
1. &UHDWHDOLVWRIFRQVHFXWLYHLQWHJHUVIURPWRQ^«Q`
2. /HW³S´HTXDOWKHILUVWSULPe number
3. Create the expression J*K + M*N.
4. ,QLWLDOO\OHW- S. S0 SDQG1 ^«««`
5. Compare M against the product of J times K and do:
5.1.,I0ޓ- .GR
5.1.1. Calculate J*K + M*N and remove from the list all the resulting numbers less
than or equal to n.
5.1.2. Find the 1st QXPEHUUHPDLQLQJRQWKHOLVWDIWHU³S´ ZKLFKLVWKHQH[WSULPH GR
M equals 0WLPHV³WKLVQXPEHU´LH 0 0 WKLVQXPEHU DQGWKHQUHSODFH
³S´ZLWK³WKLVQXPEHU´ EHFDUHIXOQRWZLWKWKHQHZYDOXHRI0
5.1.3. Do J = p and K = p.
5.1.4. Repeat step 5 until K2 (which is the same as p2) is greater than n.
5.2.,I0ޓ- .GR
5.2.1. Calculate J*K + M*N and remove from the list all the resulting numbers less
than or equal to n.
5.2.2. Find the 1st QXPEHUUHPDLQLQJRQWKHOLVWDIWHU³-´ ZKLFKLVWKHQH[WSUime),
DQGUHSODFH³M´ZLWK³WKLVQXPEHU´
5.2.3. ,I- .ޓQJRWRVWHS
5.2.4. Repeat step 5 until K2 is greater than n.
6. All the remaining numbers in the list are prime numbers.
Twin Prime
38
Example 4.1.3:
To find all the prime numbers less than or equal to 100, proceed as follows.
We start stating the initial sequence, S, of the positive integers, from 2 to 30, i.e., S = {2, 3 ,4, 5
«`
Then, by following the algorithm instructions, we found:
Pattern A: with a = 4 and d = 2,
^«`
Removing the numbers in patter A, from S, we have:
S = {2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 48, 49,
51, 53, 55, 57«««««`.
Then, we found Pattern B: with a = 9 and d =6,
{9, 15, 21, 27, 33,39, 45, 51, 57, 63, ««}
Removing the numbers in pattern B, from S, we have:
S = {2, 3, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 35, 37, 41, 43, 47, 49, 53, 55, 59, 61, 65, 67, 71, 73,
77, 79, 83, 85, 89, 91, 95, 97}
Then, we found Pattern C: with a=25 and d = 30,
^«««`
Then, removing the numbers in pattern C, from S, we have:
Twin Prime
39
S = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 35, 37, 41, 43, 47, 49, 53, 59, 61, 65, 67, 71, 73, 77, 79,
83, 89, 91, 95, 97}
Then, we found pattern D: with a = 35 and d =30,
{35, 65, 95«}
Then, removing the numbers in pattern D, from S, we have:
S = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 49, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89,
91, 97}
Then, we found pattern E: with a = 49 and d = 210,
6 ^«`
Then, removing the numbers in E, from S, we have:
S = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 77, 79, 83, 89, 91,
95, 97}
Then, we found pattern F: with a = 77 and d = 210,
6 ^«`
Then, removing the numbers in F, from S, we have:
S = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 65, 67, 71, 73, 79, 83, 89, 91,
97}
Twin Prime
40
Then, we found pattern G: with a = 91 and d = 210,
S = {91, 301 «`
Then, removing the numbers in G, from S, we have:
S = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97}
4.1.4 Sieve of Sundaram
Ogilvy & Anderson (1988) SUHVHQWDQLQWHUHVWLQJSULPHVLHYHFDOOHG6XQGDUDP¶VVLHYH,W
was discovered by an Indian mathematician S. P. Sundaram in 1934. The algorithm, as usual, starts
with a list of numbers from 1 to n. This time, however, we will sieve numbers up to 2n +2 as this
sieve explicitly does not consider even numbers. Now we cross out all numbers of the form i + j +
LMQZKHUHLM
ିଵ
ଷ
. The primes are obtained by taking all the numbers that were not
considered out, multiplying them by 2 and incrementing by 1. Notice that 2 will not be on the list.
Algorithm 4.1.4: Sieve of Sundaram
Assume we want to make a list of prime numbers up to a given integer n by 6XQGDUDP¶V
method:
i.
Create a list of N positive integers (1,2...,N)
ii.
Iterate over them using nested loop of i, j where 1Lj for all i,jİN 1,j
all i,jİN
iii.
Mark i+j+2כiכji+j+2כiכj as non-prime.
iv.
Remaining numbers are doubled and incremented by one, i.e., n=2כk+1n=2כk+1
R
Output: This will give all odd prime integers, i.e., prime integers excluding 2
for
Twin Prime
41
4.1.5 Sieve of Atkin
Atkin & Bernstein (2004) propose a completely different approach. They use quadratic
forms to separate primes from composite numbers.
The sieve of Atkin is a modern algorithm for finding all prime numbers up to a specified integer.
Compared with the ancient sieve of Eratosthenes, which marks off multiples of primes, the sieve
of Atkin does some preliminary work and then marks off multiples of squares of primes, thus
achieving a better theoretical asymptotic complexity.
Algorithm 4.1.5: Sieve of Atkin
In the algorithm:
x
All remainders are (mod60) (divide the number by 60 and return the remainder).
x
All numbers, including x and y, are positive integers.
x
Flipping an entry in the sieve list means to change the marking (prime or nonprime) to the
opposite marking.This results in numbers with an odd number of solutions to the
corresponding equation being potentially prime (prime if they are also square free), and
numbers with an even number of solutions being composite.
The algorithm:
1. Create a results list, filled with 2, 3, and 5.
2. Create a sieve list with an entry for each positive integer; all entries of this list should
initially be marked non prime (composite).
3. For each entry number n in the sieve list, with modulo-sixty remainder r :
a) If r is 1, 13, 17, 29, 37, 41, 49, or 53, flip the entry for each possible solution
to 4x2 + y2 = n.
Twin Prime
42
b) If r is 7, 19, 31, or 43, flip the entry for each possible solution to 3x2 + y2 = n.
c) If r is 11, 23, 47, or 59, flip the entry for each possible solution
to 3x2 í y2 = n when x > y.
d) If r is something else, ignore it completely.
4. Start with the lowest number in the sieve list.
5. Take the next number in the sieve list still marked prime.
6. Include the number in the results list.
7. Square the number and mark all multiples of that square as non prime.
8. Repeat steps four through seven.
4.1.6 Sieve of Pritchard
We have seen several different sieves that enumerate the prime numbers not greater
than n due to Eratosthenes, Atkin, Euler and Sundaram. In the 1981, Paul Pritchard, an Australian
mathematician, developed a family of sieve algorithms based on wheels, eventually finding an
algorithm with O(n / log log n) time complexity and O ¥n) space complexity. We examine a simple
YHUVLRQRI3ULWFKDUG¶VZKHHOVLHYH
We begin with some definitions.
x
Mk is the product of the first k primes; for instance, M7= 2×3×5×7×11×13×17=510510.
x
The totatives of Mk are those numbers from 1 to Mk that are coprime to Mk (that is, they
have no factors in common).
Algorithm 4.1.6: Sieve of Pritchard
It is easy to determine the totatives of Mk by sieving:
i.
make a list of the integers from 1 to Mk,
Twin Prime
43
ii.
then for each of the primes that form the product Mk, strike out from the list
iii.
the prime and all of its multiples; for instance, with M3=2×3×5=30, sieving with 2
strikes out 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28 and 30, sieving with 3 strikes
out 3, 6, 9, 12, 15, 18, 21, 24, 27, and 30, and sieving with 5 strikes out 5, 10, 15, 20,
25 and 30, leaving the totatives 1, 7, 11, 13, 17, 19, 23 and 29.
A factoring wheel Wk contains the gaps between successive totatives, wrapping around at
the end; for instance, W3 consists of the gaps 6, 4, 2, 4, 2, 4, 6 and 2, corresponding to the gaps
ííDQGVRRQHQGLQJZLWKíDQGí29 when the wheel wraps around at the end.
3ULWFKDUG¶VZKHHOVLHYHXVHVZKHHOVUHSHDWHGO\WRVWULNHRXWFRPSRVLWHQXPEHUVIURPWKH
sieve. It operates in two phases: a setup phase and a processing loop.
i.
The setup phase first computes a parameter k such that Mk < n / loge n < Mk+1, then
computes the wheel Wk and forms the set S from 1 to n by rolling the Wk wheel. The
setup phase also computes the list of m primes not greater than the square root of n.
Example 4.1.6.1:
We compute the primes not greater than 100 as an example. We compute k=2, since 100/log(100)
is 21.714724 which is between M2=6 and M3=30. The W2 wheel is {4 2} and the set S is {1 5 7 11
13 17 19 23 25 29 31 35 37 41 43 47 49 53 55 59 61 65 67 71 73 77 79 83 85 89 91 95 97};
although there is only one set S, we will refer to this set as S2, since it is the result of rolling
the W2 wheel. Finally, the square root of 100 is 10, and the m=4 primes less than 10 are {2 3 5 7}.
ii.
The processing loop iterates from k+1 to m. At each loop we will strike some of the
elements of S, reducing S from Sk to Sk+1. Each time through the loop we first identify p,
the smallest member of S that is greater than 1, and strike it from the set S. We also
Twin Prime
44
strike from S the successive multiples p(s ís) less than n, where s ís are the successive
gaps in S. Finally, we increment k by 1 and repeat the loop as long as k m.
Example 4.1.6.2:
In our example computing the primes not greater than 100, i will take the values 3 and 4. The first
time through the loop, p = 5, the gaps DUH í í í í í DQG
í DQG WKH QXPEHUV WKDW DUH VWULFNHQ DUH î î î
55+2×5=65, 65+4×5=85, and 85+2×5=95, leaving S3 = {1 7 11 13 17 19 23 29 31 37 41 43 47 49
53 59 61 67 71 73 77 79 83 89 91 97}. The second time through the loop, p = 7, the gaps are
í í í í DQG í DQG WKH QXPEHUV WKDW DUH VWULFNHQ DUH
7+6×7=49, 49+4×7=77, and 77+2×7=91, leaving S4 = {1 11 13 17 19 23 29 31 37 41 43 47 53 59
61 67 71 73 79 83 89 97}.
Once k>m and the final S has been computed, the list of primes is returned, consisting of
the primes less than the square root of n followed by the elements of S excluding 1. Thus the primes
not greater than 100 are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
79, 83, 89 and 97.
Twin Prime
45
4.1.7 Twin Prime Sieving Algorithms
The following algorithms will be able to generate or sieve all the twin primes in any range of odd
numbers which are all larger than those in the list of known consecutive primes/twin primes; these
2 important algorithms will provide plenty of numerical evidence that the twin primes are infinite:Algorithm 1
We would provide an example with Items (1) to (3) from the following list of products of
consecutive primes/twin primes, which should be sufficient for our purpose here:1) 3 x 5 = 15
2) 3 x 5 x 7 = 105
3) 3 x 5 x 7 x 11 = 1,155
4) 3 x 5 x 7 x 11 x 13 = 15, 015
5) 3 x 5 x 7 x 11 x 13 x 17 = 255,255
6) 3 x 5 x 7 x 11 x 13 x 17 x 19 = 4,849,845
.
.
.
.
The example is as follows:1) For 3 x 5 = 15, we would find all the consecutive pairs of odd numbers between 5 & 15
which differ from one another by 2 and are not divisible by any of the consecutive
primes/twin primes 3 & 5 in the list of consecutive primes/twin primes 3 x 5 whose product
is 15.
There is only 1 pair of odd numbers between 5 & 15 which differ from one another by 2
and are not divisible by the consecutive primes/twin primes 3 & 5 in the list of consecutive
primes/twin primes 3 x 5 - they are the twin primes 11 & 13.
Twin Prime
46
2) Similarly, for 3 x 5 x 7 = 105, we would find all the consecutive pairs of odd numbers
between 7 & 105 which differ from one another by 2 and are not divisible by any of the
consecutive primes/twin primes 3, 5 & 7 in the list of consecutive primes/twin primes 3 x
5 x 7 whose product is 105.
The consecutive pairs of odd numbers between 7 & 105 which differ from one another by
2 and are not divisible by the consecutive primes/twin primes 3, 5 & 7 are the following
consecutive twin primes:
a) 11 & 13
b) 17 & 19
c) 29 & 31
d) 41 & 43
e) 59 & 61
f) 71 & 73
g) 101 & 103
3) Similarly, in this final case, for 3 x 5 x 7 x 11 = 1,155, we would find all the consecutive
pairs of odd numbers between 11 & 1,155 which differ from one another by 2 and are not
divisible by any of the consecutive primes/twin primes 3, 5, 7 & 11 in the list of consecutive
primes/twin primes 3 x 5 x 7 x 11 whose product is 1,155.
Many of the consecutive pairs of odd numbers between 11 & 1,155 which differ from one
another by 2 and are not divisible by the consecutive primes/twin primes 3, 5, 7 & 11 are
twin primes (while the rest are primes larger than 3, 5, 7 & 11 and/or composite numbers
whose prime factors are each larger than 3, 5, 7 & 11), some of which are as follows:
a) 17 & 19
Twin Prime
47
b) 29 & 31
c) 41 & 43
d) 59 & 61
e) 71 & 73
f) 101 & 103
g) 107 & 109
h) 137 & 139
i) 149 & 151
j) 179 & 181
k) Etc. to 1,151 & 1,153
In this way, we would also be able to achieve the following:1) For 3 x 5 x 7 x 11 x 13 = 15,015, find all the consecutive twin primes between 13 and
15,015.
2) For 3 x 5 x 7 x 11 x 13 x 17 = 255,255, find all the consecutive twin primes between 17
and 255,255.
3) For 3 x 5 x 7 x 11 x 13 x 17 x 19 = 4,849,845, find all the consecutive twin primes between
19 and 4,849,845.
Twin Prime
48
Algorithm 2
We would, similar to Algorithm 1 above, also provide an example with Items (1) to (3) from the
following list of products of consecutive primes/twin primes, which should be sufficient for our
purpose here:1) 3 x 5 = 15
2) 3 x 5 x 7 = 105
3) 3 x 5 x 7 x 11 = 1,155
4) 3 x 5 x 7 x 11 x 13 = 15, 015
5) 3 x 5 x 7 x 11 x 13 x 17 = 255,255
6) 3 x 5 x 7 x 11 x 13 x 17 x 19 = 4,849,845
.
.
.
.
The example is as follows:1) For 3 x 5 = 15, we would first find all the consecutive pairs of even numbers between 5 & 15
which differ from one another by 2 and are not divisible by any of the consecutive primes/twin
primes 3 & 5 in the list of consecutive primes/twin primes 3 x 5. Then we deduct each of these
consecutive pairs of even numbers which are not divisible by any of the consecutive primes/twin
primes 3 & 5 from the product of these consecutive primes/twin primes 3 x 5 which is 15. The
results would each be 1 pair of twin primes, 1 prime & 1 composite of primes, or, 2 composites of
primes. In this way, we would be able to find all the consecutive twin primes between 5 & 15.
There is only 1 pair of even numbers between 5 & 15 which differ from one another by 2 and are
not divisible by any of the consecutive primes/twin primes 3 & 5 in the list of consecutive
primes/twin primes 3 x 5 - they are the pair 2 & 4.
Twin Prime
49
The following is the result after we deduct this pair of even numbers 2 & 4 which are not divisible
by any of the consecutive primes/twin primes 3 & 5 from the product of these consecutive
primes/twin primes 3 x 5 which is 15:
(a) 15 - 2 & 15 - 4: 13 & 11 (twin primes)
2) Similarly, for 3 x 5 x 7 = 105, we would first find all the consecutive pairs of even numbers
between 7 & 105 which differ from one another by 2 and are not divisible by any of the consecutive
primes/twin primes 3, 5 & 7 in the list of consecutive primes/twin primes 3 x 5 x 7, which are as
follows:
(a) 2 & 4
(b) 32 & 34
(c) 44 & 46
(d) 62 & 64
(e) 74 & 76
(f) 86 & 88
(g) 92 & 94
Then we deduct each of these consecutive pairs of even numbers which are not divisible by any of
the consecutive primes/twin primes 3, 5 & 7 from the product of these consecutive primes/twin
primes 3 x 5 x 7 which is 105. The results would each be 1 pair of twin primes, 1 prime & 1
composite of primes, or, 2 composites of primes.
In this way, we would be able to find all the consecutive twin primes between 7 & 105, which are
as follows:
(a) 105 - 2 & 105 - 4: 103 & 101 (twin primes)
(b) 105 - 32 & 105 - 34: 73 & 71 (twin primes)
Twin Prime
50
(c) 105 - 44 & 105 - 46: 61 & 59 (twin primes)
(d) 105 - 62 & 105 - 64: 43 & 41 (twin primes)
(e) 105 - 74 & 105 - 76: 31 & 29 (twin primes)
(f) 105 - 86 & 105 - 88: 19 & 17 (twin primes)
(g) 105 - 92 & 105 - 94: 13 & 11 (twin primes)
3) Similarly, in this final case, for 3 x 5 x 7 x 11 = 1,155, we would first find all the consecutive
pairs of even numbers between 11 & 1,155 which differ from one another by 2 and are not divisible
by any of the consecutive primes/twin primes 3, 5, 7 & 11 in the list of consecutive primes/twin
primes 3 x 5 x 7 x 11, some of which are as follows:
(a) 2 & 4
(b) 32 & 34
(c) 62 & 64
(d) 74 & 76
(e) 92 & 94
(f) 116 & 118
(g) 122 & 124
(h) 134 & 136
(i) Etc. to 1,136 & 1,138
Next we deduct each of these consecutive pairs of even numbers which are not divisible by any of
the consecutive primes/twin primes 3, 5, 7 & 11 from the product of these consecutive primes/twin
primes 3 x 5 x 7 x 11 which is 1,155. The results would each be 1 pair of twin primes, 1 prime &
1 composite of primes, or, 2 composites of primes. In this way, we would be able to find all the
consecutive twin primes between 11 & 1,155, some of which are as follows:
Twin Prime
51
Table 1
Consecutive twin primes between 11 and 1,155
No
Prime Pairs
Description
a)
1,155 -2 & 1,155 -4
1,153 & 1,151 (twin primes)
b)
1,155 -32 & 1,155 -34
1,123 (Prime) & 1,121 (composite of primes
which are each larger than 3,5,7 & 11 = 19 x 59)
c)
1,155 -62 & 1,155 -64
1,093 & 1,091 (twin primes)
d)
1,155 -74 & 1,155 -76
1,081 (composite of primes which are each larger
than 3,5,7 & 11 = 23 x 47)
& 1079 (composite of primes which are larger
than 3,5,7 & 11 = 13 x 83)
e)
1,155 -92 & 1,155 -94
1,063 & 10,61 (twin primes)
f)
1,155 -116 & 1,155 -118
1,039 ( prime) & 1,037 (composite of primes
which are each larger than 3, 5, 7 & 11 = 17 x 61)
g)
1,155 -122 & 1,155 -124
1,033 & 1,031 (twin primes)
h)
1,155 -134 & 1,155 -136
1,021 & 1,019 (twin primes)
i)
1,155 -1136 & 1,155 -1138
k)
Etc
19 & 17 (twin primes
Note: In like manner, we would also be able to achieve the following:1) For 3 x 5 x 7 x 11 x 13 = 15,015, find all the consecutive twin primes between 13 and 15,015.
2) For 3 x 5 x 7 x 11 x 13 x 17 = 255,255, find all the consecutive twin primes between 17 and
255,255.
Twin Prime
52
3) For 3 x 5 x 7 x 11 x 13 x 17 x 19 = 4,849,845, find all the consecutive twin primes between 19
and 4,849,845.
By utilizing any of the above algorithms (preferably the evidently more efficient Algorithm 1), we
will be able to find many twin primes which are all larger than those in any chosen list of
consecutive primes/twin primes, i.e., we will be able to generate many larger and larger twin
primes with these algorithms.
It would evidently be difficult to accept a proof of the twin primes conjecture without having to
confirm or check the validity of the logic by computing a sufficiently long list of twin primes, even
to the extent of looking out for counter-examples. Hence, the great importance of the above
algorithms.
4.2
Sieve methods
Sieve theory is a set of general techniques in number theory, designed to count, or more
realistically to estimate the size of, sifted sets of integers. The prototypical example of a sifted set
is the set of prime numbers up to some prescribed limit X. (Mollin, 2000)
Sieves can be used to tackle the following questions:
i.
Are there infinitely many primes p such that p+2 is also prime?
ii.
Are there infinitely many primes p such that p = n2 + 1 for some n ഌ N?
iii.
Are there infinitely many primes p such that 4p +1 is also prime?
iv.
Is every sufficiently large n a sum of two primes?
v.
Is it true that the interval (n2, (n+1)2) contains at least one prime for every n ഌ N*?
These problems are still open, but, using sieves methods, some steps towards their solutions
have been done. For example, in 1966 Chen proved a weaker version of iv) stating that every
Twin Prime
53
sufficiently large n is a sum of a prime and a P2 (where Pr denotes the numbers that have at most r
prime factors).
All of the problems are long standing problems, tantalizing the mathematicians for
centuries. For a very long time there was virtually no method to approach them. That was till
around 1920 when Vigo Brun showed the following theorems:
4.2.1
Complexity and Time consumption of Sieving Algorithms
The sieve of Eratosthenes is generally considered the easiest sieve to implement, but it is
not the fastest in the sense of the number of operations for a given range for large sieving ranges.
In its usual standard implementation (which may include basic wheel factorization for small
primes), it can find all the primes up to N in time Ͳሺ ሻ , while basic implementations of
the sieve of Atkin and wheel sieves run in linear time Ͳሺሻ. Special versions of the Sieve of
Eratosthenes using wheel sieve principles can have this same linearͲሺሻ time complexity. A
special version of the Sieve of Atkin and some special versions of wheel sieves which may include
sieving using the methods from the Sieve of Eratosthenes can run in sublinear time complexity of
ͲሺȀ ሻ . Note that just because an algorithm has decreased asymptotic time complexity
does not mean that a practical implementation runs faster than an algorithm with a greater
asymptotic time complexity: Ͳሺ ሻǤ
Time Complexity of Sieve of Eratosthenes
i.
Time taken to iterate over N non-prime, 7 1 17 1í 7 1 17 1í
ii.
In
next
step,
finding
the
immediate
prime
time t and 7 1í WכN/2+tכ7 1í 7 1í WכN/2+tכ7 1í
iii.
The trivial case, finding last non-prime is again T(1)=kT(1)=k
number
takes
some
Twin Prime
54
iv.
Iterating over rest will take constant time for each, i.e., total complexity would
be O(N)O(N) which is less than searching.
v.
T(N)=N+N/2« כ1 1« כ1 «
Therefore,
O(Nlog(logN))
Time Complexity of Sieve of Sundaram:
i.
Time
taken
to
iterate
over
N
numbers
and
mark
non-
primes, 7 1 17 1í 7 1 17 1í
ii.
The above operation will reduce size list by half.
iii.
So time taken in next step (N - 1) will be, 7 1í 17 1í 7 1í 17 1í
iv.
When i, j is maximum, there are no more non-prime is left. So the trivial case would
be T(1)=kT(1)=k
v.
To double the rest and increment by one, it will constant time for each. Total
of O(N)O(N) which is definitely less than the time taken for removing non-primes.
vi.
Therefore, 7 1 111« 7 1 111« O (N logN)
Time Complexity of Sieve of Sundaram:
3ULWFKDUG¶VVLHYHKDVWLPHFRPSOH[LW\DQGVSDFHFRPSOH[LW\ERWKHTXDOWR O(n), where the
standard sieve of Eratosthenes has time complexity O(n log log n). The improvement comes from
WKHIDFWWKDW3ULWFKDUG¶VVLHYHVWULNHVHDFKFRPSRVLWHRQO\RQFHZKHUHDV(UDWRVWKHQHV¶VLHYHVWULNHV
each composite once for each of its distinct prime IDFWRUVIRULQVWDQFH(UDWRVWKHQHV¶VLHYHVWULNH
15 twice, one for the factor of 3 and once for the factor of 5. But despite the improvement in the
DV\PSWRWLFFRPSOH[LW\(UDWRVWKHQHV¶VLHYHLVIDVWEHFDXVHLWVLQQHUORRSFRQVLVWVRQO\RIDGGLWLRQ
while 3ULWFKDUG¶VVLHYHLVVORZHUEHFDXVHLWVLQQHUORRSFRQVLVWVRIDVXEWUDFWLRQWRFRPSXWHWKH
gap in the wheel, a multiplication to extend that gap by the current sieving prime, and an addition
Twin Prime
55
to add the gap to the previously-stricken element. Thus, in praFWLFH(UDWRVWKHQHV¶VLHYHLVIDVWHU
WKDQ3ULWFKDUG¶V
It is easy to obtain a theoretical bound on the number of steps needed to obtain a list of
SULPHVXSWRWKHQXPEHUQOHW¶VVWDUWOLNHDOZD\VZLWKDOLVWRI$RIQXPEHUVIURPWRQZH
require at the end of an algorithm to be able to distinguish prime numbers from the rest. It means
that A[i] ് A [j] for every pair of numbers where either i or j (but not both!) is prime. But this
PHDQVWKDWWKHDOJRULWKPKDVWRFKDQJHWKHYDOXHDWOHDVWʌ Q QXPEHU of primes) or (n ± ʌ Q
(number of composites) elements.
7KHUXQQLQJFRPSOH[LW\IRUHDFKDOJRULWKPFDQEHVXPPDUL]HGDV´
Sieve of Eratosthenes ± 0 (n).
Sieve of Sundaram - O (N logN).
Sieve of Atkin ± O (n / log log n).
Sieve of Pritchard ± O (n / log log n).
And the running time of any prime sieving algorithm is at least:
PLQ ʌ Q Q± ʌ Q PLQ QORJQQ± n / log n) = n / log n,
Twin Prime
56
CHAPTER FIVE
CONCLUSION
In this study we presented the Twin Prime Conjecture and prime sieving algorithms.
Firstly, we formulated and proved some important theorems on the prime numbers which we use
them to prove the important facts about twin primes.
The second objective of this study was to present the current knowledge about the twin
prime conjecture. Moreover, we showed few related problems in the number theory. The positive
answer to some of them would imply the Twin Prime Conjecture (Conjecture 3.2.7 and Theorem
3.2.1). We also presented couple of ways to characterize twin primes with the proofs (Theorem
3.2.2).
The study gave an exposition of important prime sieving algorithms. Although the most
popular in the sieve methods is that of Eratosthenes, we showed that it is not the most optimal
algorithm for this problem (4.1.7 Twin Prime Sieving Algorithms). Apart from presentation of this
algorithm, we also showed possible improvements that can be made to improve both running and
space complexity.
Lastly we state the complexity and time consumption of the presented counting algorithms
and deduce theoretical bounds on the complexity of any sieving algorithm.
The twin prime conjecture remains unproven, but definitely there are serious attempts to
SURYHLW,W¶VQRWFOHDUKRZHYHULIWKHSUREOHPFDQEHXOWLPDWHO\UHVROYHGZLWKWKHKHOSRIVLHYH
methods. There has been a lot of successful research on the Twin Prime Conjecture and empirical
evidence confirms it, but the main question remains open: are there infinitely many twin primes?
Twin Prime
57
REFERENCES
Apostol, T. M. (2013). Introduction to analytic number theory. Springer Science & Business
Media.
Atkin, A., & Bernstein, D. (2004). Prime sieves using binary quadratic forms. Mathematics of
Computation, 73(246), 1023-1030.
Bohman, J. (1973). Some computational results regarding the prime numbers below
2,000,000,000. BIT Numerical Mathematics, 13(2), 242-244.
Boyer, C. B., & Merzbach, U. C. (2011). A history of mathematics. John Wiley & Sons.
Brent, R. P. (1975). Irregularities in the distribution of primes and twin primes. Mathematics of
Computation, 29(129), 43-56.
Brun, V. (1919). La serie 1/5+ 1/7+... estconvergenteounie. Bull. Sci. Math, 43, 124-128.
Buchert, T. (2011). On the twin prime conjecture 'RFWRUDOGLVVHUWDWLRQ0DVWHU¶VWKHVLV$GDP
0LFNLHZLF]8QLYHUVLW\LQ3R]QDĔ)DFXOW\RI0DWKHPDWLFVDQG&RPSXWHU6FLence).
Burton, D. M. (2006). Elementary number theory. Tata McGraw-Hill Education.
Communications of the ACM, 21(12), 999-1003.
ComputerScience Technical Report.
Courant, R., Robbins, H., & Stewart, I. (1996). What is Mathematics?: an elementary approach to
ideas and methods. OUP Us.
dePolignac, A. (1849). Six arithmetical propositions deduced from the sieve of Eratosthene.
Annals of Mathematics, Journal of Candidates for Polytechnic and Normal Schools, 8, 423429.
Dietzfelbinger, M. (2004). Primality testing in polynomial time: from randomized algorithms to"
PRIMES is in P" (Vol. 3000). Springer.
Twin Prime
58
Elliott, P. D. T. A., &Halberstam, H. (1971).The least prime in an arithmetic progression. Studies
in Pure Mathematics, Academic Press, London/New York, 59-61.
Ford, K., Green, B., Konyagin, S., & Tao, T. (2014). Large gaps between consecutive prime
numbers. arXiv preprint arXiv:1408.4505.
Ford, K., Green, B., Konyagin, S., Maynard, J., & Tao, T. (2014). Long gaps between
primes. arXiv preprint arXiv:1412.5029.
Fröberg, C. E. (1961). On the sum of inverses of primes and of twin primes. BIT Numerical
Mathematics, 1(1), 15-20.
*ROGVWRQ ' $ 3LQW] -
<ÕOGÕUÕP & < 6PDOO JDSV EHWZHHQ SULPHV ,,
(Preliminary). Preprint, February, 8.
Goldston, D. A., Pintz, J., & Yildirim, C. Y. (2011). Positive proportion of small gaps between
consecutive primes. arXiv preprint arXiv:1103.3986.
Gries, D., & Misra, J. (1978). A linear sieve algorithm for finding prime numbers.
Guy, R. (2013). Unsolved problems in number theory (Vol. 1).Springer Science & Business Media.
Halberstam, H., & Richert, H. E. (2013). Sieve methods. Courier Corporation.
+DUG\*+ /LWWOHZRRG-( 6RPHSUREOHPVRI³3DUWLWLR1XPHURUXP´ 9 $IXUWKHU
contribution to the study of Goldbach's problem. Proceedings of the London Mathematical
Society, 2(1), 46-56.
Hardy, G. H., & Wright, E. M. (1979). An introduction to the theory of numbers. Oxford University
Press.
Hosch, W. L. (2010). The Britannica Guide to Numbers and Measurement. The Rosen Publishing
Group.
Johnson, J. M. (2003). On the distribution of primes. The Mathematics Teacher, 96(3), 198.
Twin Prime
59
Johnson, P. S. (2015). Number Theory Part-1.
Lehmer, D. N. (1914). List of Prime Numbers from 1 to 10,006,721. Washington, DC: Carnegie
institution of Washington.
Mandelbrot, B. B., & Pignoni, R. (1983). The fractal geometry of nature (Vol. 1). New York: WH
freeman.
Maynard, J. (2013). Small gaps between primes. arXiv preprint arXiv:1311.4600.
Maynard, J. (2014). Large gaps between primes. arXiv preprint arXiv:1408.5110.
Motohashi, Y. (2014). The twin prime conjecture. arXiv preprint arXiv:1401.6614.
Nazardonyavi, S. (2012).Some history about Twin Prime Conjecture. arXiv preprint
arXiv:1205.0774.
Neudecker, W. (1975, 0DUFK 2QWZLQ µSULPHV¶DQGJDSVEHWZHHQVXFFHVVLYHµSULPHV¶IRUWKH
Hawkins random sieve. In Mathematical Proceedings of the Cambridge Philosophical
Society (Vol. 77, No. 02, pp. 365-367).Cambridge University Press.
Ogilvy, C. S., & Anderson, J. T. (1988). Excursions in number theory. Courier Corporation.
Paul, S. Twin Prime Conjecture Proof.
Pintz, J. (2013). Polignac Numbers, Conjectures of Erd\" os on Gaps between Primes, Arithmetic
Progressions in Primes, and the Bounded Gap Conjecture. arXiv preprint arXiv:1305.6289.
Polymath, D. H. J. (2014).Variants of the Selberg sieve, and bounded intervals containing many
primes. Research in the Mathematical Sciences, 1(1), 1.
Pritchard, P. (1994, May). Improved incremental prime number sieves. In International
Algorithmic Number Theory Symposium (pp. 280-288). Springer Berlin Heidelberg.
6HEDK3 *RXUGRQ; ,QWURGXFWLRQWRWZLQSULPHVDQG%UXQ¶VFRQVWDQWFRPSXWDWLRQ
Twin Prime
60
Selmer, E. S. (1942). A special summation method in the theory of prime numbers and its
DSSOLFDWLRQWR¶%UXQ¶VVXP¶ Nordisk Mat. Tidskr, 24, 74-81.
Shanks, D. (1960).On the conjecture of Hardy & Littlewood concerning the number of primes of
the form ݊²+ ܽ.Mathematics of Computation, 14(72), 321-332.
Shanks, D., & Wrench, J. W. (1974). BrXQ¶VFRQVWDQW mathematics of computation, 28(125), 293299.
Sorenson, J. (1990). AN INTRODUCTION T0 PRIME NUMBER SIEVES (Vol. 909).
6XQGDUDP63 $L\DU95 6XQGDUDP¶VVLHYHIRUSULPHQXPEHUV The Mathematics
Student, 2, 73.
Tao, T. (2014). Every odd number greater than 1 is the sum of at most five primes. Mathematics
of Computation, 83(286), 997-1038.
Weintraub, S. (1973). On Storing and Analyzing Large Strings of Primes. The Fibonacci
Quarterly, 11(4), 438-440.
Zhang, Y. (2014). Bounded gaps between primes. Annals of Mathematics, 179(3), 1121-1174.
Twin Prime
61
APPENDIX I
ANECDOTAL EVIDENCE OF THE INFINITY OF THE TWIN PRIMES
TOP TWIN PRIMES IN 2000, 2001, 2007, 2009, 2011 & 2016
In the year 2000, 4648619711505 x 260000± 1 (18,075 digits) had been the top twin primes
pair which had been discovered.
In the year 2001, it only ranked eighth in the list of top 20 twin primes pairs, with
ǜ107001±1 (32,220 digits) topping the list.
In the year 2007, in the list of WRSWZLQSULPHVSDLUVǜ107001±1 (32,220 digits)
ranked eighth, while 4648619711505 x 260000 ± 1 (18,075 digits) was nowhere to be seen;
2003663613*2195000-1 and 2003663613*2195000+1 (58,711 digits), which was discovered on
January 15, 2007, by Eric Vautier (from France) of the Twin Prime Search (TPS) project in
collaboration with PrimeGrid (BOINC platform), was at the top of the list.
As at August 2009, 65516468355 · 2333333-1 and 65516468355 · 2333333+1 (100,355 digits)
LVDWWKHWRSRIWKHOLVWRIWRSWZLQSULPHVSDLUVZKLOHǜ107001 ±1 (32,220 digits) ranks
11th., and, 2003663613*2195000-1 and 2003663613*2195000+1 (58,711 digits) ranks second in this
list.
As at December 2011, the largest twin prime pair is 3756801695685*2666669±1 (200,700
digits) long, eclipsing the previous record of 100,355 digits. Discovered by Timothy D. Winslow
of the USA.
As
of
September
2016,
the
current
largest
twin
prime
pair
known
is
2996863034895*21290000±1 (388,342 digits) long, eclipsing the previous record of 200,700 digits.
It was discovered by Tom Greer of the United States.
Twin Prime
62
We can expect larger twin primes than these extremely large twin primes, much larger
ones, infinitely larger ones, to be discovered in due course.
LIST OF PRIMES PAIRS FOR THE FIRST 2,500 CONSECUTIVE PRIMES, 2 TO
22,307, RANKED ACCORDING TO THEIR FREQUENCIES OF APPEARANCE
S. No.
Ranking Prime Pairs
No. Of Pairs
Percentage
1.
1 primes pair separated by 6 integers
482
19.29 %
2.
2 primes pair separated by 4 integers
378
15.13 %
3.
3 primes pair separated by 2 integers (t. p.)
376
15.05 %
4.
4 primes pair separated by 12 integers
267
10.68 %
5.
5 primes pair separated by 10 integers
255
10.20 %
6.
6 primes pair separated by 8 integers
229
9.16 %
7.
7 primes pair separated by 14 integers
138
5.52 %
8.
8 primes pair separated by 18 integers
111
4.44 %
9.
9 primes pair separated by 16 integers
80
3.20 %
10.
10 primes pair separated by 20 integers
47
1.88 %
11.
11 primes pair separated by 22 integers
46
1.84 %
12.
12 primes pair separated by 30 integers
24
0.96 %
13.
13 primes pair separated by 28 integers
19
0.76 %
14.
14 primes pair separated by 24 integers
16
0.64 %
15.
15 primes pair separated by 26 integers
10
0.40 %
16.
16 primes pair separated by 34 integers
9
0.36 %
17.
17 primes pair separated by 36 integers
5
0.20 %
Twin Prime
63
18.
18 primes pair separated by 32 integers
2
0.08 %
19.
18 primes pair separated by 40 integers
2
0.08 %
20.
19 primes pair separated by 42 integers
1
0.04 %
21.
19 primes pair separated by 52 integers
1
0.04 %
Total No. Of Primes Pairs In List: 2,498
It is evident in the above list that the primes pairs separated by 6 integers, 4 integers and 2
integers (twin primes), among the 21 classifications of primes pairs separated by from 2 integers
to 52 integers (primes pairs separated by 38 integers, 44 integers, 46 integers, 48 integers & 50
integers are not among them, but, they are expected to appear further down in the infinite list of
the primes), are the most dominant, important. There is a long list of other primes pairs, besides
those shown in the above list, which also play a part as the building-blocks of the infinite list of
the integers.
The list of the integers is infinite. The list of the primes is also infinite. The infinite primes
are the building-blocks of the infinite integers - the infinite odd integers are all either primes or
composites of primes, and, the infinite even integers, except for 2 which is a prime, are all also
composites of primes. Therefore, all the primes pairs separated by the integers of various
magnitudes, as described above, can never all be finite. If there is any possibility at all for any of
these primes pairs to be finite, there is only the possibility that a number of these primes pairs are
finite (but never all of them). However, will it have to be the primes pairs separated by 2 integers
or twin primes (which are the subject of our investigation here), which are the only primes pair,
or, one among a number of primes pairs, which are finite? Why question only the infinity of the
primes pairs separated by 2 integers, the twin primes? Are not the infinities of the primes pairs
separated by 8 integers and more, whose frequencies of appearance are lower, as compared to
Twin Prime
64
those of the primes pairs which are separated by 6, 4 and 2 integers respectively, in the above list
of primes pairs, more questionable? Why single out only the twin primes? (There are at least 18
other primes pairs, separated by from 8 integers to 52 integers, whose respective infinities should
be more suspect, as is evident from the above list of primes pairs, if any infinities should be
doubted. Evidently, the primes pairs separated by 2 integers (twin primes) are not that likely to be
finite.)
The above represents anecdotal evidence that the twin primes are infinite, which is a
ratification of the actual proof given earlier.