EULER S THEOREM. 1. Introduction Fermat s little theorem is an important property of integers to a prime modulus. a p 1 1 mod p.

Save this PDF as:

Size: px
Start display at page:

Download "EULER S THEOREM. 1. Introduction Fermat s little theorem is an important property of integers to a prime modulus. a p 1 1 mod p."

Transcription

1 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 we want to extend Fermat s little theorem to a composite modulus, a false generalization would be: if a 0 mod m then a m mod m. For a counterexample, take m = 5 and a = 2: mod 5. A correct extension of Fermat s little theorem to non-prime moduli requires a new way of thinking about the hypothesis in Fermat s little theorem. For prime p, a 0 mod p (a, p) =, but these two conditions are not equivalent when p is replaced with a composite number. It is the relative primality point of view on the right that lets Fermat s little theorem be extended to a general modulus, as Euler discovered. Theorem.2 (Euler). For m 2 in Z + and any a Z such that (a, m) =, a ϕ(m) mod m, where ϕ(m) is the number of invertible integers modulo m. When m = p is prime, all non-zero integers modulo p are invertible, so ϕ(p) = p and Euler s theorem becomes Fermat s little theorem. How do we compute ϕ(m)? Consider m = 2. To count the number of invertible integers modulo 2, write down a set of representatives for integers modulo 2, such as, 2, 3, 4, 5, 6, 7, 8, 9, 0,, 2. The numbers here that are invertible modulo 2 are, 5, 7,, so ϕ(2) = 4. Euler s theorem for m = 2 says a 4 mod 2 when (a, 2) =. Being invertible modulo m is the same as being relatively prime to m (that is, we can solve ax mod m for x exactly when (a, m) = use Bezout), so we can describe ϕ(m) concretely as follows: ϕ(m) = #{a : a m, (a, m) = }. Here is a small table of values derived from this formula. m ϕ(m)

2 2 KEITH CONRAD Notice ϕ(m) is even for m > 2. We can explain this by observing that when a mod m is invertible, so is a mod m. Therefore, using the standard representatives modulo m, invertible numbers modulo m come in pairs as {a, m a}. This really is a pair of different numbers, since if a = m a then a = m/2, so m is even. But (m/2, m) = m/2, and this is bigger than when m > 2, so m/2 is not invertible modulo m. Thus, when m > 2, the invertible numbers modulo m fall into pairs {a, m a}, and that shows ϕ(m) is even. 2. From Fermat to Euler Euler s theorem has a proof that is quite similar to the proof of Fermat s little theorem. To stress the similarity, we review the proof of Fermat s little theorem and then we will make a couple of changes in that proof to get Euler s theorem. Here is the proof of Fermat s little theorem (Theorem.). Proof. We have a prime p and an arbitrary a 0 mod p. To show a p mod p, consider non-zero integers modulo p in the standard range: S = {, 2, 3,..., p }. We will compare S with the set obtained by multiplying the elements of S by a: as = {a, a 2, a 3,..., a(p )}. The elements of S represent the nonzero numbers modulo p and the elements of as also represent the nonzero numbers modulo p. That is, every nonzero number mod p is congruent to exactly one number in as. Indeed, for any b 0 mod p, we can solve the equation ax b mod p for x mod p since a mod p is invertible, and necessarily x 0 mod p (since b 0 mod p). Choosing x to lie between and p, so x S, we see that b mod p is represented by an element of as. Two different elements of as can t represent the same number mod p since ax ay mod p = x y mod p and different elements of S are not congruent mod p. Since S and as become the same thing when reduced modulo p, the product of the numbers in each set must be the same modulo p: 2 3 (p ) a(a 2)(a 3) (a(p )) mod p. Pulling the p copies of a to the front of the product on the right, we get 2 3 (p ) a p ( 2 3 (p )) mod p. Now we cancel each of, 2, 3,..., p on both sides (since they are all invertible modulo p) and we are left with a p mod p. The proof of Euler s theorem is pretty similar to this, except we replace the condition non-zero modulo p with relatively prime to m. Proof. We have a positive integer m and an a such that (a, m) =. mod m, consider the units modulo m in the standard range: S = {u, u 2, u 3,..., u ϕ(m) }, To show a ϕ(m) where u i m, (u i, m) =, and the u i s are distinct. (If m = p is prime we can use u i = i for all i, but in general there isn t a simple formula for the ith unit modulo m.) We will compare S with the set obtained by multiplying the elements of S by a: as = {au, au 2, au 3,..., au ϕ(m) }.

3 EULER S THEOREM 3 Since (a, m) =, a mod m is a unit and therefore as consists of units modulo m. We will show that as represents all the units modulo m. Given any unit b mod m, the congruence ax b mod m is solvable since a mod m is invertible. The solution x is a unit modulo m (why?), and placing x between and m makes ax a member of as. Thus b mod m is represented by an element of as. If ax ay mod m then x y mod m since a mod m is invertible, so the different elements of S remain different mod m after being multiplied by a. Therefore as is a set of representatives for the units modulo m (no duplicates). Since the members of S and as agree modulo m, the product of the numbers in each set must be the same modulo m: u u 2 u 3 u ϕ(m) (au )(au 2 )(au 3 ) (au ϕ(m) ) mod m. Pulling the ϕ(m) copies of a to the front of the product on the right, we get u u 2 u 3 u ϕ(m) a ϕ(m) u u 2 u 3 u ϕ(m) mod m. Now we cancel each u i on both sides (since they are all invertible modulo m) and we are left with a ϕ(m) mod m. Passing from Fermat s little theorem to Euler s theorem amounted to replacing non-zero numbers modulo a prime p with the invertible numbers (not the non-zero numbers) for a general modulus m. There is a common notation for these numbers in elementary number theory courses: U m = {a mod m : (a, m) = }. The notation U m comes the fact that invertible numbers mod m are called units mod m. Example 2.. We have U 5 = {, 2, 3, 4} and U 8 = {, 5, 7,, 3, 7}. When p is prime, U p = {, 2, 3,..., p }. As a check that you understand this new notation, be sure you understand why ϕ(m) = #U m. 3. Computing ϕ(m) in special cases The function ϕ(m) does not vary in a simple manner from one integer to the next. See the table of values near the end of Section. This is typical of functions arising in number theory that are based on divisibility (or lack thereof). The right way to think about ϕ(m) is by thinking about positive integers not in terms of the usual m m + paradigm, but in terms of the progression primes prime powers general case. This progression is how the integers are best arranged from the viewpoint of divisibility: primes are the building blocks for multiplication (rather than being the building block for addition), then come prime powers, and finally we get any positive integer as a product of prime powers. With this in mind, we can get formulas for ϕ(m) directly from its definition in the first two cases of the above progression: ϕ(p) = p since there are p integers from to p that are relatively prime to p. ϕ(p k ) = p k p k = p k (p ) for prime p and k since among the integers from to p k, those that are not relatively prime to p k are the multiples of p: p, 2p, 3p,..., p k. There are p k such numbers, so we subtract this from p k to compute ϕ(p k ) = p k p k. Many mathematicians write (Z/(m)) for U m.

4 4 KEITH CONRAD Make sure you remember this explanation for why ϕ(p k ) = p k p k. What about ϕ(m) when m is composite? We will treat one case here, which is important in elementary cryptography: m = pq is a product of two different primes. If a pq and (a, pq) =, then a is neither a multiple of p nor a multiple of q. The multiples of p in this range are p, 2p,..., qp and the multiples of q in this range are q, 2q,..., pq. There are q numbers in the first case and p numbers in the second case. The two lists only overlap at pq (indeed, a positive integer divisible by p and q is divisible by pq, so can t be less than pq). Therefore, to compute ϕ(pq), we take away from pq the number of terms in both lists without double-counting the common term: ϕ(pq) = pq p q + = p(q ) (q ) = (p )(q ). This is interesting: ϕ(pq) = ϕ(p)ϕ(q) for different primes p and q. (Warning: this formula is false when p = q: ϕ(p 2 ) = p 2 p = p(p ) rather than (p ) 2.) With these formulas, we can make Euler s theorem more explicit for certain moduli. Example 3.. When p is prime, (a, p 2 ) = = a p(p ) mod p 2. Example 3.2. When p and q are different primes, (a, pq) = = a (p )(q ) mod pq. This example with modulus pq is related to the RSA cryptosystem. 4. Application: Periodic Decimal Expansions With a calculator we can see that various fractions have periodic decimal expansions, e.g., 3/7 = has a repeating block of length 6. Which numbers have periodic expansions? And is anything predictable about the period length? To answer these questions, we start by working in reverse. Let s write down a periodic expansion and try to see what kind of number it turns out to be. For simplicity, we focus on purely periodic decimals, meaning those with a repeating block right at the start (like 3/7 above and unlike 9/55 = , which has the initial 3 that is not repeated). If x =.c c 2...c d is a purely periodic decimal, where the periodic block we wrote down has length d, each c i is repeated every d digits as we move through the decimal expansion of x. For instance, c occurs in positions for 0, 0 (d+), 0 (2d+), and so on. The digit c 2 occurs in positions 0 2, 0 (d+2), 0 (2d+2), and so on. 2 Therefore x = c = = k 0 ( c 0 dk+ + c 2 k c c d 0 d ) 0 dk c d k 0 0 dk ( c 0 + c c ) d 0 d /0 d, k 0 0 dk+d 2 We don t forbid the possibility that some of the ci s are equal, e.g.,.... could be considered to have repeating block or repeating block.

5 EULER S THEOREM 5 where we summed a geometric series in the last step. Writing /( /0 d ) as 0 d /(0 d ) and using 0 d in the numerator to clear out the powers of 0 in the denominators of the other factor, we obtain x = c 0 d + c 2 0 d c d 0 d. This is a rational number with denominator that is less than a power of 0. The numerator can be any positive integer with at most d decimal digits, so the ratio is a fraction between 0 and. Example 4.. Let x = The repeating block has length, so from the calculations we made, x = 3 0 = 3 9 = 3. Example 4.2. Let x = The repeating block has length 5 (not 3; include the periodic 0 s also), so x = = = In the last step, the greatest common divisor of 287 and is 4, so the numerator and denominator are divided by 4. We have shown that any number that has a purely periodic decimal expansion is rational between 0 and and admits an expression as a fraction whose denominator is 0 d for some d. Now we want to go the other way: starting with a fraction, say 28/303, can we decided if its decimal expansion is (purely) periodic or not? The calculations above, passing from a purely periodic decimal for a number x to its expression as a fraction with denominator 0 d, can be read forwards and backwards. Reading it in reverse shows that any fraction between 0 and with a denominator of the form 0 d has a purely periodic decimal expansion. So the numbers that have purely periodic decimal expansions are precisely the fractions between 0 and with a denominator of the form 0 d. Of course, a denominator having the form 0 d might not be the reduced form denominator, e.g., 7/2439 from Example 4.2 has to be written as 287/99999 to get its denominator to be less than a power of 0. So we ask: is there a simple description of the fractions that admit a representation (not necessarily reduced!) with a denominator of the form 0 d? Since 0 d is not divisible by 2 or 5, and the reduced form denominator is a factor of any other denominator for the fraction, if a fraction has a denominator 0 d then its reduced form denominator must be relatively prime to 0. It turns out the converse is also true, and the key tool to prove this is Euler s theorem: Theorem 4.3. Any reduced form fraction a/b with (0, b) = can be written as a fraction with denominator 0 d for some d. Moreover, the period length of the decimal expansion for a/b is the smallest d such that 0 d mod b. In particular, d ϕ(b) and the period length is independent of the numerator a. Proof. Let the fraction be a/b, where (0, b) =. By Euler s theorem, 0 ϕ(b) mod b. That means 0 ϕ(b) is a multiple of b, so we can rewrite a/b as a fraction with denominator 0 ϕ(b). Let d be minimal such that 0 d mod b, so d ϕ(b). Write 0 d = bn, so a b = an bn = an 0 d,

6 6 KEITH CONRAD Since a/b <, we have an < bn = 0 d. Therefore the base 0 expansion of an requires no more than d digits, so we can write an = c 0 d + c 2 0 d c d for some digits c i. (Some of the top c i s may be 0 if an is substantially less than 0 d.) Our earlier calculations showed that for any decimal digits c,..., c d, (4.).c c 2 c d = c 0 d + c 2 0 d c d 0 d, so a/b = (c 0 d + + c d )/(0 d ) has a periodic decimal expansion of length d. To show d is the minimal period of the decimal expansion of a/b when d is the smallest positive integer such that 0 d mod b, assume we could write a/b as a decimal expansion with a repeating block of some length l. Then a/b can be written as a fraction with denominator 0 l. Since a/b is the reduced form of the fraction, this means 0 l is a multiple of b, so 0 l mod b. Therefore l d (why?), so d is the minimal period length of the decimal expansion of a/b. Since the least d such that 0 d mod b has nothing to do with a, we see that the period length of a/b is independent of a (provided the fraction is written in reduced form, i.e., (a, b) = ). Example 4.4. A numerical computation suggests the decimal expansions of /7, 2/7, 3/7, 4/7, 5/7, and 6/7 all have period length 6 and the decimal expansions of /303 and 28/303 both have period length 4. To prove this, check the least d such that 0 d mod 7 is 6 and the least d such that 0 d mod 303 is 4. By seeing explicitly how 0 6 is a multiple of 7 and 0 4 is a multiple of 303, we can even figure out (without a calculator) what the decimal expansions of these fractions are. Since 0 6 = , 3 7 = = = Since 0 4 = , = = = The whole theory of periodic decimals (e.g., determining which numbers have purely periodic decimal expansions, and how long the periods can be) is explained by Euler s theorem and results related to it. So this is a concrete elementary application of number theory to explain a mystery from elementary school mathematics familiar to all students. Remark 4.5. The requirement in Theorem 4.3 that a/b lie between 0 and is a red herring. This is best explained by an example. Consider 543/303. To find its decimal expansion, first extract the integer part. Since 543 = , we have 543/303 = /303. So the decimal part of 543/303 is the same as that of 28/303, and we can apply Theorem 4.3 to 28/303. Since 28/303 = , we have 543/303 = In general, check that for any reduced form fraction a/b >, subtracting its integer part leaves a fraction between 0 and that still has b as its reduced form denominator, so the period of the decimal expansion of a/b is still completely determined by b. There are further interesting questions worth asking about decimal expansions: () Which numbers have finite decimal expansions (such as 5/6 =.325)? (2) Which numbers have periodic decimal expansions with an initial nonrepeating block (such as 7/5 = )?

7 EULER S THEOREM 7 (3) If we compare all the reduced proper fractions with the same denominator b, they may all have the same expansion as /b except for a shift, e.g., /7 =.42857, 2/7 =.28574, 3/7 =.42857, 4/7 =.57428, 5/7 =.74285, 6/7 =.85742, Can you explain when all the reduced fractions with denominator b have this feature? (4) For some denominators, more than one digit sequence (up to shifting) occurs, e.g., there are two possibilities when the denominator is 3: /3 = , 2/3 =.53846, 3/3 = , 4/3 = , 5/3 =.38465, 6/3 =.46538, 7/3 =.53846, 8/3 =.65384, 9/3 = , 0/3 = , /3 =.84653, 2/3 = Every decimal expansion here is a shift of the expansion for /3 or 2/3. If we collect numerators of fractions above whose decimal expansions have the same digit sequence, the 2 numerators fall into two sets of size 6: {, 3, 4, 9, 0, 2} and {2, 5, 6, 7, 8, }. Is there some significance to these two sets of numbers? More generally, can you explain how many digit sequences (up to shifting) will occur among all the reduced fractions with a given denominator, and can you predict which fractions will have decimal digits that are shifts of each other? These questions were studied in Europe from the 760s to the 790s. Mathematicians wanted to understand decimal expansions for fractions so as to mechanize division to save the labors of astronomers and others who needed to do many computations. (Pocket calculators only became available about 200 years later!) Papers by J. H. Lambert, J. Bernoulli, and K. F. Hindenburg during this time contained a mixture of rules and conjectures about periodic decimals. They recognized a connection between period lengths for prime denominators and Fermat s little theorem, for instance, but they offered little explanation of their observations. In 793, the 6-year old Gauss came across these papers and a few years later he settled nearly all the basic questions in this area through a systematic use of modular arithmetic 3, putting his results in the sixth section of the Disquisitiones Arithmeticae. 5. Other Extensions of Fermat s Little Theorem Euler s theorem is not the only generalization of Fermat s little theorem to composite moduli. To see another one, write the congruence in Fermat s little theorem as (5.) a p a mod p. For a 0 mod p, dividing by a shows this is the same as a p mod p, which is the usual form of Fermat s little theorem. The advantage of writing it as a p a mod p is that now the congruence holds for all a without exception. There is a congruence generalizing (5.) 3 Two fractions a/b and a /b with denominator b have the same decimal part if and only if a/b a /b is an integer, which means a a mod b. So the study of decimal expansions might be what led Gauss to discover modular arithmetic in the first place.

8 8 KEITH CONRAD to composite moduli that works for all a without exceptions and looks very different from Euler s theorem. Here it is: (5.2) m k=0 a (k,m) 0 mod m for all a Z. When m = p is prime, this becomes a p + (p )a 0 mod p, which is the same as a p a 0 mod p since the pa mod p term is 0 no matter what a is. So we have recovered (5.) as a special case. When m = pq with distinct primes p and q, (5.2) says a pq + (q )a p + (p )a q + (p )(q )a 0 mod pq. for all a Z. That s quite different from Euler s congruence mod pq in Example 3.2! In (5.2) the exponents are divisors of m, and collecting terms with the same exponent yields m a (k,m) = #{ k m : (k, m) = d}a d = ϕ(m/d)a d, k=0 d m d m where we leave it to the reader to show #{ k m : (k, m) = d} = ϕ(m/d) for each divisor d > 0 of m. Thus (5.2) can be rewritten as ϕ(m/d)a d 0 mod m d m for all a Z, and in this form it is due to MacMahon [3, p. 309]. A more recent account, using group actions, is in [, Theorem 3]. For yet another generalization of Fermat s little theorem to all moduli, see [2] or [4]. References [] I. M. Isaacs and M. R. Pournaki, Generalizations of Fermat s Little Theorem Using Group Theory, Amer. Math. Monthly 2 (2005), [2] L. Levine, Fermat s Little Theorem: A Proof by Function Iteration, Math. Mag. 72 (999), [3] P. A. MacMahon, Applications of the Theory of Permutations in Circular Procession to the Theory of Numbers, Proc. London Math. Soc. 23 (89 2), [4] C. Smyth, A Coloring Proof of a Generalisation of Fermat s Little Theorem, Amer. Math. Monthly 93 (986),

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

Fractions and Decimals

Fractions and Decimals Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles December 1, 2005 1 Introduction If you divide 1 by 81, you will find that 1/81 =.012345679012345679... The first

ORDERS 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

Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

Homework 5 Solutions

Homework 5 Solutions 4.2: 2: a. 321 = 256 + 64 + 1 = (01000001) 2 b. 1023 = 512 + 256 + 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = (1111111111) 2. Note that this is 1 less than the next power of 2, 1024, which

10 k + pm pm. 10 n p q = 2n 5 n p 2 a 5 b q = p

Week 7 Summary Lecture 13 Suppose that p and q are integers with gcd(p, q) = 1 (so that the fraction p/q is in its lowest terms) and 0 < p < q (so that 0 < p/q < 1), and suppose that q is not divisible

Math 319 Problem Set #3 Solution 21 February 2002

Math 319 Problem Set #3 Solution 21 February 2002 1. ( 2.1, problem 15) Find integers a 1, a 2, a 3, a 4, a 5 such that every integer x satisfies at least one of the congruences x a 1 (mod 2), x a 2 (mod

3. QUADRATIC CONGRUENCES 3.1. Quadratics Over a Finite Field We re all familiar with the quadratic equation in the context of real or complex numbers. The formula for the solutions to ax + bx + c = 0 (where

Course notes on Number Theory

Course notes on Number Theory In Number Theory, we make the decision to work entirely with whole numbers. There are many reasons for this besides just mathematical interest, not the least of which is that

Practice Problems for First Test

Mathematicians have tried in vain to this day to discover some order in the sequence of prime numbers, and we have reason to believe that it is a mystery into which the human mind will never penetrate.-

3. Applications of Number Theory

3. APPLICATIONS OF NUMBER THEORY 163 3. Applications of Number Theory 3.1. Representation of Integers. Theorem 3.1.1. Given an integer b > 1, every positive integer n can be expresses uniquely as n = a

SUBGROUPS 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

Congruences. Robert Friedman

Congruences Robert Friedman Definition of congruence mod n Congruences are a very handy way to work with the information of divisibility and remainders, and their use permeates number theory. Definition

Euler s Totient Theorem

Euler s Totient Theorem Misha Lavrov ARML Practice 11/11/2012 Example We want to be able to solve the following type of problem: Problem (VTRMC 2012/4.).. 3 What are the last two digits of 3 33. }{{} 2012

Topics in Number Theory

Chapter 8 Topics in Number Theory 8.1 The Greatest Common Divisor Preview Activity 1 (The Greatest Common Divisor) 1. Explain what it means to say that a nonzero integer m divides an integer n. Recall

Math Workshop October 2010 Fractions and Repeating Decimals

Math Workshop October 2010 Fractions and Repeating Decimals This evening we will investigate the patterns that arise when converting fractions to decimals. As an example of what we will be looking at,

Is this number prime? Berkeley Math Circle Kiran Kedlaya

Is this number prime? Berkeley Math Circle 2002 2003 Kiran Kedlaya Given a positive integer, how do you check whether it is prime (has itself and 1 as its only two positive divisors) or composite (not

INTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS

INTRODUCTION TO PROOFS: HOMEWORK SOLUTIONS STEVEN HEILMAN Contents 1. Homework 1 1 2. Homework 2 6 3. Homework 3 10 4. Homework 4 16 5. Homework 5 19 6. Homework 6 21 7. Homework 7 25 8. Homework 8 28

Decimal Expansion of Rational Numbers

Decimal Expansion of Rational Numbers Helmer Aslaksen Dept. of Teacher Education & Dept. of Mathematics University of Oslo helmer.aslaksen@gmail.com www.math.nus.edu.sg/aslaksen/ Why is 0.999... = 1? We

THE p-adic EXPANSION OF RATIONAL NUMBERS =

THE p-adic EXPANSION OF RATIONAL NUMBERS KEITH CONRAD 1. Introduction In the positive real numbers, the decimal expansion of every positive rational number is eventually periodic 1 (e.g., 1/55.381.381...)

ARITHMETIC PROGRESSIONS OF FOUR SQUARES

ARITHMETIC PROGRESSIONS OF FOUR SQUARES KEITH CONRAD 1. Introduction Suppose a, b, c, and d are rational numbers such that a 2, b 2, c 2, and d 2 form an arithmetic progression: the differences b 2 a 2,

3 Structure of Modular Multiplication

3 Structure of Modular Multiplication Unlike addition, multiplication in Z M is fairly strange. There may not always be an inverse, you can multiply two non-zero numbers together and get zero, and in general

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009. Notes on Algebra

U.C. Berkeley CS276: Cryptography Handout 0.1 Luca Trevisan January, 2009 Notes on Algebra These notes contain as little theory as possible, and most results are stated without proof. Any introductory

Our Primitive Roots. Chris Lyons

Our Primitive Roots Chris Lyons Abstract When n is not divisible by 2 or 5, the decimal expansion of the number /n is an infinite repetition of some finite sequence of r digits. For instance, when n =

CHAPTER 5: MODULAR ARITHMETIC

CHAPTER 5: MODULAR ARITHMETIC LECTURE NOTES FOR MATH 378 (CSUSM, SPRING 2009). WAYNE AITKEN 1. Introduction In this chapter we will consider congruence modulo m, and explore the associated arithmetic called

3 Congruence arithmetic

3 Congruence arithmetic 3.1 Congruence mod n As we said before, one of the most basic tasks in number theory is to factor a number a. How do we do this? We start with smaller numbers and see if they divide

Section 5.1 Number Theory: Prime & Composite Numbers

Section 5.1 Number Theory: Prime & Composite Numbers Objectives 1. Determine divisibility. 2. Write the prime factorization of a composite number. 3. Find the greatest common divisor of two numbers. 4.

Primes in Sequences. Lee 1. By: Jae Young Lee. Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov

Lee 1 Primes in Sequences By: Jae Young Lee Project for MA 341 (Number Theory) Boston University Summer Term I 2009 Instructor: Kalin Kostadinov Lee 2 Jae Young Lee MA341 Number Theory PRIMES IN SEQUENCES

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

COSETS AND LAGRANGE S THEOREM

COSETS AND LAGRANGE S THEOREM KEITH CONRAD 1. Introduction Pick an integer m 0. For a Z, the congruence class a mod m is the set of integers a + mk as k runs over Z. We can write this set as a + mz. This

PROBLEM SET # 2 SOLUTIONS

PROBLEM SET # 2 SOLUTIONS CHAPTER 2: GROUPS AND ARITHMETIC 2. Groups.. Let G be a group and e and e two identity elements. Show that e = e. (Hint: Consider e e and calculate it two ways.) Solution. Since

Revised Version of Chapter 23. We learned long ago how to solve linear congruences. ax c (mod m)

Chapter 23 Squares Modulo p Revised Version of Chapter 23 We learned long ago how to solve linear congruences ax c (mod m) (see Chapter 8). It s now time to take the plunge and move on to quadratic equations.

PYTHAGOREAN TRIPLES KEITH CONRAD 1. Introduction A Pythagorean triple is a triple of positive integers (a, b, c) where a + b = c. Examples include (3, 4, 5), (5, 1, 13), and (8, 15, 17). Below is an ancient

Math 139 Problem Set #6 Solution 15 April 2003

Math 139 Problem Set #6 Solution 15 April 2003 A1 (Based on Barr, 41, exercise 3) (a) Let n be an integer greater than 2 Consider the list of numbers n! + 2, n! + 3, n! + 4,, n! + n Explain why all the

Applications of Fermat s Little Theorem and Congruences

Applications of Fermat s Little Theorem and Congruences Definition: Let m be a positive integer. Then integers a and b are congruent modulo m, denoted by a b mod m, if m (a b). Example: 3 1 mod 2, 6 4

Math E-301: Homework 4 Notes Due 10/5/09

Math E-301: Homework 4 Notes Due 10/5/09 The notes for homeworks will vary. For some problems, I may give one solution, but there may be other ways to approach the problem. I will try to mention these

MODULAR ARITHMETIC. a smallest member. It is equivalent to the Principle of Mathematical Induction.

MODULAR ARITHMETIC 1 Working With Integers The usual arithmetic operations of addition, subtraction and multiplication can be performed on integers, and the result is always another integer Division, on

The Euclidean algorithm for integers leads to the notion of congruence of two integers modulo a given integer.

Integers Modulo m The Euclidean algorithm for integers leads to the notion of congruence of two integers modulo a given integer. Congruence Modulo m Two integers a and b are congruent modulo m if and only

Elementary Number Theory

Elementary Number Theory Ahto Buldas December 3, 2016 Ahto Buldas Elementary Number Theory December 3, 2016 1 / 1 Division For any m > 0, we define Z m = {0, 1,... m 1} For any n, m Z (m > 0), there are

Mathematics of Cryptography

CHAPTER 2 Mathematics of Cryptography Part I: Modular Arithmetic, Congruence, and Matrices Objectives This chapter is intended to prepare the reader for the next few chapters in cryptography. The chapter

8 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.

THE 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

b) Find smallest a > 0 such that 2 a 1 (mod 341). Solution: a) Use succesive squarings. We have 85 =

Problem 1. Prove that a b (mod c) if and only if a and b give the same remainders upon division by c. Solution: Let r a, r b be the remainders of a, b upon division by c respectively. Thus a r a (mod c)

Solutions to Homework Set 3 (Solutions to Homework Problems from Chapter 2)

Solutions to Homework Set 3 (Solutions to Homework Problems from Chapter 2) Problems from 21 211 Prove that a b (mod n) if and only if a and b leave the same remainder when divided by n Proof Suppose a

Further linear algebra. Chapter I. Integers.

Further linear algebra. Chapter I. Integers. Andrei Yafaev Number theory is the theory of Z = {0, ±1, ±2,...}. 1 Euclid s algorithm, Bézout s identity and the greatest common divisor. We say that a Z divides

Definition: Group A group is a set G together with a binary operation on G, satisfying the following axioms: a (b c) = (a b) c.

Algebraic Structures Abstract algebra is the study of algebraic structures. Such a structure consists of a set together with one or more binary operations, which are required to satisfy certain axioms.

Solutions to Practice Problems

Solutions to Practice Problems March 205. Given n = pq and φ(n = (p (q, we find p and q as the roots of the quadratic equation (x p(x q = x 2 (n φ(n + x + n = 0. The roots are p, q = 2[ n φ(n+ ± (n φ(n+2

Continued Fractions. Darren C. Collins

Continued Fractions Darren C Collins Abstract In this paper, we discuss continued fractions First, we discuss the definition and notation Second, we discuss the development of the subject throughout history

Lecture 1: Elementary Number Theory

Lecture 1: Elementary Number Theory The integers are the simplest and most fundamental objects in discrete mathematics. All calculations by computers are based on the arithmetical operations with integers

CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

Finally, the Chinese Remainder Theorem implies now that. and this shows that 341 is a Fermat pseudoprime to base 2. n = ap 1

28 MA6011 15 Pseudoprimes In the previous section we learnt that we need to find large prime numbers when we use the RSA cryptosystem. The question then arises how we can find large primes or if there

Total Gadha s Complete Book of NUMBER SYSTEM

Total Gadha s Complete Book of NUMBER SYSTEM TYPES OF NUMBERS Natural Numbers The group of numbers starting from 1 and including 1, 2, 3, 4, 5, and so on, are known as natural numbers. Zero, negative numbers,

Giuga s conjecture on primality

Giuga s conjecture on primality D. Borwein, J. M. Borwein, P. B. Borwein, R. Girgensohn Abstract. G. Giuga conjectured that if an integer n satisfies n 1 k=1 k n 1 1 mod n, then n must be a prime. We survey

Prime Numbers. Chapter Primes and Composites

Chapter 2 Prime Numbers The term factoring or factorization refers to the process of expressing an integer as the product of two or more integers in a nontrivial way, e.g., 42 = 6 7. Prime numbers are

Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

Finding 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

MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

Chapter 11 Number Theory

Chapter 11 Number Theory Number theory is one of the oldest branches of mathematics. For many years people who studied number theory delighted in its pure nature because there were few practical applications

CONTINUED FRACTIONS AND FACTORING. Niels Lauritzen

CONTINUED FRACTIONS AND FACTORING Niels Lauritzen ii NIELS LAURITZEN DEPARTMENT OF MATHEMATICAL SCIENCES UNIVERSITY OF AARHUS, DENMARK EMAIL: niels@imf.au.dk URL: http://home.imf.au.dk/niels/ Contents

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem)

Some facts about polynomials modulo m (Full proof of the Fingerprinting Theorem) In order to understand the details of the Fingerprinting Theorem on fingerprints of different texts from Chapter 19 of the

Number Theory Hungarian Style. Cameron Byerley s interpretation of Csaba Szabó s lectures

Number Theory Hungarian Style Cameron Byerley s interpretation of Csaba Szabó s lectures August 20, 2005 2 0.1 introduction Number theory is a beautiful subject and even cooler when you learn about it

5 =5. Since 5 > 0 Since 4 7 < 0 Since 0 0

a p p e n d i x e ABSOLUTE VALUE ABSOLUTE VALUE E.1 definition. The absolute value or magnitude of a real number a is denoted by a and is defined by { a if a 0 a = a if a

THE CONGRUENT NUMBER PROBLEM

THE CONGRUENT NUMBER PROBLEM KEITH CONRAD 1. Introduction A right triangle is called rational when its legs and hypotenuse are all rational numbers. Examples of rational right triangles include Pythagorean

CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

The Laws of Cryptography Cryptographers Favorite Algorithms

2 The Laws of Cryptography Cryptographers Favorite Algorithms 2.1 The Extended Euclidean Algorithm. The previous section introduced the field known as the integers mod p, denoted or. Most of the field

Instructor: Bobby Kleinberg Lecture Notes, 5 May The Miller-Rabin Randomized Primality Test

Introduction to Algorithms (CS 482) Cornell University Instructor: Bobby Kleinberg Lecture Notes, 5 May 2010 The Miller-Rabin Randomized Primality Test 1 Introduction Primality testing is an important

The Fibonacci sequence satisfies a number of identities among it members. The Fibonacci numbers have some remarkable divisibility properties.

QuestionofDay Question of the Day What mathematical identities do you know? Do you know any identities or relationships that are satisfied by special sets of integers, such as the sequence of odd numbers

Chapter 6. Number Theory. 6.1 The Division Algorithm

Chapter 6 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,

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions

A Second Course in Mathematics Concepts for Elementary Teachers: Theory, Problems, and Solutions Marcel B. Finan Arkansas Tech University c All Rights Reserved First Draft February 8, 2006 1 Contents 25

0.8 Rational Expressions and Equations

96 Prerequisites 0.8 Rational Expressions and Equations We now turn our attention to rational expressions - that is, algebraic fractions - and equations which contain them. The reader is encouraged to

Computing exponents modulo a number: Repeated squaring

Computing exponents modulo a number: Repeated squaring How do you compute (1415) 13 mod 2537 = 2182 using just a calculator? Or how do you check that 2 340 mod 341 = 1? You can do this using the method

Section 3.3 Equivalence Relations

1 Section 3.3 Purpose of Section To introduce the concept of an equivalence relation and show how it subdivides or partitions a set into distinct categories. Introduction Classifying objects and placing

9 abcd = dcba. 9 ( b + 10c) = c + 10b b + 90c = c + 10b b = 10c.

In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

Continued fractions and good approximations.

Continued fractions and good approximations We will study how to find good approximations for important real life constants A good approximation must be both accurate and easy to use For instance, our

Problem Set 5. AABB = 11k = (10 + 1)k = (10 + 1)XY Z = XY Z0 + XY Z XYZ0 + XYZ AABB

Problem Set 5 1. (a) Four-digit number S = aabb is a square. Find it; (hint: 11 is a factor of S) (b) If n is a sum of two square, so is 2n. (Frank) Solution: (a) Since (A + B) (A + B) = 0, and 11 0, 11

Even Number: An integer n is said to be even if it has the form n = 2k for some integer k. That is, n is even if and only if n divisible by 2.

MATH 337 Proofs Dr. Neal, WKU This entire course requires you to write proper mathematical proofs. All proofs should be written elegantly in a formal mathematical style. Complete sentences of explanation

Stanford University Educational Program for Gifted Youth (EPGY) Number Theory. Dana Paquin, Ph.D.

Stanford University Educational Program for Gifted Youth (EPGY) Dana Paquin, Ph.D. paquin@math.stanford.edu Summer 2010 Note: These lecture notes are adapted from the following sources: 1. Ivan Niven,

2.3 Subtraction of Integers

2.3 Subtraction of Integers The key to subtraction of real numbers is to forget what you might have learned in elementary school about taking away. With positive numbers you can reasonably say take 3 away

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

Number Theory Divisibility and Primes Definition. If a and b are integers and there is some integer c such that a = b c, then we say that b divides a or is a factor or divisor of a and write b a. Definition

Mathematics of Cryptography Modular Arithmetic, Congruence, and Matrices. A Biswas, IT, BESU SHIBPUR

Mathematics of Cryptography Modular Arithmetic, Congruence, and Matrices A Biswas, IT, BESU SHIBPUR McGraw-Hill The McGraw-Hill Companies, Inc., 2000 Set of Integers The set of integers, denoted by Z,

a 11 x 1 + a 12 x 2 + + a 1n x n = b 1 a 21 x 1 + a 22 x 2 + + a 2n x n = b 2.

Chapter 1 LINEAR EQUATIONS 1.1 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,..., a n, b are given

It is time to prove some theorems. There are various strategies for doing

CHAPTER 4 Direct Proof It is time to prove some theorems. There are various strategies for doing this; we now examine the most straightforward approach, a technique called direct proof. As we begin, it

SUM OF TWO SQUARES JAHNAVI BHASKAR

SUM OF TWO SQUARES JAHNAVI BHASKAR Abstract. I will investigate which numbers can be written as the sum of two squares and in how many ways, providing enough basic number theory so even the unacquainted

Integer Operations. Overview. Grade 7 Mathematics, Quarter 1, Unit 1.1. Number of Instructional Days: 15 (1 day = 45 minutes) Essential Questions

Grade 7 Mathematics, Quarter 1, Unit 1.1 Integer Operations Overview Number of Instructional Days: 15 (1 day = 45 minutes) Content to Be Learned Describe situations in which opposites combine to make zero.

RSA Encryption. Kurt Bryan ..., 2, 1, 0, 1, 2,...

1 Introduction Our starting point is the integers RSA Encryption Kurt Bryan..., 2, 1, 0, 1, 2,... and the basic operations on integers, +,,,. The basic material could hardly be more familiar. We denote

MAT Mathematical Concepts and Applications

MAT.1180 - Mathematical Concepts and Applications Chapter (Aug, 7) Number Theory: Prime and Composite Numbers. The set of Natural numbers, aka, Counting numbers, denoted by N, is N = {1,,, 4,, 6,...} If

MIDY S THEOREM FOR PERIODIC DECIMALS. Joseph Lewittes Department of Mathematics and Computer Science, Lehman College (CUNY), Bronx, New York 10468

INTEGERS: ELECTRONIC JOURNAL OF COMBINATORIAL NUMBER THEORY 7 (2007), #A02 MIDY S THEOREM FOR PERIODIC DECIMALS Joseph Lewittes Department of Mathematics and Computer Science, Lehman College (CUNY), Bronx,

THE 2-ADIC, BINARY AND DECIMAL PERIODS OF 1/3 k APPROACH FULL COMPLEXITY FOR INCREASING k

#A28 INTEGERS 12 (2012) THE 2-ADIC BINARY AND DECIMAL PERIODS OF 1/ k APPROACH FULL COMPLEXITY FOR INCREASING k Josefina López Villa Aecia Sud Cinti Chuquisaca Bolivia josefinapedro@hotmailcom Peter Stoll

PYTHAGOREAN TRIPLES PETE L. CLARK

PYTHAGOREAN TRIPLES PETE L. CLARK 1. Parameterization of Pythagorean Triples 1.1. Introduction to Pythagorean triples. By a Pythagorean triple we mean an ordered triple (x, y, z) Z 3 such that x + y =

Algebraic Systems, Fall 2013, September 1, 2013 Edition. Todd Cochrane

Algebraic Systems, Fall 2013, September 1, 2013 Edition Todd Cochrane Contents Notation 5 Chapter 0. Axioms for the set of Integers Z. 7 Chapter 1. Algebraic Properties of the Integers 9 1.1. Background

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

The Prime Numbers Before starting our study of primes, we record the following important lemma. Recall that integers a, b are said to be relatively prime if gcd(a, b) = 1. Lemma (Euclid s Lemma). If gcd(a,

Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof. Harper Langston New York University

Discrete Mathematics Lecture 3 Elementary Number Theory and Methods of Proof Harper Langston New York University Proof and Counterexample Discovery and proof Even and odd numbers number n from Z is called

a = bq + r where 0 r < b.

Lecture 5: Euclid s algorithm Introduction The fundamental arithmetic operations are addition, subtraction, multiplication and division. But there is a fifth operation which I would argue is just as fundamental

NUMBER THEORY AMIN WITNO

NUMBER THEORY AMIN WITNO ii Number Theory Amin Witno Department of Basic Sciences Philadelphia University JORDAN 19392 Originally written for Math 313 students at Philadelphia University in Jordan, this

Summer High School 2009 Aaron Bertram. 1. Prime Numbers. Let s start with some notation:

Summer High School 2009 Aaron Bertram 1. Prime Numbers. Let s start with some notation: N = {1, 2, 3, 4, 5,...} is the (infinite) set of natural numbers. Z = {..., 3, 2, 1, 0, 1, 2, 3,...} is the set of

Just the Factors, Ma am

1 Introduction Just the Factors, Ma am The purpose of this note is to find and study a method for determining and counting all the positive integer divisors of a positive integer Let N be a given positive

UOSEC Week 2: Asymmetric Cryptography. Frank IRC kee Adam IRC xe0 IRC: irc.freenode.net #0x4f

UOSEC Week 2: Asymmetric Cryptography Frank farana@uoregon.edu IRC kee Adam pond2@uoregon.edu IRC xe0 IRC: irc.freenode.net #0x4f Agenda HackIM CTF Results GITSC CTF this Saturday 10:00am Basics of Asymmetric

Oh Yeah? Well, Prove It.

Oh Yeah? Well, Prove It. MT 43A - Abstract Algebra Fall 009 A large part of mathematics consists of building up a theoretical framework that allows us to solve problems. This theoretical framework is built