Modular Arithmetic and Divisibility
Number Theory
Annie Xu and Emily Zhu
September 11, 2016
1 Introduction
Definition 1 (Divisibility). An integer a is said to be divisible by some nonzero integer b if there
exists an integer c such that a = bc. Alternatively, for b 6= 0, ab is an integer.
Definition 2 (Euclidean Algorithm). Given integers a, b, the series of divisors q1 , q2 , . . . such that
a = bq1 + q2 , b = q2 q3 + q4 , q2 = q4 q5 + q6 , . . . (see example). The final value (when the other is 0)
gives gcd(a, b), i.e. the greatest common divisor of a and b.
Example 3. Find gcd(126, 224).
Solution.
gcd(126, 224) = gcd(126, 224 − 126) 224 = 1 × 126 + 98
gcd(126, 98) = gcd(98, 126 − 98) 126 = 1 × 98 + 28
gcd(98, 28) = gcd(28, 98 − 3 · 28) 98 = 3 × 28 + 14
gcd(28, 14) = gcd(14, 28 − 2 · 14) 28 = 2 × 14 + 0
= gcd(14, 0)
Thus, gcd(126, 224) = 14 .
Definition 4 (Relatively Prime). Given integers a, b, they are called relatively prime or coprime
if gcd(a, b) = 1.
Definition 5 (Prime). An integer p is called prime if when p divides a product ab (where a, b are
integers), then p divides a or p divides b. Equivalently p is prime if p = ab (where a, b are integers),
then either a = 1 or b = 1.
Theorem 6 (Fundamental Theorem of Arithmetic). Every nonzero integer can be written uniquely
(up to order) as a product of primes.
Definition 7 (Modular Arithmetic). Given integers a, b, c, b 6= 0, a ≡ c (mod b) if b divides (a−c).
Example 8.
5 ≡ 2 (mod 3) 17 ≡ 12068357 (mod 10) 54 ≡ 42 ≡ 0 (mod 6)
2 6≡ 1 (mod 3) 4 + 1 ≡ 29 + 6 (mod 5) 3 × −1 ≡ 19 × 15 (mod 8)
2 Problems
1. Using modular arithmetic, show that 3 divides n if and only if 3 divides the sum of the digits
of n. Do the same for 9. Can you find something similar for 11?
1
2. Find gcd(221, 299) and gcd(2520, 399).
3. Compute the remainder when 333 + 999 and 3333 × 7777 are divided by 5.
4. How many steps does it take the Euclidean Algorithm to reach (1, 0) when the input is
(n + 1, n)?1
5. Let n be a positive integer. Construct a set of n consecutive positive integers that are not
prime.1
6. Find all positive integers n such that (n + 1) divides (n2 + 1).2
7. Find all primes in the form n3 − 1.2
8. What is the largest positive integer n for which (n + 10) divides n3 + 100?3
. . 1} is composite.2
9. Show that |1 .{z
91 ones
10. A year is a leap year if and only if the year number is divisible by 400 (such as 2000) or
is divisible by 4 but not 100 (such as 2012). The 200th anniversary of the birth of novelist
Charles Dickens was celebrated on February 7, 2012, a Tuesday. On what day of the week
was Dickens born?4
11. What is the largest prime factor of 7999488?5
12. An n-digit number is cute if its n digits are an arrangement of the set {1, 2, . . . , n} and its
first k digits form an integer that is divisible by k, for k = 1, 2, . . . , n. For example, 321 is
a cute 3-digit integer because 1 divides 3, 2 divides 32 and 3 divides 321. How many cute
6-digit numbers are there?6
13. An old receipt has faded. It reads 88 chickens at the total of $x4.2y, where x and y are
unreadable digits. How much did each chicken cost?2
n n
14. Find the smallest positive integer such that 2 is a square and 3 is a cube.2
15. How many primes have alternating 1s and 0s in base 10 (like 101)?7
a 1 1 1 1 1
16. If a, b ∈ N such that b =1− 2 + 3 − 4 + ··· − 1318 + 1319 , show that 1979 divides a.8
1
From Mathematical Thinking by John P. D’Angelo and Douglas B. West
2
From Number Theory for Mathematical Contests by David A. Santos
3
From AIME 1986
4
AMC 10/12A 2012
5
PUMaC 2011
6
AHSME 1991
7
Putnam 1989
8
IMO 1979