# Math 347

Worksheet: Number Theory II

A.J. Hildebrand

Number Theory, II: Congruences
Congruences are a simple, but extremely useful concept in number theory. The magic of congruences (“modular arithmetic”) can often turn an otherwise complex and lengthy argument into a couple of lines. This worksheet summarizes the basic deﬁnitions and results about congruences that you need to know, and has exercises that illustrate the wide variety of applications of congruences. Deﬁnition of a congruence. Let a, b ∈ Z, and m ∈ N. We say “a is congruent to b modulo m”, and write “a ≡ b mod m”, if m | (a − b). The integer m is called the modulus of the congruence. Notes. • Equivalent deﬁnition: a ≡ b mod m means that a = b + km for some k ∈ Z, i.e., that a and b diﬀer by an integer multiple of m. • Connection with divisibility: Let a ∈ Z and d ∈ N. Then d | a if and only if a ≡ 0 mod d. • Connection with the division algorithm: Let a ∈ Z, b ∈ N, and let r be the remainder obtained when dividing a by b, using the division algorithm; i.e., a = qb + r, where q, r ∈ Z and 0 ≤ r < b. Then a ≡ r mod b. Properties of congruences. What makes congruences so useful is that, to a large extent, they can be manipulated like ordinary equations. Congruences to the same modulus can be added, multiplied, and taken to a ﬁxed positive integral power; i.e., for any a, b, c, d ∈ Z and m ∈ N we have: 1. If a ≡ b mod m and c ≡ d mod m, then a + c ≡ b + d mod m. 2. If a ≡ b mod m and c ≡ d mod m, then ac ≡ bd mod m. 3. If a ≡ b mod m and k ∈ N, then ak ≡ bk mod m. 4. If a ≡ b mod m and P (x) is a polynomial with integer coeﬃcients, then P (a) ≡ P (b) mod m. Notes. • Congruences to diﬀerent moduli cannot be added or multiplied in a similar manner. • Since congruences are only deﬁned for integers, dividing two congruences would make no sense. • Congruences can not be exponentiated; i.e., it is not true that a ≡ b mod m and c ≡ d mod m implies ac ≡ bd mod m. (However, by the above properties, one can take each side of a congruence a ≡ b mod m to the same power k.) Fermat’s Little Theorem:. Let p be a prime and a ∈ N such that p a. Then ap−1 ≡ 1 mod p. Note. The modulus p in Fermat’s Theorem must be prime. For composite moduli, the stated congruence is (in general) false. (For example, for modulus 5, which is prime, 35−1 = 81 ≡ 1 mod 5, but for modulus 6, 36−1 = 243 ≡ 3 mod 6.)

1

This fact can be used. 4. (b) (HW) Divisibility by 11: Given n ∈ N. and if n = 1001.J. then t(n) = 7 − 4 + 3 = 6. b − 1} and ak = 0. along with the properties of congruences (and especially the fact that congruences can be taken to a ﬁxed power). show that the equation 3x2 − x = 2y 2 + 1 has no integer solutions.. show that the equation x2 + y 2 = 4z + 3 has no integer solutions. Divisibility tests. in the base b representation (1). to quickly. (a) Divisibility by 9: Given n ∈ N. if n = 347. starting from the right. a0 )b ⇐⇒ n = i=0 ai bi . the last digit of n.e. b − 1]. .e.) 2. (For example. 3. First recall the precise meaning of a base b representation of an integer n ∈ N (where the base b is an integer with b ≥ 2): k (1) n = (ak ak−1 . (b) Using congruences. . (b) (HW) Find the last digit in the base 8 expansion of 91000 .. Last digits of large numbers: The last (rightmost) digit in the base b representation of an integer n ∈ N is congruent to n modulo b. base 10) representation. (c) Find the remainder of 31001 when divided by 5. Divisibility properties of large numbers: (a) Show that 3 divides 4n − 1 for all n ∈ N. i. Some of the problems will be worked out in class. Show that n ≡ s(n) mod 9. s(n) = a0 + a1 + · · · .e. t(n) = a0 − a1 + a2 − a3 + · · · . This follows since bi ≡ 0 mod b for i ≥ 1 and b0 = 1. Moreover. . (e) (HW) Find the remainder of 347101 when divided by 101. let t(n) denote the alternating sum of its decimal digits starting from the right. then t(n) = 1 − 0 + 0 − 1 = 0. others will be part of the homework assignments. 1. Deduce from this result the following divisibility test for 11: an integer is divisible by 11 if and only if the alternating sum of its decimal digits. . and with minimal amounts of computations. Hildebrand Congruences: Problems The following problems illustrate some of the main applications of congruences. show that n5 − n is divisible by 3 for all n ∈ N. are congruent to 0 modulo b. where the ai are as in (1). show that 6 divides n3 + 5n for all n ∈ N.Math 347 Worksheet: Number Theory II A.. (d) Find the reminder of 3471001 when divided by 3. with the “digits” ai satisfying ai ∈ {0. all terms except for a0 . 101000 . Deduce from this result the familiar divisibility test for 9: an integer is divisible by 9 if and only if the sum of its decimal digits is divisible by 9. 111000 . . (a) Find the last decimal digit of 3347 . (c) Using congruences modulo 2. let s(n) denote the sum of the digits of n in decimal (i. 2 .) Show that n ≡ t(n) mod 11. as illustrated by the following examples. (d) (HW) Using congruences modulo 4. (Hint: Note that 101 is prime. where the ai are as in (1). Divisibility of polynomials: (a) Using congruences. ﬁnd the last digits of very large numbers. and hence. i. . this digit is uniquely determined by the congruence of n modulo the base b. 1. and use Fermat’s Little Theorem. (b) (HW) Show that 7 divides 43n+1 + 23n+1 + 1 for all n ∈ N. is divisible by 9. since a digit in a base b representation must be in the interval [0.

Sign up to vote on this title