FERMAT S TEST KEITH CONRAD
|
|
- Melina Pearson
- 5 years ago
- Views:
Transcription
1 FERMAT S TEST KEITH CONRAD 1. Introduction Fermat s little theorem says for prime p that a p 1 1 mod p for all a 0 mod p. A naive extension of this to a composite modulus n 2 would be: for all a 0 mod n, a n 1 1 mod n. Let s call the congruence Fermat s little congruence. 1 It may or may not be true. For prime n it holds for all a 0 mod n. But for composite n it can have many counterexamples. Example 1.1. When n = 15, the table below shows that for only four a 0 mod 15 do we have a 14 1 mod 15. a a 14 mod Example 1.2. Among all the numbers a 0 mod 91, 36 of them (less than half) satisfy a 90 1 mod 91. The situation for small a is shown below. a a 90 mod If Fermat s little congruence a n 1 1 mod n fails for even one a 0 mod n, then n isn t prime, so it s composite. For instance, from above mod 15 and mod 91, so 15 and 91 are composite. Of course 15 and 91 are small enough that their compositeness can be seen by direct factoring (15 = 3 5 and 91 = 7 13). The real significance of breaking Fermat s little congruence is for much larger n, since it lets us prove a large number is composite without having to factor it. This is what we will explore here. 2. Three Tests The simplest method of checking if an integer n > 1 is composite is trial division up to n, which means testing integers a greater than 1 and less than or equal to n to see if a n. If this ever happens then n is composite. If it never happens then n is prime. We only check up to n since if n = ab where a < n and b < n then one of a or b is less than or equal to n. Trial division only proves n is composite once we find a divisor of n. Example 2.1. Let n = Then n The only nontrivial proper factor of n less than n is 593. Since 593/ n.92, we have to go over 90% of the way to n before we have proved n is composite by trial division. A slight improvement on trial division is using greatest common divisors with n: pick an integer a with 1 a n 1 and compute (a, n) by Euclid s algorithm. Since (a, n) a < n, if (a, n) > 1 then (a, n) is a nontrivial factor of n so n is composite. On the other hand, if 1 This terminology is convenient, but not standard; I made it up. 1
2 2 KEITH CONRAD (a, n) = 1 then we learned nothing and pick another a at random from 1 to n 1 and try again. We call this the gcd test for compositeness. Example 2.2. Let n = , as in the previous example. While n has only one nontrivial factor below n, the number of a from 1 to n 1 such that (a, n) > 1 is 1293, so there is a better chance of randomly picking an integer less than n that shares a common nontrivial factor with n than there is of picking an actual factor of n below n. Still, the odds are quite small that the gcd test will work using a few random choices of a: 1293/(n 1).31%, which is less than 1/3 of 1%. A significant improvement on the gcd test comes from seeking to disprove Fermat s little congruence a n 1 1 mod n for some a with 1 a n 1. Example 2.3. Let n = again. Then 2 n mod n, so after just one choice of a we proved n is composite! Even better, the number of integers a from 1 to n 1 that satisfy a n 1 1 mod n is , and /(n 1) is over 99.99%. You d have to be incredibly unlucky not to prove n is composite by picking an a from 1 to n 1 at random to see if a n 1 1 mod n. Let us call the strategy we have introduced Fermat s compositness test: if a n 1 1 mod n for at least one a with 1 a n 1, then n is composite. Indeed, if n were prime then Fermat s little theorem says a n 1 1 mod n for all a 0 mod n. When this breaks down even once, n must be composite. An integer less than n that proves n is composite is called a witness to the compositeness of n. The type of witness depends on the type of test we use. Definition 2.4. Let 1 a n 1. We call a a trial division witness for n if a n. 2 We call a a gcd witness for n if (a, n) > 1. We call a a Fermat witness for n if a n 1 1 mod n. This terminology is reasonable: a trial division witness for n reveals compositeness of n through trial division of n by that number. A gcd witness for n reveals compositeness of n by computing its greatest common divisor with n. A Fermat witness reveals compositeness of n by testing it in Fermat s little congruence mod n. For instance, 3 is a trial division witness for 15 and a gcd witness for 15, and 10 is a gcd witness for 15 but not a trial division witness for 15. What about Fermat witnesses for 15? Example 2.5. Since mod 15 (see the table in Example 1.1), 2 is a Fermat witness for 15, as is every number from 1 to 14 except 1, 4, 11, and 14. Example 2.6. From Example 2.3, where n = , since 2 n 1 1 mod n the number 2 is a Fermat witness for n, proving it is composite without having to factor n. Example 2.7. Let n = Since mod 1387, we don t learn anything. (Maybe 1387 is prime, so this congruence with 2 would just be an instance of Fermat s little theorem.) However, mod 1387, so 3 is a Fermat witness and 1387 is composite. Example 2.8. Let n = = Fermat thought n is prime, but it is not: while 2 n 1 1 mod n, it turns out that 3 n mod n, so 3 is a Fermat witness that proves n is composite without telling us a nontrivial factor of n. Euler discovered 641 is a factor of n about 100 years after Fermat mistakenly said n is prime. 2 Strictly speaking, this term might be best limited to a n, since trial division is not done beyond n. But as we allow 1 a n 1 in this definition, we use the term trial division witness that broadly.
3 FERMAT S TEST 3 Example 2.9. Let n = This number has 4933 digits. Although 2 n 1 1 mod n, a computer calculation taking less than a minute shows 3 n 1 1 mod n, so n is composite. Compositeness of n was first shown in 1961, but a nontrivial factor of n was found for the first time almost 50 years later, in 2010: the 54-digit number Its complementary factor has 4880 digits and is composite (3 is a Fermat witness), but no factorization of the complementary factor into smaller parts is known. For composite n the number 2 is often a Fermat witness. That is, often 2 n 1 1 mod n, which immediately proves compositeness of n. There are only three n < 1000 that are composite and 2 n 1 1 mod n: 341, 561, and Up to there are only twentytwo such composite numbers. If we look for multiple Fermat witnesses then even fewer composite numbers are false positives for primality: all but seven composite numbers up to have 2 or 3 as a Fermat witness (the exceptions are 1105, 1729, 2465, 2701, 2821, 6601, and 8911) and all composite numbers up to have 2, 3, 5, or 7 as a Fermat witness. Using Fermat s little congruence sure beats trial division or the gcd test to prove compositeness! How are trial division witnesses, gcd witnesses, and Fermat witnesses of n related to each other? Since for a > 1 a n 1 1 mod n = (a, n) = 1 = a n, by passing to the contrapositive we have for a > 1 that a n = (a, n) > 1 = a n 1 1 mod n, so a trial division witness (that is, a proper factor greater than 1) is a gcd witness, and a gcd witness is a Fermat witness. What makes the Fermat witnesses so important is that there are usually many of them beyond the other two types of witnesses. Example We saw in Examples 2.1, 2.2, and 2.3 that for the proportion of trial division witnesses and gcd witnesses is less than 1% while the proportion of Fermat witnesses is over 99.99%. Example The number 1387 has 2 trial division witnesses, 91 gcd witnesses, and 1063 Fermat witnesses. The percentages of trial division witness and gcd witnesses for 1387 are both less than 1% while the percentage of Fermat witnesses for 1387 is around 77%. That is high enough that we should find a Fermat witness after just a few random guesses. 3. The Proportion of Fermat Witnesses The next theorem gives a condition on a composite number n for the proportion of its Fermat witnesses to exceed 50%. Theorem 3.1. Let n 2. If some integer b satisfies b n 1 1 mod n and (b, n) = 1 then {1 a n 1 : a n 1 1 mod n} > n 1. 2 That is, if some Fermat witness for n is relatively prime to n then over half the positive integers less than n are Fermat witnesses for n.
4 4 KEITH CONRAD Proof. Set A = { 1 a n 1 : a n 1 1 mod n }, B = { 1 a n 1 : (a, n) = 1 and a n 1 1 mod n }, C = {1 a n 1 : (a, n) > 1}. The sets A, B, and C are disjoint (why?) and fill up all the integers from 1 to n 1. Together B and C are the Fermat witnesses for n and A is everything else between 1 and n 1. The set A is not empty since 1 A. Fermat witnesses are the elements of B and C. (Elements of C are the gcd witnesses, and every gcd witness is a Fermat witness.) By hypothesis B, so n is composite. The theorem asserts that if B then B + C > (n 1)/2. To prove this we will use an idea from the proof of Fermat s little theorem: multiply every number in some set by a common number. We are assuming there is some number in B, say b. The set Ab = {ab mod n : a A} is inside B, where ab mod n means the remainder when we divide ab by n. Indeed, for any a A, the product ab is relatively prime to n and (ab) n 1 a n 1 b n 1 b n 1 1 mod n, so ab mod n B. This holds for all a A, so Ab B. For a and a in A, if ab a b mod n then we can cancel b and see a a mod n, so a = a because numbers in A lie strictly between 0 and n. Thus the number of elements in Ab is A, so from Ab B we have A = Ab B. Therefore n 1 = A + B + C A + A + 1 > 2 A, so A < (n 1)/2, which means A is less than half of {1, 2,..., n 1}, so its complement B C is more than half of {1, 2,..., n 1}. Algebraically, B + C = (n 1) A > (n 1) n 1 2 = n 1. 2 Remark 3.2. A reader who knows about cosets in group theory will recognize the use of a coset Ab in the proof. Our proof can be recast in terms of group theory as follows. The invertible numbers modulo n are a group under multiplication, and the set A of solutions to Fermat s little congruence a n 1 1 mod n is a subgroup. If there is a counterexample to Fermat s little congruence among the invertible numbers, i.e., if B, then A is a proper subgroup and therefore has index at least 2, so A is at most half the invertible numbers modulo n. Then the counterexamples to a n 1 1 mod n include at least half the invertible number modulo n and well as all the noninvertible numbers modulo n besides 0, which adds up to more than half the nonzero numbers modulo n. Theorem 3.1 says that over half the nonzero numbers mod n are Fermat witnesses for n if some Fermat witness is relatively prime to n. The a satisfying (a, n) > 1 are automatically Fermat witnesses, so Theorem 3.1 says that if there is even one non-obvious Fermat witness (one that is not a gcd witness) then there must be many Fermat witnesses. When the conclusion of Theorem 3.1 holds, we have a probabilistic test for primality: pick random positive integers less then n at random and check for each of them if Fermat s little congruence breaks down. If n is composite and over half the positive integers less than n are Fermat witnesses for n, then the probability of not finding a Fermat witness among, say, 10
5 FERMAT S TEST 5 random choices is smaller than the probability of flipping a fair coin and getting the same side 10 times in a row, and that is 1/ , so we might say that n appears to be prime with probability at least 1 1/ We are putting the word probability in quotes because the primality of a number is not really a matter of probability. But there is a fundamental problem here: there are composite n for which Theorem 3.1 fails: every a with (a, n) = 1 has a n 1 1 mod n. We address this issue in the next section. Example 3.3. Let n = This number is composite and it turns out that a n 1 1 mod n only when (a, n) > 1, so a Fermat witness is the same as a gcd witness in this case. The number of gcd witnesses is , which seems large, but it has 8 digits while n has 11 digits. The proportion of Fermat (= gcd) witnesses for n is around.14%. (That is not a typo: we do mean.14% =.0014.) Using a random number generator to pick random numbers mod n, it took me 50 trials until I found a Fermat witness for n. Example 3.4. If n = , then n is composite and again a n 1 1 mod n only when (a, n) > 1, but in this case the proportion of Fermat witnesses is a little over 37%. With a random number generator I found a Fermat witness for n on the second try. Example 3.5. Let n = Applying the Fermat test on random values of a mod n, I first found a Fermat witness at the 59th value of a. Example 3.6. Let n = This number is composite (and Wolfram Alpha factors it pretty quickly), but when I ran the Fermat test on 100 random values of a mod n I did not find any Fermat witness. Try this yourself. 4. Fermat False Positives: Carmichael Numbers It turns out that if we run the Fermat test 10 times and don t find a Fermat witness, we are not justified on probabilistic grounds in believing that n is a prime number: there are composite n for which the only Fermat witnesses are gcd witnesses. In this case Theorem 3.1 can t be applied and we can t be sure if the proportion of Fermat witnesses will be large at all. Definition 4.1. A composite n for which there are no Fermat witnesses relatively prime to n is called a Carmichael number. Equivalently, n is a Carmichael number when n is composite and (a, n) = 1 = a n 1 1 mod n. This name honors Robert Carmichael, who found several such numbers in the early 20th century, listing several at the end of [2] and giving more examples in [3]. Here are the first five Carmichael numbers: 561, 1105, 1729, 2465, The numbers in Examples 3.3, 3.4, 3.5, and 3.6 are Carmichael numbers too. There is no known computationally efficient algorithm to determine if a general integer is Carmichael, but Alford, Granville, and Pomerance [1] proved that there are infinitely many Carmichael numbers, so there s never a point beyond which they stop appearing. Carmichael was not the first person to study Carmichael numbers. Twenty-five years earlier Simerka [4] found the first 7 Carmichael numbers, but this work was published in a Czech math journal that was not widely read. It might be more appropriate to use the name Simerka number instead of Carmichael number, but it s too late.
6 6 KEITH CONRAD When we run the Fermat test t times without finding a Fermat witness, and t is large, we should be morally convinced that n is either a prime number or a Carmichael number. 3 Let s express this idea in probabilistic language. If n is composite and not a Carmichael number then Theorem 3.1 assures us that over half the numbers from 1 to n 1 are Fermat witnesses for n, so not finding a Fermat witness after t tests is as likely as flipping a coin t times and having the same side come up each time, which has probability 1/2 t. In fact it is less likely than that since the proportion of Fermat witnesses is over 50%. Therefore the probability that n is a prime or a Carmichael number if no Fermat witness is found after t trials is greater than 1 1/2 t. This heuristic reasoning has an error related to conditional probability that should be fixed with Bayes rule, but we will not discuss that here. To summarize, the Fermat test for a number n 2 is the following: (1) Randomly pick an integer a from 1 to n 1. (2) Check if a n 1 1 mod n. (3) If a n 1 1 mod n then stop the test and declare (correctly) n is composite. (We know n has a nontrivial factorization, but the test does not give us one.) (4) If a n 1 1 mod n then repeat step 1. (5) If the test runs t times without terminating then say n is prime or Carmichael with probability greater than 1 1/2 t. For example, if the test is run 10 times (using t = 10) and a n 1 1 mod n each time then we should say n is prime or Carmichael with probability greater than 1 1/ References [1] W. R. Alford, A. Granville, C. Pomerance, There are infinitely many Carmichael numbers, Ann. of Math. 139 (1994), [2] R. D. Carmichael, Note on a New Number Theory Function, Bulletin Amer. Math. Soc. 16 (1910), [3] R. D. Carmichael, On composite P which satisfy the Fermat congruence a P 1 1 mod P, Amer. Math. Monthly 19 (1912), [4] V. Simerka Zbytky z arithemetické posloupnosti (On the remainders of an arithmetic progression), Casopis pro pĕstování matematiky a fysiky 14 (1885), As Tom Roby likes to say, Carmichael numbers belong to the Fermat witness protection program.
THE SOLOVAY STRASSEN TEST
THE SOLOVAY STRASSEN TEST KEITH CONRAD 1. Introduction The Jacobi symbol satisfies many formulas that the Legendre symbol does, such as these: for a, b Z and odd m, n Z +, (1) a b mod n ( a n ) = ( b n
More informationORDERS OF ELEMENTS IN A GROUP
ORDERS OF ELEMENTS IN A GROUP KEITH CONRAD 1. Introduction Let G be a group and g G. We say g has finite order if g n = e for some positive integer n. For example, 1 and i have finite order in C, since
More informationIRREDUCIBILITY TESTS IN F p [T ]
IRREDUCIBILITY TESTS IN F p [T ] KEITH CONRAD 1. Introduction Let F p = Z/(p) be a field of prime order. We will discuss a few methods of checking if a polynomial f(t ) F p [T ] is irreducible that are
More informationTHE MILLER RABIN TEST
THE MILLER RABIN TEST KEITH CONRAD 1. Introduction The Miller Rabin test is the most widely used probabilistic primality test. For odd composite n > 1 at least 75% of numbers from to 1 to n 1 are witnesses
More informationALGEBRA. 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers
ALGEBRA CHRISTIAN REMLING 1. Some elementary number theory 1.1. Primes and divisibility. We denote the collection of integers by Z = {..., 2, 1, 0, 1,...}. Given a, b Z, we write a b if b = ac for some
More informationCHAPTER 3. Congruences. Congruence: definitions and properties
CHAPTER 3 Congruences Part V of PJE Congruence: definitions and properties Definition. (PJE definition 19.1.1) Let m > 0 be an integer. Integers a and b are congruent modulo m if m divides a b. We write
More informationLARGE PRIME NUMBERS (32, 42; 4) (32, 24; 2) (32, 20; 1) ( 105, 20; 0).
LARGE PRIME NUMBERS 1. Fast Modular Exponentiation Given positive integers a, e, and n, the following algorithm quickly computes the reduced power a e % n. (Here x % n denotes the element of {0,, n 1}
More informationEULER S THEOREM KEITH CONRAD
EULER S THEOREM KEITH CONRAD. Introduction Fermat s little theorem is an important property of integers to a prime modulus. Theorem. (Fermat). For prime p and any a Z such that a 0 mod p, a p mod p. If
More informationNUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:
NUMBER SYSTEMS Number theory is the study of the integers. We denote the set of integers by Z: Z = {..., 3, 2, 1, 0, 1, 2, 3,... }. The integers have two operations defined on them, addition and multiplication,
More informationCPSC 467b: Cryptography and Computer Security
CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 9 February 6, 2012 CPSC 467b, Lecture 9 1/53 Euler s Theorem Generating RSA Modulus Finding primes by guess and check Density of
More informationFermat s Little Theorem. Fermat s little theorem is a statement about primes that nearly characterizes them.
Fermat s Little Theorem Fermat s little theorem is a statement about primes that nearly characterizes them. Theorem: Let p be prime and a be an integer that is not a multiple of p. Then a p 1 1 (mod p).
More informationCPSC 467b: Cryptography and Computer Security
CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 10 February 19, 2013 CPSC 467b, Lecture 10 1/45 Primality Tests Strong primality tests Weak tests of compositeness Reformulation
More informationInstructor: Bobby Kleinberg Lecture Notes, 25 April The Miller-Rabin Randomized Primality Test
Introduction to Algorithms (CS 482) Cornell University Instructor: Bobby Kleinberg Lecture Notes, 25 April 2008 The Miller-Rabin Randomized Primality Test 1 Introduction Primality testing is an important
More informationAn integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p.
Chapter 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results Definition. (PJE definition 23.1.1) An integer p is prime if p > 1 and p has exactly two positive divisors, 1 and p. If n > 1
More informationPrimality Testing. 1 Introduction. 2 Brief Chronology of Primality Testing. CS265/CME309, Fall Instructor: Gregory Valiant
CS265/CME309, Fall 2018. Instructor: Gregory Valiant Primality Testing [These notes may not be distributed outside this class without the permission of Gregory Valiant.] 1 Introduction Prime numbers are
More information7. Prime Numbers Part VI of PJE
7. Prime Numbers Part VI of PJE 7.1 Definition (p.277) A positive integer n is prime when n > 1 and the only divisors are ±1 and +n. That is D (n) = { n 1 1 n}. Otherwise n > 1 is said to be composite.
More informationHomework #2 solutions Due: June 15, 2012
All of the following exercises are based on the material in the handout on integers found on the class website. 1. Find d = gcd(475, 385) and express it as a linear combination of 475 and 385. That is
More informationFactorization & Primality Testing
Factorization & Primality Testing C etin Kaya Koc http://cs.ucsb.edu/~koc koc@cs.ucsb.edu Koc (http://cs.ucsb.edu/~ koc) ucsb ccs 130h explore crypto fall 2014 1/1 Primes Natural (counting) numbers: N
More informationMATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST
MATH 115, SUMMER 2012 LECTURE 4 THURSDAY, JUNE 21ST JAMES MCIVOR Today we enter Chapter 2, which is the heart of this subject. Before starting, recall that last time we saw the integers have unique factorization
More informationThe Impossibility of Certain Types of Carmichael Numbers
The Impossibility of Certain Types of Carmichael Numbers Thomas Wright Abstract This paper proves that if a Carmichael number is composed of primes p i, then the LCM of the p i 1 s can never be of the
More informationp = This is small enough that its primality is easily verified by trial division. A candidate prime above 1000 p of the form p U + 1 is
LARGE PRIME NUMBERS 1. Fermat Pseudoprimes Fermat s Little Theorem states that for any positive integer n, if n is prime then b n % n = b for b = 1,..., n 1. In the other direction, all we can say is that
More informationCPSC 467: Cryptography and Computer Security
CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory
More informationDefinition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively
6 Prime Numbers Part VI of PJE 6.1 Fundamental Results Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively D (p) = { p 1 1 p}. Otherwise
More informationCHAPTER 6. Prime Numbers. Definition and Fundamental Results
CHAPTER 6 Prime Numbers Part VI of PJE. Definition and Fundamental Results 6.1. Definition. (PJE definition 23.1.1) An integer p is prime if p > 1 and the only positive divisors of p are 1 and p. If n
More informationA Guide to Arithmetic
A Guide to Arithmetic Robin Chapman August 5, 1994 These notes give a very brief resumé of my number theory course. Proofs and examples are omitted. Any suggestions for improvements will be gratefully
More informationQ 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?
2 Mod math Modular arithmetic is the math you do when you talk about time on a clock. For example, if it s 9 o clock right now, then it ll be 1 o clock in 4 hours. Clearly, 9 + 4 1 in general. But on a
More informationMathematics 220 Homework 4 - Solutions. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B.
1. (4.46) Let A and B be sets. Prove that A B = A B if and only if A = B. Solution: We must prove the two statements: (1) if A = B, then A B = A B, and (2) if A B = A B, then A = B. Proof of (1): Suppose
More informationTopic Contents. Factoring Methods. Unit 3: Factoring Methods. Finding the square root of a number
Topic Contents Factoring Methods Unit 3 The smallest divisor of an integer The GCD of two numbers Generating prime numbers Computing prime factors of an integer Generating pseudo random numbers Raising
More informationThe running time of Euclid s algorithm
The running time of Euclid s algorithm We analyze the worst-case running time of EUCLID as a function of the size of and Assume w.l.g. that 0 The overall running time of EUCLID is proportional to the number
More informationSome Facts from Number Theory
Computer Science 52 Some Facts from Number Theory Fall Semester, 2014 These notes are adapted from a document that was prepared for a different course several years ago. They may be helpful as a summary
More informationSenior Math Circles Cryptography and Number Theory Week 2
Senior Math Circles Cryptography and Number Theory Week 2 Dale Brydon Feb. 9, 2014 1 Divisibility and Inverses At the end of last time, we saw that not all numbers have inverses mod n, but some do. We
More informationEXAMPLES OF MORDELL S EQUATION
EXAMPLES OF MORDELL S EQUATION KEITH CONRAD 1. Introduction The equation y 2 = x 3 +k, for k Z, is called Mordell s equation 1 on account of Mordell s long interest in it throughout his life. A natural
More informationMATH 25 CLASS 8 NOTES, OCT
MATH 25 CLASS 8 NOTES, OCT 7 20 Contents. Prime number races 2. Special kinds of prime numbers: Fermat and Mersenne numbers 2 3. Fermat numbers 3. Prime number races We proved that there were infinitely
More informationEuler s, Fermat s and Wilson s Theorems
Euler s, Fermat s and Wilson s Theorems R. C. Daileda February 17, 2018 1 Euler s Theorem Consider the following example. Example 1. Find the remainder when 3 103 is divided by 14. We begin by computing
More informationLARGE PRIME NUMBERS. In sum, Fermat pseudoprimes are reasonable candidates to be prime.
LARGE PRIME NUMBERS 1. Fermat Pseudoprimes Fermat s Little Theorem states that for any positive integer n, if n is prime then b n % n = b for b = 1,..., n 1. In the other direction, all we can say is that
More information2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?
Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative
More informationA Few Primality Testing Algorithms
A Few Primality Testing Algorithms Donald Brower April 2, 2006 0.1 Introduction These notes will cover a few primality testing algorithms. There are many such, some prove that a number is prime, others
More informationCPSC 467b: Cryptography and Computer Security
CPSC 467b: Cryptography and Computer Security Michael J. Fischer Lecture 8 February 1, 2012 CPSC 467b, Lecture 8 1/42 Number Theory Needed for RSA Z n : The integers mod n Modular arithmetic GCD Relatively
More informationLECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS
LECTURE 5: APPLICATIONS TO CRYPTOGRAPHY AND COMPUTATIONS Modular arithmetics that we have discussed in the previous lectures is very useful in Cryptography and Computer Science. Here we discuss several
More informationElementary Algebra Chinese Remainder Theorem Euclidean Algorithm
Elementary Algebra Chinese Remainder Theorem Euclidean Algorithm April 11, 2010 1 Algebra We start by discussing algebraic structures and their properties. This is presented in more depth than what we
More informationCorollary 4.2 (Pepin s Test, 1877). Let F k = 2 2k + 1, the kth Fermat number, where k 1. Then F k is prime iff 3 F k 1
4. Primality testing 4.1. Introduction. Factorisation is concerned with the problem of developing efficient algorithms to express a given positive integer n > 1 as a product of powers of distinct primes.
More informationDiscrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6
CS 70 Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 1 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes
More information2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.
2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say
More informationChapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations
Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 9.1 Chapter 9 Objectives
More informationMATH 2112/CSCI 2112, Discrete Structures I Winter 2007 Toby Kenney Homework Sheet 5 Hints & Model Solutions
MATH 11/CSCI 11, Discrete Structures I Winter 007 Toby Kenney Homework Sheet 5 Hints & Model Solutions Sheet 4 5 Define the repeat of a positive integer as the number obtained by writing it twice in a
More informationDiscrete Mathematics and Probability Theory Summer 2014 James Cook Note 5
CS 70 Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes wish to work over a
More informationTHE GAUSSIAN INTEGERS
THE GAUSSIAN INTEGERS KEITH CONRAD Since the work of Gauss, number theorists have been interested in analogues of Z where concepts from arithmetic can also be developed. The example we will look at in
More informationECEN 5022 Cryptography
Elementary Algebra and Number Theory University of Colorado Spring 2008 Divisibility, Primes Definition. N denotes the set {1, 2, 3,...} of natural numbers and Z denotes the set of integers {..., 2, 1,
More information1. multiplication is commutative and associative;
Chapter 4 The Arithmetic of Z In this chapter, we start by introducing the concept of congruences; these are used in our proof (going back to Gauss 1 ) that every integer has a unique prime factorization.
More informationPrimality Testing SURFACE. Syracuse University. Per Brinch Hansen Syracuse University, School of Computer and Information Science,
Syracuse University SURFACE Electrical Engineering and Computer Science Technical Reports College of Engineering and Computer Science 6-1992 Primality Testing Per Brinch Hansen Syracuse University, School
More information1. Prove that the number cannot be represented as a 2 +3b 2 for any integers a and b. (Hint: Consider the remainder mod 3).
1. Prove that the number 123456782 cannot be represented as a 2 +3b 2 for any integers a and b. (Hint: Consider the remainder mod 3). Solution: First, note that 123456782 2 mod 3. How did we find out?
More informationSUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by
SUBGROUPS OF CYCLIC GROUPS KEITH CONRAD 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by g = {g k : k Z}. If G = g, then G itself is cyclic, with g as a generator. Examples
More informationGALOIS GROUPS OF CUBICS AND QUARTICS (NOT IN CHARACTERISTIC 2)
GALOIS GROUPS OF CUBICS AND QUARTICS (NOT IN CHARACTERISTIC 2) KEITH CONRAD We will describe a procedure for figuring out the Galois groups of separable irreducible polynomials in degrees 3 and 4 over
More informationMATH10040: Chapter 0 Mathematics, Logic and Reasoning
MATH10040: Chapter 0 Mathematics, Logic and Reasoning 1. What is Mathematics? There is no definitive answer to this question. 1 Indeed, the answer given by a 21st-century mathematician would differ greatly
More informationModular Arithmetic and Elementary Algebra
18.310 lecture notes September 2, 2013 Modular Arithmetic and Elementary Algebra Lecturer: Michel Goemans These notes cover basic notions in algebra which will be needed for discussing several topics of
More informationEXAMPLES OF MORDELL S EQUATION
EXAMPLES OF MORDELL S EQUATION KEITH CONRAD 1. Introduction The equation y 2 = x 3 +k, for k Z, is called Mordell s equation 1 on account of Mordell s long interest in it throughout his life. A natural
More information7.2 Applications of Euler s and Fermat s Theorem.
7.2 Applications of Euler s and Fermat s Theorem. i) Finding and using inverses. From Fermat s Little Theorem we see that if p is prime and p a then a p 1 1 mod p, or equivalently a p 2 a 1 mod p. This
More informationFundamentals of Mathematics I
Fundamentals of Mathematics I Kent State Department of Mathematical Sciences Fall 2008 Available at: http://www.math.kent.edu/ebooks/10031/book.pdf August 4, 2008 Contents 1 Arithmetic 2 1.1 Real Numbers......................................................
More information2 More on Congruences
2 More on Congruences 2.1 Fermat s Theorem and Euler s Theorem definition 2.1 Let m be a positive integer. A set S = {x 0,x 1,,x m 1 x i Z} is called a complete residue system if x i x j (mod m) whenever
More informationAN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS
AN ALGEBRA PRIMER WITH A VIEW TOWARD CURVES OVER FINITE FIELDS The integers are the set 1. Groups, Rings, and Fields: Basic Examples Z := {..., 3, 2, 1, 0, 1, 2, 3,...}, and we can add, subtract, and multiply
More informationMa/CS 6a Class 4: Primality Testing
Ma/CS 6a Class 4: Primality Testing By Adam Sheffer Reminder: Euler s Totient Function Euler s totient φ(n) is defined as follows: Given n N, then φ n = x 1 x < n and GCD x, n = 1. In more words: φ n is
More informationLecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya
BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 5: Arithmetic Modulo m, Primes and Greatest Common Divisors Lecturer: Lale Özkahya Resources: Kenneth Rosen,
More information8 Primes and Modular Arithmetic
8 Primes and Modular Arithmetic 8.1 Primes and Factors Over two millennia ago already, people all over the world were considering the properties of numbers. One of the simplest concepts is prime numbers.
More information1 Recommended Reading 1. 2 Public Key/Private Key Cryptography Overview RSA Algorithm... 2
Contents 1 Recommended Reading 1 2 Public Key/Private Key Cryptography 1 2.1 Overview............................................. 1 2.2 RSA Algorithm.......................................... 2 3 A Number
More informationORDERS OF UNITS IN MODULAR ARITHMETIC
ORDERS OF UNITS IN MODULAR ARITHMETIC KEITH CONRAD. Introduction If a mod m is a unit then a ϕ(m) mod m by Euler s theorem. Depending on a, it might happen that a n mod m for a positive integer n that
More informationC.T.Chong National University of Singapore
NUMBER THEORY AND THE DESIGN OF FAST COMPUTER ALGORITHMS C.T.Chong National University of Singapore The theory of numbers has long been considered to be among the purest of pure mathematics. Gauss ( 1777-1855)
More informationLecture notes: Algorithms for integers, polynomials (Thorsten Theobald)
Lecture notes: Algorithms for integers, polynomials (Thorsten Theobald) 1 Euclid s Algorithm Euclid s Algorithm for computing the greatest common divisor belongs to the oldest known computing procedures
More informationCSCI3390-Lecture 16: Probabilistic Algorithms: Number Theory and Cryptography
CSCI3390-Lecture 16: Probabilistic Algorithms: Number Theory and Cryptography 1 Two Problems Problem 1. Generate Primes Find a prime number p of between 200 and 1000 decimal digits that has never been
More informationWednesday, February 21. Today we will begin Course Notes Chapter 5 (Number Theory).
Wednesday, February 21 Today we will begin Course Notes Chapter 5 (Number Theory). 1 Return to Chapter 5 In discussing Methods of Proof (Chapter 3, Section 2) we introduced the divisibility relation from
More information4. Congruence Classes
4 Congruence Classes Definition (p21) The congruence class mod m of a Z is Example With m = 3 we have Theorem For a b Z Proof p22 = {b Z : b a mod m} [0] 3 = { 6 3 0 3 6 } [1] 3 = { 2 1 4 7 } [2] 3 = {
More informationChapter 5. Number Theory. 5.1 Base b representations
Chapter 5 Number Theory The material in this chapter offers a small glimpse of why a lot of facts that you ve probably nown and used for a long time are true. It also offers some exposure to generalization,
More informationMATH EXAMPLES: GROUPS, SUBGROUPS, COSETS
MATH 370 - EXAMPLES: GROUPS, SUBGROUPS, COSETS DR. ZACHARY SCHERR There seemed to be a lot of confusion centering around cosets and subgroups generated by elements. The purpose of this document is to supply
More informationChapter 3 Basic Number Theory
Chapter 3 Basic Number Theory What is Number Theory? Well... What is Number Theory? Well... Number Theory The study of the natural numbers (Z + ), especially the relationship between different sorts of
More informationFall 2017 Test II review problems
Fall 2017 Test II review problems Dr. Holmes October 18, 2017 This is a quite miscellaneous grab bag of relevant problems from old tests. Some are certainly repeated. 1. Give the complete addition and
More informationSQUARE PATTERNS AND INFINITUDE OF PRIMES
SQUARE PATTERNS AND INFINITUDE OF PRIMES KEITH CONRAD 1. Introduction Numerical data suggest the following patterns for prime numbers p: 1 mod p p = 2 or p 1 mod 4, 2 mod p p = 2 or p 1, 7 mod 8, 2 mod
More information2x 1 7. A linear congruence in modular arithmetic is an equation of the form. Why is the solution a set of integers rather than a unique integer?
Chapter 3: Theory of Modular Arithmetic 25 SECTION C Solving Linear Congruences By the end of this section you will be able to solve congruence equations determine the number of solutions find the multiplicative
More informationDiscrete Mathematics and Probability Theory Summer 2017 Course Notes Note 6
CS 70 Discrete Mathematics and Probability Theory Summer 2017 Course Notes Note 6 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes wish to work over
More information11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic
11 Division Mod n, Linear Integer Equations, Random Numbers, The Fundamental Theorem of Arithmetic Bezout s Lemma Let's look at the values of 4x + 6y when x and y are integers. If x is -6 and y is 4 we
More informationMath 109 HW 9 Solutions
Math 109 HW 9 Solutions Problems IV 18. Solve the linear diophantine equation 6m + 10n + 15p = 1 Solution: Let y = 10n + 15p. Since (10, 15) is 5, we must have that y = 5x for some integer x, and (as we
More informationCourse MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography
Course MA2C02, Hilary Term 2013 Section 9: Introduction to Number Theory and Cryptography David R. Wilkins Copyright c David R. Wilkins 2000 2013 Contents 9 Introduction to Number Theory 63 9.1 Subgroups
More informationFACTORING IN QUADRATIC FIELDS. 1. Introduction
FACTORING IN QUADRATIC FIELDS KEITH CONRAD For a squarefree integer d other than 1, let 1. Introduction K = Q[ d] = {x + y d : x, y Q}. This is closed under addition, subtraction, multiplication, and also
More information1 Introduction. 2 Solving Linear Equations. Charlotte Teacher Institute, Modular Arithmetic
1 Introduction This essay introduces some new sets of numbers. Up to now, the only sets of numbers (algebraic systems) we know is the set Z of integers with the two operations + and and the system R of
More informationLecture 7: Number Theory Steven Skiena. skiena
Lecture 7: Number Theory Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Number Theory and Divisibility G-d created
More informationMODULAR ARITHMETIC KEITH CONRAD
MODULAR ARITHMETIC KEITH CONRAD. Introduction We will define the notion of congruent integers (with respect to a modulus) and develop some basic ideas of modular arithmetic. Applications of modular arithmetic
More informationLecture 11: Number Theoretic Assumptions
CS 6903 Modern Cryptography April 24, 2008 Lecture 11: Number Theoretic Assumptions Instructor: Nitesh Saxena Scribe: Robert W.H. Fisher 1 General 1.1 Administrative Homework 3 now posted on course website.
More informationThis is a recursive algorithm. The procedure is guaranteed to terminate, since the second argument decreases each time.
8 Modular Arithmetic We introduce an operator mod. Let d be a positive integer. For c a nonnegative integer, the value c mod d is the remainder when c is divided by d. For example, c mod d = 0 if and only
More informationAN EASY GENERALIZATION OF EULER S THEOREM ON THE SERIES OF PRIME RECIPROCALS
AN EASY GENERALIZATION OF EULER S THEOREM ON THE SERIES OF PRIME RECIPROCALS PAUL POLLACK Abstract It is well-known that Euclid s argument can be adapted to prove the infinitude of primes of the form 4k
More informationMATH 2200 Final Review
MATH 00 Final Review Thomas Goller December 7, 01 1 Exam Format The final exam will consist of 8-10 proofs It will take place on Tuesday, December 11, from 10:30 AM - 1:30 PM, in the usual room Topics
More informationSolution Sheet (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = (i) gcd (97, 157) = 1 = ,
Solution Sheet 2 1. (i) q = 5, r = 15 (ii) q = 58, r = 15 (iii) q = 3, r = 7 (iv) q = 6, r = 3. 2. (i) gcd (97, 157) = 1 = 34 97 21 157, (ii) gcd (527, 697) = 17 = 4 527 3 697, (iii) gcd (2323, 1679) =
More informationCSE 20 DISCRETE MATH. Winter
CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Today's learning goals Determine whether a relation is an equivalence relation by determining whether it is Reflexive Symmetric
More information6 Cosets & Factor Groups
6 Cosets & Factor Groups The course becomes markedly more abstract at this point. Our primary goal is to break apart a group into subsets such that the set of subsets inherits a natural group structure.
More informationDefinitions. Notations. Injective, Surjective and Bijective. Divides. Cartesian Product. Relations. Equivalence Relations
Page 1 Definitions Tuesday, May 8, 2018 12:23 AM Notations " " means "equals, by definition" the set of all real numbers the set of integers Denote a function from a set to a set by Denote the image of
More informationFinding Prime Factors
Section 3.2 PRE-ACTIVITY PREPARATION Finding Prime Factors Note: While this section on fi nding prime factors does not include fraction notation, it does address an intermediate and necessary concept to
More informationSOLUTIONS Math 345 Homework 6 10/11/2017. Exercise 23. (a) Solve the following congruences: (i) x (mod 12) Answer. We have
Exercise 23. (a) Solve the following congruences: (i) x 101 7 (mod 12) Answer. We have φ(12) = #{1, 5, 7, 11}. Since gcd(7, 12) = 1, we must have gcd(x, 12) = 1. So 1 12 x φ(12) = x 4. Therefore 7 12 x
More information19. Coding for Secrecy
19. Coding for Secrecy 19.1 Introduction Protecting sensitive information from the prying eyes and ears of others is an important issue today as much as it has been for thousands of years. Government secrets,
More informationMath 5330 Spring Notes Congruences
Math 5330 Spring 2018 Notes Congruences One of the fundamental tools of number theory is the congruence. This idea will be critical to most of what we do the rest of the term. This set of notes partially
More informationPrimality Testing- Is Randomization worth Practicing?
Primality Testing- Is Randomization worth Practicing? Shubham Sahai Srivastava Indian Institute of Technology, Kanpur ssahai@cse.iitk.ac.in April 5, 2014 Shubham Sahai Srivastava (IITK) Primality Test
More informationDirect Proof and Counterexample I:Introduction
Direct Proof and Counterexample I:Introduction Copyright Cengage Learning. All rights reserved. Goal Importance of proof Building up logic thinking and reasoning reading/using definition interpreting :
More informationAspect of Prime Numbers in Public Key Cryptosystem
Aspect of Prime Numbers in Public Key Cryptosystem Md.Mehedi Masud, Huma Galzie, Kazi Arif Hossain and Md.Minhaj Ul Islam Computer Science and Engineering Discipline Khulna University, Khulna-9208, Bangladesh
More information