172 Pages
English

# Lecture 17: Memory Hierarchy— Five Ways to Reduce Miss Penalty ...

Learn all about the services we offer

Description

• fiche de synthèse - matière potentielle : • 3 cs
• mémoire
• cours magistral
• mémoire - matière potentielle : accesses
• mémoire - matière potentielle : access
• mémoire - matière potentielle : hierarchy—
RHK.S96 1 Lecture 17: Memory Hierarchy— Five Ways to Reduce Miss Penalty (Second Level Cache) Professor Randy H. Katz Computer Science 252 Spring 1996
• conflict misses
• missed word
• write buffer to empty might
• larger block size
• requests of the cpu
• dirty block to memory
• miss
• cache
• cpu

Subjects

##### Penalty

Informations

This is page i
Printer: Opaque this
Elementary Number Theory:
Primes, Congruences, and Secrets
William Stein
November 16, 2011v
To my wife Clarita LefthandviThis is page vii
Printer: Opaque this
Contents
Preface ix
1 Prime Numbers 1
1.1 Prime Factorization . . . . . . . . . . . . . . . . . . . . . . 2
1.2 The Sequence of Prime Numbers . . . . . . . . . . . . . . . 10
1.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2 The Ring of Integers Modulo n 21
2.1 Congruences Modulo n . . . . . . . . . . . . . . . . . . . . . 22
2.2 The Chinese Remainder Theorem . . . . . . . . . . . . . . . 29
2.3 Quickly Computing Inverses and Huge Powers . . . . . . . . 31
2.4 Primality Testing . . . . . . . . . . . . . . . . . . . . . . . . 36
2.5 The Structure of (Z=pZ) . . . . . . . . . . . . . . . . . . . 39
2.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
3 Public-key Cryptography 49
3.1 Playing with Fire . . . . . . . . . . . . . . . . . . . . . . . . 49
3.2 The Di e-Hellman Key Exchange . . . . . . . . . . . . . . 51
3.3 The RSA Cryptosystem . . . . . . . . . . . . . . . . . . . . 56
3.4 Attacking RSA . . . . . . . . . . . . . . . . . . . . . . . . . 61
3.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.1 Statement of the Quadratic Reciprocity Law . . . . . . . . 70viii Contents
4.2 Euler’s Criterion . . . . . . . . . . . . . . . . . . . . . . . . 73
4.3 First Proof of Quadratic Reciprocity . . . . . . . . . . . . . 75
4.4 A Proof of Reciprocity Using Gauss Sums . . . . 81
4.5 Finding Square Roots . . . . . . . . . . . . . . . . . . . . . 86
4.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
5 Continued Fractions 93
5.1 The De nition . . . . . . . . . . . . . . . . . . . . . . . . . 94
5.2 Finite Continued Fractions . . . . . . . . . . . . . . . . . . 95
5.3 In nite Continued F . . . . . . . . . . . . . . . . . . 101
5.4 The Continued Fraction of e . . . . . . . . . . . . . . . . . . 107
5.5 Quadratic Irrationals . . . . . . . . . . . . . . . . . . . . . . 110
5.6 Recognizing Rational Numbers . . . . . . . . . . . . . . . . 115
5.7 Sums of Two Squares . . . . . . . . . . . . . . . . . . . . . 117
5.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
6 Elliptic Curves 123
6.1 The De nition . . . . . . . . . . . . . . . . . . . . . . . . . 124
6.2 The Group Structure on an Elliptic Curve . . . . . . . . . . 125
6.3 Integer Factorization Using Curves . . . . . . . . . 129
6.4 Elliptic Curve Cryptography . . . . . . . . . . . . . . . . . 135
6.5 Curves Over the Rational Numbers . . . . . . . . . 140
6.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
References 155
Index 160This is page ix
Printer: Opaque this
Preface
This is a book about prime numbers, congruences, secret messages, and
elliptic curves that you can read cover to cover. It grew out of undergrad-
uate courses that the author taught at Harvard, UC San Diego, and the
University of Washington.
The systematic study of number theory was initiated around 300B.C.
when Euclid proved that there are in nitely many prime numbers, and
also cleverly deduced the fundamental theorem of arithmetic, which asserts
that every positive integer factors uniquely as a product of primes. Over a
thousand years later (around 972A.D.) Arab mathematicians formulated
the congruent number problem that asks for a way to decide whether or not
a given positive integer n is the area of a right triangle, all three of whose
sides are rational numbers. Then another thousand years later (in 1976),
Di e and Hellman introduced the rst ever public-key cryptosystem, which
enabled two people to communicate secretely over a public communications
channel with no predetermined secret; this invention and the ones that
followed it revolutionized the world of digital communication. In the 1980s
and 1990s, elliptic curves revolutionized number theory, providing striking
new insights into the congruent number problem, primality testing, public-
key cryptography, attacks on public-key systems, and playing a central role
in Andrew Wiles’ resolution of Fermat’s Last Theorem.
Today, pure and applied number theory is an exciting mix of simultane-
ously broad and deep theory, which is constantly informed and motivated
by algorithms and explicit computation. Active research is underway that
promises to resolve the congruent number problem, deepen our understand-
ing into the structure of prime numbers, and both challenge and improvex Preface
our ability to communicate securely. The goal of this book is to bring the
The reader is strongly encouraged to do every exercise in this book,
checking their answers in the back (where many, but not all, solutions
are given). Also, throughout the text there, are examples of calculations
done using the powerful free open source mathematical software system
Sage (http://www.sagemath.org), and the reader should try every such
example and experiment with similar examples.
cal proofs and must have know the basics of groups, rings, and elds. Thus,
the prerequisites for this book are more than the prerequisites for most el-
ementary number theory books, while still being aimed at undergraduates.
Notation and Conventions. We let N =f1; 2; 3;:::g denote the natural
numbers, and use the standard notation Z, Q, R, and C for the rings of
integer, rational, real, and complex numbers, respectively. In this book, we
will use the words proposition, theorem, lemma, and corollary as follows.
Usually a proposition is a less important or less fundamental assertion, a
theorem is a deeper culmination of ideas, a lemma is something that we will
use later in this book to prove a proposition or theorem, and a corollary
is an easy consequence of a proposition, theorem, or lemma. More di cult
exercises are marked with a (*).
Acknowledgements. I would like to thank Brian Conrad, Carl Pomer-
ance, and Ken Ribet for many clarifying comments and suggestions. Bau-
sively on the rst two chapters. Frank Calegari used the course when
teaching Math 124 at Harvard, and he and his students provided much
Kleinerman wrote a version of Section 5.4 as a class project. Hendrik
gorithm. Michael Absho , Sabmit Dasgupta, David Joyner, Arthur Pat-
terson, George Stephanides, Kevin Stern, Eve Thompson, Ting-You Wang,
and Heidi Williams all suggested corrections. I also bene ted from conver-
sations with Henry Cohn and David Savitt. I used Sage ([Sag08]), emacs,
Aand LT X in the preparation of this book.EThis is page 1
Printer: Opaque this
1
Prime Numbers
Every positive integer can be written uniquely as a product of prime num-
2 2bers, e.g., 100 = 2 5 . This is surprisingly di cult to prove, as we will
see below. Even more astounding is that actually nding a way to write
certain 1,000-digit numbers as a product of primes seems out of the reach of
present technology, an observation that is used by millions of people every
day when they buy things online.
Since prime numbers are the building blocks of integers, it is natural to
wonder how the primes are distributed among the integers.
\There are two facts about the distribution of prime numbers.
The rst is that, [they are] the most arbitrary and ornery ob-
jects studied by mathematicians: they grow like weeds among
the natural numbers, seeming to obey no other law than that of
chance, and nobody can predict where the next one will sprout.
The second fact is even more astonishing, for it states just the
opposite: that the prime numbers exhibit stunning regularity,
that there are laws governing their behavior, and that they obey
these laws with almost military precision."
| Don Zagier [Zag75]
The Riemann Hypothesis, which is the most famous unsolved problem in
number theory, postulates a very precise answer to the question of how the
prime numbers are distributed.
This chapter lays the foundations for our study of the theory of numbers
by weaving together the themes of prime numbers, integer factorization,
and the distribution of primes. In Section 1.1, we rigorously prove that the2 1. Prime Numbers
every positive integer is a product of primes, and give examples of speci c
integers for which nding such a decomposition would win one a large cash
bounty. In Section 1.2, we discuss theorems about the set of prime numbers,
starting with Euclid’s proof that this set is in nite, and discuss the largest
known prime. Finally we discuss the distribution of primes via the prime
number theorem and the Riemann Hypothesis.
1.1 Prime Factorization
1.1.1 Primes
The set of natural numbers is
N =f1; 2; 3; 4;:::g;
and the set of integers is
Z =f:::; 2; 1; 0; 1; 2;:::g:
De nition 1.1.1 (Divides). If a;b2 Z we say that a divides b, written
ajb, if ac =b for some c2 Z. In this case, we say a is a divisor of b. We
say that a does not divide b, written a - b, if there is no c2 Z such that
ac =b.
For example, we have 2j 6 and 3j 15. Also, all integers divide 0, and 0
divides only 0. However, 3 does not divide 7 in Z.
:
Remark 1.1.2. The notation b :a for \b is divisible by a" is common in
Russian literature on number theory.
De nition 1.1.3 (Prime and Composite). An integer n > 1 is prime if
the only positive divisors of n are 1 and n. We call n composite if n is not
prime.
The number 1 is neither prime nor composite. The rst few primes of N
are
2; 3; 5; 7; 11; 13; 17; 19; 23; 29; 31; 37; 41; 43; 47; 53; 59; 61; 67; 71; 73; 79;:::;
and the rst few composites are
4; 6; 8; 9; 10; 12; 14; 15; 16; 18; 20; 21; 22; 24; 25; 26; 27; 28; 30; 32; 33; 34;::::
Remark 1.1.4. J. H. Conway argues in [Con97, viii] that 1 should be
considered a prime, and in the 1914 table [Leh14], Lehmer considers 1 to
be a prime. In this book, we consider neither 1 nor 1 to be prime.
SAGE Example 1.1.5. We use Sage to compute all prime numbers between
a and b 1.6
6
1.1 Prime Factorization 3
sage: prime_range(10,50)
[11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
We can also compute the composites in an interval.
sage: [n for n in range(10,30) if not is_prime(n)]
[10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28]
Every natural number is built, in a unique way, out of prime numbers:
Theorem 1.1.6 (Fundamental Theorem of Arithmetic). Every natural
number can be written as a product of primes uniquely up to order.
Note that primes are the products with only one factor and 1 is the
empty product.
Remark 1.1.7. Theorem 1.1.6, which we will prove in Section 1.1.4, is trick-
ier to prove than you might rst think. For example, unique factorization
fails in the ring
p p
Z[ 5] =fa +b 5 :a;b2 Zg C;
where 6 factors in two di erent ways:
p p
6 = 2 3 = (1 + 5) (1 5):
1.1.2 The Greatest Common Divisor
We will use the notion of the greatest common divisor of two integers to
prove that if p is a prime and pjab, then pja or pjb. Proving this is the
key step in our proof of Theorem 1.1.6.
De nition 1.1.8 (Greatest Common Divisor). Let
gcd(a;b) = maxfd2 Z :dja and djbg;
unless both a and b are 0 in which case gcd(0; 0) = 0.
For example, gcd(1; 2) = 1, gcd(6; 27) = 3, and for any a, gcd(0;a) =
gcd(a; 0) =a.
Ifa = 0, the greatest common divisor exists because ifdja thendjaj,
and there are onlyjaj positive integersjaj. Similarly, the gcd exists when
b = 0.
Lemma 1.1.9. For any integers a and b, we have
gcd(a;b) = gcd(b;a) = gcd(a;b) = gcd(a;b a) = gcd(a;b +a):
Proof. We only prove that gcd(a;b) = gcd(a;b a), since the other cases
are proved in a similar way. Suppose dja and djb, so there exist integers
c andc such thatdc =a anddc =b. Thenb a =dc dc =d(c c ),1 2 1 2 2 1 2 1