Teaser
Teaser
2, , e, etc
The integers Z are dened as the integers:
{ , 3, 2, 1, 0, 1, 2, 3, }
Z
+
denotes the positive integers {1, 2, 3, } while Z
denotes the
negative integers { , 3, 2, 1}.
The natural numbers N are dened as the positive integers or Z
+
. The
natural numbers including 0 are dened as N
0
.
The rational numbers Q are dened as the ratio of two integers, such
as
2
3
or
17
29
.
The complex numbers C are dened as a + bi where a, b R.
0.3.2 Divisibility
We say that a divides b if
b
a
is an integer. For example, 4 divides 12 since
12
4
= 3, however, 4 does not divide 13 since
13
4
= 3.25. We write a divides
b as a | b. In this, b is also a multiple of a. In this text, when we say
divisors we assume positive divisors. When considering divisors of
natural n, we only have to work up to
n. The reason for this is if n = ab
then we obviously cannot have a, b >
n.
Olympiad Number Theory Justin Stevens Page 6
0.3.3 Induction
Induction is a proof technique used often in math. As it can be tricky to
those who are understanding it for the rst time, we begin with an example
problem and explain the method of induction as we solve this problem.
Example 0.3.1. Show that for all natural n, 1+2+3+ +n =
n(n+1)
2
.
Solution. In induction, we rst o have to show a statement holds for a base
case, typically n = 1. In this case,
1 =
1 2
2
so the base case holds. We now show that if the problem statement holds
for n = k, then it holds for n = k+1. This essentially sets o a chain, where
we have
n = 1 = n = 2 = n = 3 =
The reason we have to show the base case is because it is the oseter of
the chain. Because of this reason, we can think of induction as a chain of
dominoes. Once we knock down the rst domino, and show that hitting
a dominoe will knock down the proceeding domino, we know all the domi-
noes will be knocked down. Our inductive hypothesis is that the problem
statement holds for n = k, or henceforth
1 + 2 + 3 + + k =
k(k + 1)
2
We now need to show that it holds for n = k + 1 or we need to show that
1 + 2 + 3 + + (k + 1) =
(k+1)(k+2)
2
. Now, notice that
1 + 2 + 3 + + (k + 1) = (1 + 2 + 3 + + k) + k + 1
=
k(k + 1)
2
+ k + 1 =
(k + 1)(k + 2)
2
As desired. Therefore, we have completed our induction.
Theorem 0.3.1 (Induction). Lets say we have a statement P(n) that
we wish to show holds for all natural n. It is sucient to show the
statement holds for n = 1 and that P(k) = P(k + 1) for natural k,
then the statement is true for all natural n.
NOTE: The statement P(k) = P(k + 1) means that if P(k) is
Olympiad Number Theory Justin Stevens Page 7
true (meaning the statement holds for n = k), then P(k + 1) is true.
This is used for ease of communication.
Proof. We use the well ordering principle. The well ordering principle
states that every set has a smallest element. In this case, assume that
for sake of contradiction, P(n) is not true for some n = x S. Let y
be the smallest element of S and since y > 1 (from us showing the base
case), we have y 1 1. Therefore P(y 1) is true. We also know that
P(k) = P(k + 1). Therefore, P(y 1) = P(y), contradiction.
Theorem 0.3.2 (Strong induction). For a statement P(n) that we wish
to show holds for all natural n, it is sucient to show a base case (n = 1)
and that if P(n) is true for n {1, 2, 3, , k} it implies P(k + 1) is
true.
Proof. The proof is identical to the above proof verbatum.
It is assumed the reader has prior knowledge of induction, so this should
be review. If induction is still confusing at this point, we recommend the
reader reads up on induction as it is vital for this text.
0.3.4 Other
This section includes formulas it is assumed the reader knows.
Theorem 0.3.3 (Binomial Theorem). For n natural,
(x + y)
n
=
n
i=0
x
i
y
ni
Denition 0.3.1. The greatest common divisor of two integers a, b is de-
noted gcd(a, b). For example, gcd(4, 12) = 4.
Denition 0.3.2. The least common multiple of two integers a, b is denoted
lcm[a, b]. For example lcm[4, 15] = 60
Denition 0.3.3. We dene
a b (mod c) c | a b
For example 13 1 (mod 4) since 4 | 12.
Olympiad Number Theory Justin Stevens Page 8
Denition 0.3.4. A number is said to be prime if the only divisors of the
number are 1 and itself. For example, 5 is prime since 1 | 5, 2 5, 3 5, 4
5, 5 | 5. On the other hand, 6 is not prime as 1, 2, 3, 6 | 6. A number is said
to be composite if n can be expressed in the form ab for a, b being positive
integers greater than 1. 1 is said to be neither prime nor composite.
Denition 0.3.5. means contradiction
Denition 0.3.6. The degree of a polynomial is dened as the highest
exponent in its expansion. For example, deg(x
3
2x
2
+1) = 3 and deg(x
2
+
x
4
1) = 4.
1
Divisibility: The building blocks of
number theory
In this chapter we explore the building blocks behind number theory: di-
visibility. We will explore algorithms and other vital theorems for number
theory, along with a few problems they apply too. While this section is
smaller in length then other sections, it is the building blocks and founda-
tions of all number theory. These proofs can be repeated in similar vein for
unique factorization domains, something we will not get into in this paper.
I apologize in advance for the number of induction posts, however, when
we are laying down the ground blocks and dont have many tools to use, we
must use induction in many cases to prove theorems (or we can just assume
theyre true which I dont like to do).
1.1 Euclidean Algorithm
Before we get into the Euclidean Algorithm, we must rst introduce the
division algorithm which is vital for use in the Euclidean Algorithm.
Theorem 1.1.1. The division algorithm states for every natural pair
a, b with a > b, one can nd exactly one distinct pair of quotient and
remainder (q and r respectively) such that
a = bq + r 0 r < b
Proof. We have to show every number can be represented under the division
algorithm, and that each representation is distinct. Assume for sake of
contradiction that we cannot for any b constant. Notice that b = b 1 and
9
Olympiad Number Theory Justin Stevens Page 10
b + 1 = b 1 + 1 therefore we have shown the base cases. Assume that the
division algorithm holds for all a x and does not for a = x + 1. Let the
representations of a = x be
x = bq
1
+ r
1
Then, notice that
x + 1 = bq
1
+ r
1
+ 1
If r
1
+ 1 = b, then we have x + 1 = b(q
1
+ 1), and if not then we have
r
1
+ 1 < b and this is a contradiction.
The second part is to show uniqueness. Assume for the sake of contra-
diction that a can be represented in two ways:
a = bq
1
+ r
1
= bq
2
+ r
2
b(q
1
q
2
) = r
2
r
1
This implies that b | r
2
r
1
. However,
b > r
2
r
1
> b
since 0 r
1
, r
2
< b, therefore we must have r
2
r
1
= 0 implying r
2
= r
1
and q
1
= q
2
.
Example. 13 = 4 3 + 1, 14 = 7 2, etc.
Theorem 1.1.2. For two natural a, b, a > b, to nd gcd(a, b) we use
the division algorithm repeatedly
a = bq
1
+ r
1
b = r
1
q
2
+ r
2
r
1
= r
2
q
3
+ r
3
r
n2
= r
n1
q
n
+ r
n
r
n1
= r
n
q
n+1
Then we have gcd(a, b) = gcd(b, r
1
) = gcd(r
1
, r
2
) = = gcd(r
n1
, r
n
) =
r
n
Olympiad Number Theory Justin Stevens Page 11
Proof. We induct on a + b. Assume the Euclidean algorithm holds for all
pairs of a + b < k and we show it holds for a + b = k. First o, we must do
a base case, which is when a = 2, b = 1. Trivially then, 2 = 1 2 + 0, and
so gcd(a, b) = r
0
= b = 1 and the algorithm holds.
Now, if we can show that gcd(a, b) = gcd(b, r
1
) then by induction since
b +r
1
< k, we can use the Euclidean algorithm on b, r
1
and we will be done.
Let gcd(a, b) = d, and we have d | b, r
1
(since r
1
= a bq
1
). Now, all that
remains is to show that we cannot have c | b, r
1
with c > d. If c | b, r
1
then
since a = r
1
+bq
1
we will have c | a and then gcd(a, b) c > d contradiction.
Therefore gcd(b, r
1
) = d and we are done.
Example 1.1.1. Find gcd(110, 490).
Solution.
490 = 110 4 + 50
110 = 50 2 + 10
50 = 10 5
If this method is long or tedious, another way you could do this question
is as follows:
gcd(110, 490) = gcd(110, 490 4 110)
= gcd(110, 50) = gcd(110 50 2, 50)
= gcd(10, 50) = 10
A very common method used in Euclidean Algorithm problems is to
reduce numbers using modulos:
490 50 (mod 110)
110 10 (mod 50)
50 0 (mod 10)
gcd(490, 110) = 10
Euclidean Algorithm works for polynomials too. On this rare occasion,
we omit the proof. Let a(x) and b(x) be two polynomials that we wish to
nd the greatest common divisor of. The division algorithm similarly works
Olympiad Number Theory Justin Stevens Page 12
for polynomials: If deg(a(x)) > deg(b(x)) then there exists polynomials q(x)
and r(x) such that
a(x) = b(x)q(x) + r(x), deg(r) < deg(q)
Then the following algorithm calculuates gcd(a(x), b(x)):
a(x) = b(x)q
1
(x) + r
1
(x)
b(x) = r
1
(x)q
2
(x) + r
2
(x)
r
1
(x) = r
2
(x)q
3
(x) + r
3
(x)
r
n1
(x) = r
n
(x)q
n+1
(x) + r
n+1
(x)
r
n
(x) = r
n+1
(x)q
n+2
(x)
Then gcd(a(x), b(x)) = r
n+1
(x). The greatest common divisor of two poly-
nomials is chosen to be monic, meaning the leading coecient is 1. Notice
that polynomials during this process may have fractional coecients. The
method of modulo reduction works in polynomials as well, as we will see
later in this section.
Example 1.1.2. (1985 AIME) The numbers in the sequence 101, 104,
109, 116, . . . are of the form a
n
= 100+n
2
, where n = 1, 2, 3, . . . . For
each n, let d
n
be the greatest common divisor of a
n
and a
n+1
. Find the
maximum value of d
n
as n ranges through the positive integers.
Solution. To do this, we notice that:
gcd(100 + n
2
, 100 + (n + 1)
2
) = gcd(100 + n
2
, 100 + (n + 1)
2
100 n
2
)
= gcd(100 + n
2
, 2n + 1) = gcd(200 + 2n
2
, 2n + 1)
= gcd(200 + 2n
2
n(2n + 1), 2n + 1) = gcd(200 n, 2n + 1)
= gcd(400 2n, 2n + 1) = gcd(401, 2n + 1)
The answer is hence 401 obtained when n = 200.
Example 1.1.3. (IMO 1959) Prove that for natural n the fraction
21n+4
14n+3
is irreducible.
Solution.
gcd(21n + 4, 14n + 3) = gcd(7n + 1, 14n + 3)
= gcd(7n + 1, 14n + 3 2(7n + 1)) = gcd(7n + 1, 1) = 1
Olympiad Number Theory Justin Stevens Page 13
Example 1.1.4. Let n be a positive integer. Calculuate gcd(n! +1, (n+
1)!).
Solution.
gcd(n! + 1, (n + 1)!) = gcd(n! + 1, (n + 1)! (n + 1)(n! + 1))
= gcd(n! + 1, (n + 1)) = gcd(n! + 1, n + 1)
Let p be a prime divisor of n + 1. Unless n + 1 is prime, we have
p n = n! + 1 1 (mod p)
It turns out that when n+1 is prime, we have n! +1 0 (mod n+1), which
we will prove in the Wilsons theorem section. Therefore, the answer is
gcd(n! + 1, (n + 1)!) =
_
1 if n + 1 is composite
n + 1 if n + 1 is prime
Example 1.1.5. (AIME 1986) What is the largest positive integer n
such that n
3
+ 100 is divisible by n + 10?
Solution. Notice that
gcd(n
3
+ 100, n + 10) = gcd(n
3
+ 100 (n
2
10n)(n + 10), n + 10)
= gcd(100 10n, n + 10) = gcd(100 10n + 10(n + 10), n + 10)
= gcd(200, n + 10) = n + 10
The answer is hence n = 190 .
Example 1.1.6. (2005 Iran) Let n, p > 1 be positive integers and p be
prime. We know that n | p 1 and p | n
3
1. Prove that 4p 3 is a
perfect square.
Solution. Let p = kn +1. Now, notice that n | p 1 implies that p n +1.
Therefore gcd(p, n 1) = 1 (since p is a prime). Therefore
p = kn + 1 | n
2
+ n + 1 | kn
2
+ kn + k
Olympiad Number Theory Justin Stevens Page 14
Now,
gcd(kn + 1, kn
2
+ kn + k) = gcd(kn + 1, kn
2
+ kn + k n(kn + 1))
= gcd(kn + 1, kn + k n)
Therefore either kn +k n = 0 or k n 1. Obviously, the rst condition
is impossible, therefore k n 1. Also, kn + 1 n
2
+ n + 1 so k n + 1
implying k = n + 1. Therefore p = n
2
+ n + 1 giving
4p 3 = 4n
2
+ 4n + 4 3 = (2n + 1)
2
Theorem 1.1.3. For natural a, m, n, gcd(a
m
1, a
n
1) = a
gcd(m,n)
1
Proof. We again induct on m + n for any a. WLOG assume m > n. Now,
for (m, n) = (2, 1) we have
gcd(a
2
1, a 1) = a 1 = a
gcd(1,2)
1
Next, we use strong induction and assume the problem statement holds for
m + n < k and we show that it holds for m + n = k. Notice that
gcd(a
m
1, a
n
1) = gcd(a
m
1 a
mn
(a
n
1), a
n
1)
= gcd(a
mn
1, a
n
1)
Now, by inductino hypothesis
gcd(a
mn
1, a
n
1) = a
gcd(mn,n)
1 = a
gcd(m,n)
1
Using Euclids algorithm. We are therefore done by strong induction.
Example 1.1.7. The greatest common divisor of 2
30
10
2 and 2
30
45
2
can be expressed in the form 2
x
2. Calculuate x.
[PUMAC 2013] Using the above theorem,
gcd(2
30
10
2, 2
30
45
2) = 2
_
2
gcd(30
10
1,30
45
1)
1
_
= 2
_
2
30
gcd(10,45)1
1
_
= 2
_
2
30
5
1
1
_
= 2
30
5
2
Therefore, x = 30
5
.
Olympiad Number Theory Justin Stevens Page 15
Comment. The actual problem asked for the remainder when the greatest
common divisor was divided by 2013. This, however, involves Eulers Totient
Theorem, something we will get to later in the text.
Example 1.1.8. Prove that for positive integers a, b > 2 we cannot have
2
b
1 | 2
a
+ 1.
Solution. Assume for the sake of contradiction that 2
b
1 | 2
a
+ 1. We
obviously have a > b, so write a = bq + r using the division algorithm. We
must have gcd(2
b
1, 2
a
+ 1) = 2
b
1. We then have
gcd(2
b
1, 2
a
+ 1) = gcd(2
b
1, 2
a
+ 1 + 2
b
1)
= gcd(2
b
1, 2
b
_
2
ab
+ 1
_
= gcd(2
b
1, 2
ab
+ 1)
Repeating this process, we arrive at
gcd(2
b
1, 2
a
+ 1) = gcd(2
b
1, 2
aqb
+ 1) = gcd(2
b
1, 2
r
+ 1)
Since r < b, we have 2
r
+ 1 2
b1
+ 1 < 2
b
1 for a, b > 2.
Example 1.1.9. Prove that if m = n, then
gcd(a
2
m
+ 1, a
2
n
+ 1) =
_
1 if a is even
2 if a is odd
Proof. First o, WLOG let m > n. Then we have
a
2
n
+ 1 | a
2
n+1
1 | a
2
m
1
The last step follows from the fact that 2
n+1
| 2
m
.
Let a
2
m
1 = q(a
2
n
+ 1). Therefore,
_
a
2
m
1
_
= q(a
2
n
+ 1) 2
By the Euclidean Algorithm,
gcd(a
2
m
1, a
2
n
+ 1) = gcd(a
2
n
+ 1, 2) =
_
1 if a is even
2 if a is odd
Olympiad Number Theory Justin Stevens Page 16
Example 1.1.10. If p is an odd prime, and a, b are relatively prime
positive integers, prove that
gcd(a + b,
a
p
+ b
p
a + b
) = 1 or p
Solution. (Experimenting)
We originally look at this problem and have no idea how to even begin.
It looks like an Euclidean Algorithm problem. We use a problem solving
strategy of reducing the problem. We set b = 1 and our goal is to now show
that
gcd(a + 1,
a
p
+ 1
a + 1
) = 1or p
We notice that
a
p
+ 1
a + 1
= a
p1
a
p2
+ a
p3
a
p4
+ a + 1
We try out some small cases. a = 2 gives us gcd(3, 2
p1
2
p2
+ 2+1).
Now, notice that
_
x 0 (mod 2) 2
x
1 (mod 3)
x 1 (mod 2) 2
x
1 (mod 3)
Now, in the above sum, every term with even exponent is positive and
every term with negative exponent is negative (since p1 is even). Therefore,
each term of the sum is 1 mod 3, or henceforth the whole sum is p mod 3.
Therefore, using the Euclidean Algorithm, we arrive at
gcd(3, 2
p1
2
p2
+ 2 + 1) = gcd(3, p)
When p = 3 this is 3, else this is 1.
We try this method again for a = 3 We arrive at gcd(4, 3
p1
3
p2
+
3 + 1). Again, notice that
_
x 0 (mod 2) 3
x
1 (mod 4)
x 1 (mod 2) 3
x
1 (mod 4)
Again, every number with an even exponent is positive and every term with
a negative exponent is negative, therefore
3
p1
3
p2
+ 3 + 1 1 + 1 + 1 + + 1 p (mod 4)
Olympiad Number Theory Justin Stevens Page 17
Now, using the Euclidean Algorithm, we have
gcd(4, 3
p1
3
p2
+ 3 + 1) = gcd(4, p) = 1
Using the fact that p is an odd prime.
OBSERVATIONS:
It appears as if we always have
a
p
+1
a+1
p (mod a + 1).
We set about proving this. Notice that:
a
p
+ 1
a + 1
= a
p1
a
p2
+ + a
2x
a
2x1
+ a + 1
(1)
p1
(1)
p2
+ + (1)
2x
(1)
2x1
a + 1 (mod a + 1)
1 + 1 + + 1
. .
p terms
p (mod a + 1)
Now, by the Euclidan Algorithm, we have
gcd(a + 1,
a
p
+ 1
a + 1
) = gcd(a + 1, p) = 1 or p
We have now solved the problem for b = 1. We wish to generalize the
method to any b.
Notice that
a
p
+ b
p
a + b
= a
p1
a
p2
b + a
p3
b
2
a
p4
b
3
+ ab
p2
+ b
p1
Next, notice that
a
p1
a
p2
b+a
p3
b
2
a
p4
b
3
+ ab
p2
+b
p1
(b)
p1
(b)
p2
b+ pb
p1
(mod a+b)
Therefore, by the Euclidean Algorithm we arrive at
gcd(
a
p
+ b
p
a + b
, a + b) = gcd(pb
p1
, a + b) = gcd(p, a + b) = 1 or p
The last fact follows from the fact that gcd(b, a + b) = 1.
Wow, that was a really nice problem!
We rst o test out b = 1 to see if we can solve the problem for a
smaller case.
Olympiad Number Theory Justin Stevens Page 18
We test some small values of a and get the idea to use the modulo idea
in the Euclidean Algorithm.
We extend the solution to general b.
Solution. (Rigorous) Notice that
a
p
+ b
p
a + b
=
p1
i=0
(1)
i
a
p1i
b
i
pb
p1
(mod a + b)
Now, by the Euclidean Algorithm we arrive at
gcd(
a
p
+ b
p
a + b
, a + b) = gcd(pb
p1
, a + b) = gcd(p, a + b) = 1 or p
Since gcd(b, a + b) = 1.
1.1.1 Excercises
Problem 1.1.1. Calculate gcd(301, 603).
Problem 1.1.2. Calculate gcd(133, 189).
Problem 1.1.3. Calculate gcd(486, 1674). [Recommended Calculator Use]
Problem 1.1.4. For a, b relatively prime, prove
gcd(ab, a + b) = 1
Problem 1.1.5. For positive integers a, b, n > 1, prove that
a
n
b
n
a
n
+ b
n
Problem 1.1.6. Use the Euclidean Algorithm for polynomials to calculate
gcd(x
4
x
3
, x
3
x).
Problem 1.1.7. Let n 2 and k be positive integers. Prove that (n1)
2
|
(n
k
1) if and only if (n 1) | k. [Hint: This has nothing to do with the
Euclidean Algorithm, use the main idea used in the nal problem of this
section]
Problem 1.1.8. Prove that in the Euclidean algorithm illistrated above
that n + 1 log
2
a + log
2
b
Problem 1.1.9. (Japan 1996) Let m, n be relatively prime odd integers.
Calculuate gcd(5
m
+ 7
m
, 5
n
+ 7
n
).
Problem 1.1.10. (Poland 2004) Find all natural n > 1 for which value of
the sum 2
2
+ 3
2
+ + n
2
equals p
k
where p is prime and k is natural