1 The Integers 5
1.1 Numbers and Sequences 5
1.2 Sums and Products 16
1.3 Mathematical Induction 23
1.4 The Fibonacci Numbers 30
1.5 Divisibility 36
2 Integer Representations and Operations 45
2.1 Representations of Integers 45
2.2 Computer Operations with Integers 54
2.3 Complexity of Integer Operations 61
3 Primes and Greatest Common Divisors 69
3.1 Prime Numbers 70
3.2 The Distribution of Primes 79
3.3 Greatest Common Divisors and their Properties 93
3.4 The Euclidean Algorithm 102
3.5 The Fundamental Theorem of Arithmetic 112
3.6 Factorization Methods and the Fermat Numbers 127
3.7 Linear Diophantine Equations 137
4 Congruences 145
4.1 Introduction to Congruences 145
4.2 Linear Congruences 157
4.3 The Chinese Remainder Theorem 162
4.4 Solving Polynomial Congruences 171
4.5 Systems of Linear Congruences 178
4.6 Factoring Using the Pollard Rho Method 187
5 Applications of Congruences 191
5.1 Divisibility Tests 191
5.2 The Perpetual Calendar 197
5.3 Round-Robin Toumaments 202
5.4 Hashing Functions 204
5.5 Check Digits 209
6 Some Special Congruences 217
6.1 Wilson's Theorem and Fermat's Little Theorem 217
6.2 Pseudoprimes 225
6.3 Euler's Theorem 234
7 Multiplicative Functions 239
7.1 The Euler Phi-Function 239
7.2 The Sum and Number of Divisors 249
7.3 Perfect Numbers and Mersenne Primes 256
7.4 M?bius Inversion 269
7.5 Partitions 277
8 Cryptology 291
8.1 Character Ciphers 291
8.2 Block and Stream Ciphers 300
8.3 Exponentiation Ciphers 318
8.4 Public Key Cryptography 321
8.5 Knapsack Ciphers 331
8.6 Cryptographic Protocols and Applications 338
9 Primitive Roots 347
9.1 The Order of an Integer and Primitive Roots 347
9.2 Primitive Roots for Primes 354
9.3 The Existence of Primitive Roots 360
9.4 Discrete Logarithms and Index Arithmetic 368
9.5 Primality Tests Using Orders of Integers and Primitive Roots 378
9.6 Universal Exponents 385
10 Applications of Primitive Roots and the Order of an Integer 393
10.1 Pseudorandom Numbers 393
10.2 The ElGamal Cryptosystem 402
10.3 An Application to the Splicing of Telephone Cables 408
11 Quadratic Residues 415
11.1 Quadratic Residues and Nonresidues 416
11.2 The Law of Quadratic Reciprocity 430
11.3 The Jacobi Symbol 443
11.4 Euler Pseudoprimes 453
11.5 Zero-Knowledge Proofs 461
12 Decimal Fractions and Continued Fractions 469
12.1 Decimal Fractions 469
12.2 Finite Continued Fractions 481
12.3 Infinite Continued Fractions 491
12.4 Periodic Continued Fractions 503
12.5 Factoring Using Continued Fractions 517
13 Some Nonlinear Diophantine Equations 521
13.1 Pythagorean Triples 522
13.2 Fermat's Last Theorem 530
13.3 Sums of Squares 542
13.4 Pell's Equation 553
13.5 Congruent Numbers 560
14 The Gaussian Integers 577
14.1 Gaussian Integers and Gaussian Primes 577
14.2 Greatest Common Divisors and Unique Factorization 589
14.3 Gaussian Integers and Sums of Squares 599
Appendix A Axioms for the Set of Integers 605
Appendix B Binomial Coefficients 608
Appendix C Using Maple and Mathematica for Number Theory 615
C.1 Using Maple for Number Theory 615
C.2 Using Mathematica for Number Theory 619
Appendix D Number Theory Web Links 624
Appendix E Tables 626
Answers to Odd-Numbered Exercises 641
Bibliography 721
Index of Biographies 733
Index 735
Photo Credits 752