Number Theory
Number Theory
Sumy
Sumy State University
2016
MINISTRY OF EDUCATION AND SCIENCE OF UKRAINE
SUMY STATE UNIVERSITY
Approved at meeting of
Department of Applied and
Computational Mathematics
as the abstract of lecture notes
for the discipline ”Elementary
number theory”
Record № 10 from 19.05.2015
Sumy
Sumy State University
2016
“Elementary Number Theory" lecture notes with tests /
Yu.V. Shramko, E.I. Ogloblina. – Sumy : Sumy State University,
2016. – 72 p.
3
1. DIVISIBILITY
In this course all numbers are integers unless otherwise specified.
Thus, in the following definition d, n, and k are integers.
Definition 1.1
The number d divides the number n if there exists k such that
n=d⋅k.
Alternate terms are:
d is a divisor of n,
d is a factor of n,
n is a multiple of d.
This relationship between d and n is symbolized as d | n. The
symbol d ł n means that d does not divide n. The integer k is called
the quotient from division n by d.
Note that the symbol d | n is different from the fraction symbol
d/n. It is also different from n/d because d | n is either true or false,
while n/d is a rational number.
All factors of n that are unequal 1 or n are called proper
(nontrivial) factors; 1 and n are called trivial factors of integer n.
Theorem 1.1: Divisibility Properties
For any n, m, d, and c the following properties hold:
1. ∀ d | 0.
2. if 0 | n ⇒ n = 0.
3. 1 | n.
4. (Reflexivity property) n | n.
5. n | 1 ⇒ n = 1 or n = −1.
6. (Transitivity property) d | n and n | m ⇒ d | m.
7. (Multiplication property) d | n ⇒ for any a∈Z: d | a⋅n.
8. (Linearity property) d | n and d | m ⇒ d | a⋅n + b⋅m for all
a and b.
9. (Comparison property) If d and n are positive and d | n, then
d ≤ n.
10. (Integration property) If d | a, d | b and a= b + c ⇒ d | c.
4
Definition 1.1
If n is divisible by 2, then we say that it is even (or has even
parity). Otherwise, a number is odd (or has odd parity).
Lemma 1.1
Recall that |a| equals a if a > 0 and equals −a if a < 0.
1. If d | a, then −d | a and d | −a.
2. If d | a, then d | |a|.
3. The largest positive integer that divides a nonzero number a is
|a|.
Examples
Example 1.1
Let x and y be integers. Prove that 2x + 3y is divisible by 17 if
and only if (iff) 9x + 5y is divisible by 17.
Solution
Suppose that 17 | (2x + 3y). Then, according to multiplication
property in theorem 1.1, we get 17 | [13(2x + 3y)] or
17 | (26x + 39y).
Further, we decompose the right side into sum as follows:
17 | (17x + 34y + 9x + 5y) ⇒ 17 | 17⋅(x + 2y) + (9x + 5y).
Finally, according to integration property in theorem 1.1, we
have 17 | (9x + 5y).
And conversely, producing the similar set of operations, we
obtain
17 | (9x + 5y) ⇒ 17 | [4(9x + 5y)],
or 17 | (36x + 20y) ⇒ 17 | (34x + 17y + 2x + 3y) ⇒
17 | 17(2x + y) + 2x + 3y.
Thus we have proved that 17 | 2x + 3y.
Example 1.2
Prove that for any integer m, p, q, n such that (m − p ) | (mn + pq )
is an integer, (m − p ) | (mq + np ) is also the integer.
5
Solution
Let (m − p ) | (mq + np ) be an integer. We can denote this in
mn + pq
similar way: = t1 ∈ Z .
m− p
mq + np
It is necessary to prove that = t 2 ∈ Z or t1 − t 2 ∈ Z . Let
m− p
us show this. We obviously obtain:
mn + pq mq + np m(n − q ) − p(n − q ) (m − p )(n - q )
− = = = n−q∈Z .
m− p m− p m− p m− p
mq + np
Therefore t1 − t 2 ∈ Z and, finally, = t2 ∈ Z .
m−q
Example 1.3
N is a five-digit number N = a4 a3 a2 a1 a0 , 0 ≤ ai ≤ 9 . It is known
that the number N is divisible by 41.
Prove if we shift digits of the number in a circular manner, then
we will get new numbers divisible by 41 too.
Solution
N = 10 4 a4 + 10 3 a3 + 10 2 a 2 + 10 a1 + a0 .
Let us shift the last digit a0 to the first position, as follows:
N 1 = 10 4 a0 + 10 3 a4 + 10 2 a3 + 10 a2 + a1 . It is the new number.
Prove that it is multiple of 41.
Let us try to separate the number N out from the right side of the
expression for N1 . Multiplying by 10, we get
10 N 1 = 10 5 a0 + 10 4 a4 + 10 3 a3 + 10 2 a 2 + 10 a1 .
Then add and subtract a0. It yields:
10 N 1 = 10 a0 + 10 a4 + 10 a3 + 10 a2 + 10 a1 + a0 − a0 .
5 4 3 2
6
11111
41 | N , 99999 = 9 ⋅ 11111, = 271 ⇒ 41 | 99999 ,
41
we come to conclusion that in the right side both terms are multiples
of 41. Thus 41 | 10 N 1 ⇒ 41 | N 1
Example 1.4
Prove that 30 | m 5 − m .( )
Solution
First, let us factorize 30:
30 = 5 ⋅ 6 = 5 ⋅ 3! .
( )
Hence it is necessary to prove that m5 − m will be the multiple
of 5 and 3! , simultaneously.
Secondly, we introduce the number of combinations for n by k.
n(n − 1)(n − 2 ) ⋅ ... ⋅ (n − k + 1)
Cn = ∈Z .
k
k!
It follows that the product of k consecutive integers divided by
k ! is an integer.
( )
Therefore, we need to represent m5 − m via the product of 5
consecutive integers, for such product is divisible by 5!=30*4. All
the more, considering term will be divisible by 30. Also, we can
( )
show that m5 − m is the product of 3 consecutive integers and
factor 5.
Thus we have for the first case:
(m 5
) ( )( )(
− m = m m4 − 1 = m m2 − 1 m2 + 1 = )
= ( m − 1) m ( m + 1) ( m − 4 + 5 ) = ( m − 1) m ( m + 1) ( m
2 2
)
−4 +
+5 ( m − 1) m ( m + 1) = ( m − 2 )( m − 1) m ( m + 1)( m + 2 ) + 5 ( m − 1) m ( m + 1) .
(m − 2 )(m − 1)m(m + 1)(m + 2 ) ∈ Z ⇒ 30 | (m − 2 )(m − 1)m(m + 1)(m + 2 )
5!
8
2. PRIME NUMBERS
Definition 2.1
An integer p ≥ 2 is prime if it has only trivial divisors. An integer
greater than or equal to 2 that is not prime is composite.
Note that 1 is neither prime nor composite.
Lemma 2.1
An integer n ≥ 2 is composite iff it has factors a and b such that
1 < a < n and 1 < b < n.
Lemma 2.2
If n > 1, then there is a prime p such that p | n.
Definition 2.2
Let p be a prime. If you know that p α | a and pα +1 ł a , then α is
the highest power of occurrence of the prime p to an integer a.
Theorem 2.1: The Fundamental Theorem of Arithmetic
Every integer a greater than 1 can be written uniquely in the
following form:
α α2 α3 α
a = p1 1 ⋅ p 2 ⋅ p3 ⋅ ... ⋅ p k k ,
where pi are distinct primes and αi are positive integers – the highest
power of occurrence of prime pi to an integer a.
Theorem 2.2: Euclid’s Theorem
There are infinitely many primes.
Proof.
Suppose there exist only a finite number of primes, say
p1 , p2 , . . . , pn .
Let N = p1p2 · · pn + 1. By the fundamental theorem of
arithmetic, N is divisible by some prime p. That prime must be one of
p1, . . . , pn since that list is assumed to be exhaustive. But it is seen
that N is not divisible by any of the pi. This is a contradiction; it
9
follows that the assumption that there are only finitely many primes
is not true.
We shall use the following notations:
The set of divisors of an integer a = p1α1 ⋅ p2α 2 ⋅ p3α3 ⋅ ... ⋅ pkα k is
D = { p1β1 ⋅ p2β2 ⋅ p3β3 ⋅ ... ⋅ pkβk , 0 ≤ βi ≤ α i , i = 1, k} .
The number of divisors of an integer a = p1α1 ⋅ p2α 2 ⋅ p3α3 ⋅ ... ⋅ pkα k
equals
τ (a ) = (α 1 + 1)(α 2 + 1) ⋅ ...⋅ (α k + 1) .
Theorem 2.3
If a > 1 is composite, then a has the least prime divisor p ≤ n
Example 2.1
Consider the number 97. Note that 97 < 100 = 10 . The primes
less than 10 are 2, 3, 5, and 7. None of them divides 97, and so 97 is
prime.
Useful Facts
Bertrand’s Postulate. For every positive integer n, there exists
prime p such that
n ≤ p ≤ 2n .
3. DIVISION
Let a, b be any integers. Without loss of generality by Lemma
1.1, we can assume that a > 0, b > 0.
Theorem 3.1
The pair of integers a, b (a > b) can be uniquely submitted with
pair of integers q, r, satisfying these two conditions:
1. a = b⋅q +r.
2. 0 ≤ r < b.
The integer r is called the remainder in division of a by b.
If r = 0, then q is called the quotient, other wise it is called the
partial quotient.
10
Corollary 3.1
The number d divides the number n iff in division of n by d the
remainder is r = 0.
Criteria for number divisibility
Criteria for number divisibility are important in factorization of
large integers.
To obtain criteria for divisibility, we will apply the method of
remainders. Any non-negative integer can be represented in decimal
form as follows:
N = 10 n an + 10 n−1 an−1 + ... + 10 3 a3 + 10 2 a2 + 10 a1 + a0 .
We don’t know digits an ,an−1 ,...,a3 ,a2 ,a1 ,a0 , but we can analyze
remainders of the division of 10i (i=0,1,…, n) by some numbers.
1. Criteria for divisibility of N by 2k
– Divisibility by 2
Obviously, the number 10nan+10n-1an-1+…+10a1 is divisible by 2.
If a0 is divisible by 2, then N will be divisible by 2.
– Divisibility by 4=22
Since the number 10nan+10n-1an-1+…+102a2 is divisible by 4,
then N will be divisible by 4 if 10a1+ a0 is divided by 4.
– Divisibility by 8=23
Number 10nan+10n-1an-1+…+103a3 is divisible by 8. So, if
2
10 a2+10a1+ a0 is divisible by 8, then N will be divisible by 8, and
so on.
– Generalization for 2k
If the last k digits of the number N are divisible by 2k, then N
will be divisible by 2k.
2. Criteria for divisibility of N by 3 and 9
We can rewrite number N as follows:
N = 999...9 an + 999...9 an −1 + ... + 99a2 + 9a1 + an + an −1 + ... + a1 + a0 =
n n −1
N1
n
= N1 + ∑ ai .
i =1
11
It is evident that 9|N1, 3|N1
So, if the sum of digits of the number N is divisible by 3 or 9,
then N is divisible by 3 or 9.
3. Criteria for divisibility of N by 5k
N = 10 n an + 10 n−1 an−1 + ... + 10 3 a3 + 10 2 a2 + 10 a1 + a0 .
If the number composed of the k last digits of the number N is
divisible by 5k, then N is divisible by 5k. The proof is the same as for
divisibility of N by 2k
4. Criteria for divisibility of N by 7
N = 10 n an + 10 n−1 an−1 + ... + 10 3 a3 + 10 2 a2 + 10 a1 + a0 .
Consider remainders of division of ten’s powers by 7. We have
10: 10=1⋅7+3, the remainder is 3
102: 100=14⋅7+2, the remainder is 2
103: 1000=142⋅7+6=143⋅7 - 1, the remainder is 6 or -1
104: 10000=1428⋅7+4, the remainder is 4
105: 100000=14285⋅7+5, the remainder is 5
106: 1000000=142857⋅7+1, the remainder is 1
We have obtained all type of division remainders by seven. If we
continue process of division, then we will get the remainders from
considered above set. Now we can formulate criterion for
divisibility by 7.
a. Criteria for three-digit numbers
N = 100a2 + 10a1+a0 = 98a2 + 2a2 + 7a1 + 3a1 + a0 = 98a2 + 7a1 +
+ 2a2 + 3a1 + a0=7(14a2 + a1) + 2a2 + 3a1 + a0.
If 2a2 + 3a1 + a0 is divisible by 7, then N is divisible by 7 too.
Example 3.1
Check whether numbers 581 and 163 are divisible by 7 or not.
Solution
5⋅2 + 8⋅3 + 1 = 35. It is divisible by 7, so 581 is divisible by 7
too.
1) 1⋅2 + 6⋅3 + 3 = 23. It isn’t divisible by seven. Since 23 has the
remainder 2, then 163 has the same remainder.
12
b. Criteria for n-digit numbers
Note that 103 has the remainder -1 and 106 has the remainder 1.
Represent the considering number via the sum of three-digit
numbers:
N = a2 a1a0 + 103 a5 a4 a3 + 106 a8 a7 a6 + ... =
= a2 a1a0 + 143 ⋅ 7a5 a4 a3 − a5 a4 a3 + 142857 ⋅ 7 a8 a7 a6 + a8 a7 a6 + ... =
143 ⋅ 7 a5 a4 a3 + 142857 ⋅ 7 a8 a7 a6 + ... + a2 a1a0 − a5 a4 a3 + a8 a7 a6 − ...
N1⋮7 N2
13
Solution
1) N2= 0 – 2 + 3 – 1 + 6 – 1 + 3 – 2 = 6. It isn’t divisible by 11.
So, N=23 161 320 isn’t divisible too.
2) N2= 0 – 8 + 6 – 6 + 8 – 1 + 1 = 0. It is divisible by 11,
therefore N=1 186 680 is divisible by 11 too.
6. Criteria for divisibility of N by 13
Criterion for divisibility by 13 matches the criterion of
divisibility by 7.
Example 3.4
Check that N = 3 040 232 is divisible by 13.
Solution
232 – 40 + 3 = 195. 195:13=15. Then 3 040 232 is divisible by
13.
7. Criteria for divisibility of N by d = 10k + 1 (31, 41, 61,…)
N = a n ...a3 a 2 a1 a0 = 10 A + a0 .
A
Multiply N by k:
kN = 10 kA + ka0 + A − A = A(10 k − 1) + ( A + ka0 ) .
Since k isn’t divisible by 10k – 1, it follows that N will be
divisible by 10k – 1 if N2 = A + ka0 is a multiple of 10k + 1.
This criterion can be applied until the divisibility or lack of it
become apparent.
14
Example 3.5
Check that N = 3 040 232 is divisible by 31.
Solution
Here, the divisor is 31, then it is necessary to use the eighth
criteria. We get
31 = 10⋅3+1, k = 3, A=304 023, a0 = 2.
If N 2 = A − 3a0 is divisible by 31, then N is divisible by 31:
1. N2 =304 023 – 3⋅2 = 304 017.
2. A = 30 401, a0 = 7, 30 401 – 3⋅7 = 30 380.
3. A=3 038, a0 = 0, 3 038 – 3⋅0 = 3 038.
4. A=303, a0 = 8, 303 – 3⋅8 = 279.
5. A=17, a0 = 9, 27 – 3⋅9 = 0.
It is clear that 0 is divisible by 31, so N = 3 040 232 is divisible
by 31 too. 3 040 232:31 = 98072.
15
4. GREATEST COMMON DIVISOR (GCD)
Without loss of generality (see Lemma 1.1), we can assume that
all factors of integers are positive.
Definition 4.1
An integer is a common divisor of n others if it divides all of
them.
We denote the set of numbers that are common divisors of
a1, a2, …, an by C (a1, a2, …, an).
Example 4.1
1. The set of common divisors of 18 and 30 is
C (18, 30) = {−1, 1,−2, 2,−3, 3,−6, 6}.
2. The set of common divisors of 10, 30, 100 and 130 is
C (10, 30, 100, 130) = {−1, 1,−2, 2,−5, 5,−10, 10}.
Definition 4.2
The greatest common divisor of n nonzero integers a1, a2, …, an
is the largest integer from the set C (a1, a2, …, an), except that
gcd(0, 0) = 0.
Denotation of the greatest common divisor for integers
a1, a2, …, an is
gcd (a1, …, an).
Example 4.2
For results obtained in Example 4.1, we have
1. gcd (18, 30) is the largest integer from the set
C (18, 30) = {−1, 1,−2, 2,−3, 3,−6, 6}. Then gcd (18, 30) = 6.
2. gcd (10, 30, 100, 130) is the largest integer from the set
C (10, 30, 100, 130) = {−1, 1,−2, 2,−5, 5,−10, 10}. Then gcd (10, 30,
100, 130) = 10.
Definition 4.3
If gcd (a1, a2, …, an) = 1, then integers a1, a2, …, an are called
coprime numbers (relative primes).
16
Definition 4.4
If the greatest common divisors of all pairs
(ai , a j ) (i, j = 1, 2,..., n) from integers a1, a2, …, an are equal 1, then
a1, a2, …, an are called pairwise prime numbers. Pairwise prime
numbers are coprime numbers, but not conversely.
Example 4.3
Numbers (5, 15, 21, 31) are coprime numbers, because
gcd (5, 15, 21, 31) = 1. But gcd (5,15) = 5 ≠ 1, gcd (15,21) = 3 ≠ 1.
Gcd (3, 7, 11, 13) =1, then numbers (3, 7, 11, 13) are coprime,
and gcd (3,7) =1, gcd (3,11) =1, gcd (3,13) =1, gcd (7,11) =1,
gcd (7,13) = 1, gcd (11,13) =1. Thus, the numbers are pairwise
prime numbers.
Lemma 4.1
gcd(a, b) = gcd(b, a ).
Lemma 4.2
gcd(a, b) = gcd(| a |, | b |).
Lemma 4.3
If a ≠ 0 or b ≠ 0, then gcd(a, b) exists and satisfies condition
0 < gcd(a, b) ≤ min{|a|, |b|}.
Example 4.4
It follows from considered lemmas that gcd(48, 732) =
= gcd(−48, 732) = gcd(−48,−732) = gcd(48,−732). We also know
that 0 < gcd(48, 732) ≤ 48. If d = gcd(48, 732), then
d | 48. To find d, we just need to check all positive divisors of 48 that
also divide 732.
If two numbers have the greatest common divisor equal 1,
then they have only trivial common factors.
Lemma 4.4
If g = gcd(a, b), then gcd(a/g, b/g) = 1.
Examples 4.5
g = gcd(15,21) = 3, gcd(15/3, 21/3) = gcd(5,7) = 1.
17
Lemma 4.5 (Bezout’s Lemma)
The greatest common divisor of two numbers is a linear
combination of those two: for all integers a and b there exist integers
s and t such that
gcd(a, b) = sa + tb.
18
C(a, b) ⊆ C(b, r).
On the other hand, let us assume that there exist d ∈ C(b, r) such
that d | b and d | r. Since a = bq + r, we again apply Theorem 1.1 (10)
to show that d | a. So d | a and d | b, and, therefore, d ∈ C(a, b).
That is, then d ∈ C(a, b).
QED
The Euclidean algorithm uses Lemma 5.3 to compute the
greatest common divisor of two numbers. Let us consider the
algorithm.
Choose a, b∈Z such that a > b. Construct a chain of a division
with the remainders as follows:
Step 1: a = b⋅q0 + r1, 0 < r1 < b, gcd(a, b) = gcd(b, r1);
Step 2: b = r1⋅q1 + r2, 0 < r2 < r1 , gcd(b, r1) = gcd(r1, r2)⇒
⇒ gcd(a, b) = gcd(r1, r2);
Step 3: r1 = r2⋅q2 + r3, 0 < r3 < r2 , gcd(r1, r2) =gcd(r2, r3) ⇒
⇒ gcd(a, b) = gcd(r2, r3)
…………………………………………
Step n: rn-2 = rn-1⋅qn-1 + rn, 0 < rn < rn-1, gcd(rn-2, rn-1) =
= gcd(rn-1, rn) ⇒ gcd(a, b) = gcd(rn-1, rn);
Step n+1: rn-1 = rn⋅qn
Since there is no remainder in the last division, we get gcd(rn-1, rn) =
= rn ⇒ gcd(a, b) = rn.
One can say that for any numbers a and b the last nonzero
remainder in a chain of division with the remainders is gsd(a, b).
Example 5.1
Compute gcd(803, 154), a = 803, b = 154
Step 1: gcd(803, 154) = gcd(154, 33), since 803 = 154 ⋅ 5 + 33 ,
a = bq0+r1, q0 = 5, r1 = 33, 0 < 33 < 154 .
Step 2: gcd(154, 33) = gcd(33, 22), since 154 = 33 ⋅ 4 + 22 ,
b = r1q1+r2, q1 = 4, r2 = 22, 0 < 22 < 33 .
Step 3: gcd(33, 22) = gcd(22, 11) since 33 = 22·1 + 11,
r1 = r2q2+r3, q2 = 1, r3 = 11, 0 < 11 < 22 .
Step 4: gcd(22, 11) = 11 since 22 = 11 · 2, r2 = r3q3, q3 = 2, r4 = 0.
19
Hence, gcd(803, 154) = gcd(22, 11) = 11.
Recall that Bezout’s lemma asserts that for given a and b, there
exist two numbers s and t such that gcd(a, b) = s · a+t · b. We can use
Euclidean algorithm to find s and t by tracing the steps of division in
reverse order.
Example 5.2
Express gcd(803, 154) as a linear combination of 803 and 154.
We will use the considered above Example 5.1.
From step 3: 11 = 33 – 22 · 1;
From step 2: 22 = b – 33 ·4, or 11 = 33 – (b – 33 · 4) 1 =
= – b · 1 + 33 · 5;
From step 1: 33 = a – b · 5, or 11 = – b · 1 + (a – b · 5) · 5 =
=– 26 · b + a · 5.
Hence, we can express gcd(803, 154) = 11 as a linear
combination of 803 and 154 as follows below:
11 = 803·5 + (– 26)·154, s=5, t = – 26 or g = a·5 + b·(– 26).
Lemma 5.4 (Generalization)
Let
a0 = cq0 + r0 , a1 = cq1 + r1 ,..., an = cqn + rn ⇒
⇒ gcd ( a0 , a1 ,..., an , c ) = gcd ( c, r0 , r1 ,..., rn ) .
Example 5.3
Compute gcd(261, 135, 48).
Step 1: Divide a0 =261 and a1 =135 by c= 48. We get: 261 = 48·5 +
+ 21, r10=21; 135 = 48·2 + 39, r11 = 39.
Step 2: Find gcd(48, 39, 21). Divide c = 48 and r11= 39 by r10 = 21.
We obtain 48 = 21·2 + 6, r20 = 6, 39 = 21·1 + 18, r21 = 18
Step 3: Find gcd(21, 18, 6). Divide r10 = 21 and r21= 18 by r20 = 6.
It yields: 21 = 6·3 + 3, r30 = 3, 18 = 6·3 + 0, r21 = 0. Zero is divided
by any numbers. Gcd(18,6) = 6.
Step 4: Find gcd(6, 3): gcd(6, 3) = 3.
Hence, gcd(261, 135, 48) = 3.
20
6. LOWEST (LEAST) COMMON MULTIPLE (LCM)
Definition 6.1
An integer is a common multiple of n others if it is divided by all
of them.
We denote by M(a1, a2, …, an) the set of numbers that are
common multiples of a1, a2, …, an. The set M is infinite.
Definition 6.2
The lowest common multiple of n nonzero integers a1, a2, …, an
is the least integer from the set M(a1, a2, …, an).
Designation of the lowest common multiple for integers
a1, a2, …, an is lcm(a1, …, an).
Lemma 6.1
a ⋅b
Lcm(a ,b ) = .
gcd (a ,b )
Proof
Let d = gcd(a, b), then a = a1⋅d, and b = b1⋅d, gcd(a1, b1) = 1
(according to lemma 4.4). M denotes any common multiple of a and
b. Then M = k⋅a. The number M/b is an integer, because M is
multiple of b. We will get after the series of transformations
M ka ka1 d ka1
= = = .
b b b1 d b1
Since gcd(a1, b1) = 1, we see that k is divisible by b1 and
k = b1 ⋅ t , t∈Z.
M ka1 b1ta1 a ⋅b ⋅d a ⋅b
= = = ta1 , M = a1 ⋅ b ⋅ t = 1 t= t, t ∈ Z .
b b1 b1 d d
Hence, we can express the set of common multiples of a and b
by the formula
a ⋅b
M = ⋅ t, t ∈ Z .
gcd (a ,b )
21
If t = 1, then we obtain the lowest common multiple of a and b
as follows:
a ⋅b
Lcm(a ,b ) = . QED.
gcd (a ,b )
22
6.2. Compute gcd(a, b, c) with Lemma 5.4
2. a = 67 283, b = 122 433,
1. a = 529, b = 1541, c = 1817
c = 221 703
3. a = 549 493, b =863 489, 4. a = 738089, b = 3082607,
c = 133 125 c = 28 303 937
5. a = 1767, b =2223,
6. a = 476, b = 1258, c = 21 114
c = 11 913
7. a = 3445, b =4225,
8. a = 572, b = 5746, c = 1118
c = 5915
9. a = 19 074, b =13 566, 10. a = 1073, b = 3683,
c = 8211 c = 34 481
11. a = 1012, b = 1474,
12. a = 988, b = 2014, c = 42 598
c = 4598
13. a = 2585, b = 7975,
14. a = 874, b = 1518, c = 20 142
c = 13 915
15. a = 2227, b = 9911,
16. a = 1253, b = 252, c = 406
c = 952
17. a = 2743, b = 3587, 18. a = 4345, b = 6523,
c = 6963 c = 10967
19. a = 7683, b = 5161, 20. a = 5174, b = 12 337,
c = 12 909 c = 13 403
21. a = 10 047, b = 6749, 22. a = 6766, b = 16 133,
c = 16 881 c = 17 527
23. a = 11 229, b = 7543, 24. a = 7562, b = 18 031,
c = 18 867 c = 19 589
25. a = 13 593, b = 9131, 26. a = 9154, b = 21 827,
c = 22 839 c = 23 713
27. a = 17 139, b = 11 513, 28. a = 11 542, b = 27 521,
c = 28 797 c = 29 899
29. a = 18 321, b = 12 307, 30. a = 12 338, b = 29 419,
c = 30 783 c = 31 961
23
7. CONTINUED FRACTIONS
Theorem 7.1. General Form
A continued fraction is an expression of the form
b1
α = q1 +
b2
q2 +
q3 + .....
⋮
bs −2
…… +
1
q s −1 +
αs
where α, qi and bi are either rational numbers, real numbers, or
complex numbers.
If bi = 1 for all i, then the expression is called a simple continued
fraction. If the expression contains finitely many terms, then it is
called a finite continued fraction; otherwise, it is called an infinite
continued fraction. The numbers qi are called the partial quotients.
Theorem 7.2
The continued fraction expression of a real number is finite iff
the real number is rational.
a
Every rational number can be represented by the simple
b
continued fraction as follows:
a r 1 1 1
= q1 + 1 = q1 + = q1 + = q1 + =
b b b r 1
q2 + 2 q2 +
r1 r1 r1
r2
24
1 1
= q1 + = ... = q1 + .
1 1
q2 + q2 +
q3 +
r3 q3 + ...
r2 1
qn −1 +
qn
We can obtain all qi and ri by Euclidean algorithm. The
continued fraction has as many terms, as many steps are in this
algorithm.
a
Simple continued fractions , gcd ( a, b ) = 1 can be written in a
b
compact form using a chain of partial quotients:
= [q1 ,q 2 ,...,q n ] .
a
b
Example 7.1
151
Represent rational number Q = by a continued fraction.
13
Solution
Gcd(151,13) = 1.
151 8 1 1 1
Q= = 11 + = 11 + = 11 + = 11 + =
13 13 13 5 1
1+ 1+
8 8 8
5
1 1
= 11 + = 11 + =
1 1
1+ 1+
3 1
1+ 1+
5 5
3
25
1 1 1
= 11 + = 11 + = 11 + .
1 1 1
1+ 1+ 1+
1 1 1
1+ 1+ 1+
2 1 1
1+ 1+ 1+
3 3 1
1+
2 2
= [11, 1, 1, 1, 1, 2 ] .
151
The chain of partial quotients is
13
Rational numbers obtained from only a limited number of terms
in a continued fraction are called convergents. For example, in the
simple continued fraction
a 1
= q1 +
b 1
q2 +
1
q3 +
...
1
qn−1 +
qn
the convergents are
1 1
δ1 = q1 ; δ 2 = q1 + ; δ 3 = q1 + ;....;
q2 1
q2 +
q3
1 a
δ n = q1 + = .
1 b
q2 +
q3 + ...
⋮
1
...... +
1
qn −1 +
qn
A sequence of convergents is approximation of a rational
number.
26
Convergent properties
Property 7.1
An approximated rational number lies between two neighboring
convergents closer to the right.
The method of the convergent computation
P q P
Let us denote the ith convergent by δ i = i . Then, δ 1 = q1 = 1 = 1 ,
Qi 1 Q1
1 q1 q2 + 1 q1 q 2 + 1 P2
and δ 2 = q1 + = = = .
q2 q2 1 ⋅ q 2 + 0 Q2
q q + 1 P2 P q + P0
We assign P0 = 1, Q0 = 0 . Then δ 2 = 1 2 = = 1 2 ,
1 ⋅ q2 + 0 Q2 Q1q 2 + Q0
For convergent δ 3 , we have
1
P1 q2 + + P0
q3 q (P q + P0 ) + P1 q P + P1
δ3 =
P
= 3 1 2 = 3 2 = 3 .
1 q3 (Q1 q2 + Q0 ) + Q1 q3 Q2 + Q1 Q3
Q1 q2 + + Q0
q3
qi Pi −1 + Pi −2 P
For any convergent δ i we get δ i = = i .
qi Qi −1 + Qi −2 Qi
Thus we have deduced the recursion formula for calculation of
the ith convergent.
The results of convergent computations can be placed into the table.
27
Table 7.1 – The results of convergent computations
і 0 1 2 ....
qi q1 q2 ....
Pi 1 P1 = q1 P2 = q2 P1 + P0 ....
Qi 0 Q1 = 1 Q2 = q2 Q1 + Q0 ....
j ... n
qj .... qn
Pj = q j Pj −1 + Pj − 2 .... a = Pn = qn Pn−1 + Pn−2
Q j = q j Q j −1 + Q j −2 .... b = Qn = qn Qn−1 + Qn−2
Property 7.2
For any i > 0 , the following formula takes place:
Pi Qi −1 − Qi Pi −1 = (− 1) .
i
Property 7.3
For any i > 1, the following formula takes place:
δ i − δ i −1 =
(− 1) i
.
Qi Qi −1
Property 7.2 is used for solving the Diophantine equation
ax + by = 1 .
We write down property 7.2 for the last two columns of
the table 7.1:
PnQn−1 − Qn Pn−1 = ( −1) , Pn = a, Qn = b, then aQn−1 − bPn−1 = ( −1) .
n n
28
Example 7.1
151
Compute all convergents for the number and solve the
13
Diophantine equation 151x + 13 y = 1 .
Solution
151
We will use Example 7.1. Number Q = can be written as the
13
151
chain of partial quotients: = [11, 1, 1, 1, 1, 2] . Construct the table.
13
P 11
P0 = 1, Qo = 0, P1 = q1 = 11, Q1 = 1, δ1 = 1 = = 11 ,
Q1 1
P2 = q2 P1 + P0 = 1⋅11 + 1 = 12, Q2 = q2Q1 + Q0 = 1⋅1 + 0 = 1,
P2 12
δ2 = = = 12 ,
Q2 1
P3 = q3 P2 + P1 = 1 ⋅12 + 11 = 23, Q3 = q3Q2 + Q1 = 1 ⋅1 + 1 = 2,
P3 23
δ3 = = = 11.5 ,
Q3 2
P4 = q4 P3 + P2 = 1⋅ 23 + 12 = 35, Q4 = q4Q3 + Q2 = 1⋅ 2 + 1 = 3,
P4 35
δ4 = = ≈ 11.667 ,
Q4 3
P5 = q5 P4 + P3 = 1⋅ 35 + 23 = 58, Q5 = q5Q4 + Q3 = 1⋅ 3 + 2 = 5,
P 58
δ 5 = 5 = = 11.6 ,
Q5 5
P6 = q6 P5 + P4 = 2 ⋅ 58 + 35 = 151, Q6 = q6Q5 + Q4 = 2 ⋅ 5 + 3 = 13,
P6 151 a
δ6 = = ≈ 11.615 = .
Q6 13 b
29
і 0 1 2 3 4 5 6
qi 11 1 1 1 1 2
Pi 1 11 12 23 35 58 151
Qi 0 1 1 2 3 5 13
30
The solution to equation is x = 5, y = −58 .
31
8. ARITHMETIC FUNCTIONS
32
Solution
13! = 1⋅2⋅3⋅4⋅5⋅6⋅7⋅8⋅9⋅10⋅11⋅12⋅13.
From this product write down the set of numbers that will be
multiples of 2. Denote this set by S2:
S2 = {2, 4, 6, 8, 10, 12};
The number of members of S2 (the cardinality S2 of S2) is 6.
This operation corresponds to the computation of the integer part of
13
the number = 6 .
2
From S2 write down the set of numbers that will be multiples of
22. Denote this set by S4:
13
S4 = {4, 8, 12}. The cardinality of S4 equals 2 = 3 .
2
From S4 write down the set of numbers that will be multiples of
23. Denote this set by S8:
13
S8 = {8}. The cardinality S8 is 3 = 1 .
2
From S8 write down the set of numbers that will be multiples of
4
2 . Denote this set by S16:
13
S16 = {∅}; S16 = 4 = 0 .
2
The total power of prime 2 in prime factorization of 13! is
6 + 3 + 1 = 10.
The integer 2 is the factor of 13!, and 211 does not divide it.
10
33
Example 8.3
The number of positive divisors of an integer n – τ (n ) , the sum
of positive divisors of an integer n – σ (n ) , the Euler’s totient
function – φ (n ) .
α α α
If the prime factorization of n > 1 is n = p1 1 ⋅ p2 2 ⋅ ... ⋅ pk k , then
the number of positive divisors (factors) of this number is
( 1 2 k
)
τ (n ) = τ p1α ⋅ p2 α ⋅ ...⋅ pk α = (α 1 + 1)(α 2 + 1) ⋅ ...⋅ (α k + 1) , (8.4.1)
( )
if n = p α , then τ (n ) = τ pα = (α + 1) ;
and the sum of positive divisors (factors) of this number is
( )
α +1 α +1 α +1
α1 α2 αk p 1 − 1 p2 2 − 1 p k −1
σ p1 ⋅ p2 ⋅ ...⋅ pk = 1 ⋅ ⋅ ... ⋅ k , (8.4.2)
p1 − 1 p2 − 1 pk − 1
p α +1 − 1
if n = p , then σ (n ) = σ p
α
( ) α
=
p −1
.
Example 8.4
Compute the number and the sum of factors for the integer 18.
Solution
The prime factorization of 18 is 18 = 2⋅32. The integer 18 has
positive divisors: 1, 2, 3, 6, 9, 18. The number of these divisors is 6,
τ (18 ) = 6 .
In the prime factorization of 18 the prime number 2 has power 1
and the prime number 3 has power 2. We can compute τ (18 ) using
formula (8.41):
τ (18) = τ ( 2 ⋅ 32 ) = (1 + 1)( 2 + 1) = 2 ⋅ 3 = 6 .
Both results coincide.
The sum of factors is σ (18 ) = 1 + 2 + 3 + 6 + 9 + 18 = 39 .
By formula (8.4.2), we get
34
σ (18 ) = σ (2 ⋅ 3 2 ) =
2 2 − 1 33 − 1
⋅ = 3⋅
(
(3 − 1) 3 2 + 3 + 1 = 3 ⋅ 13 = 39 1. )
2 −1 3 −1 (3 − 1)
Both results are correct.
Definition 8.1
The Euler’s totient function (phi-function) for an integer n
counts the number of positive integers less than n and relatively
prime to it.
Designation of the Euler’s totient function for an integer n is
φ (n ) .
Example 8.5
The integer 7 has six positive numbers less than 7 and relatively
prime to it: 1, 2, 3, 4, 5, 6. The integer 2 has one such number – 1.
The integer 6 has two such numbers – 1 and 5.
8.2. Computation of a value of Euler’s function
If the number p is prime, then
φ ( p) = p − 1 ; (8.7.1)
If n = p α , then
φ ( pα ) = pα − p α −1 = pα −1 ( p − 1) = p α 1 − ;
1
(8.7.2)
p
α α α
If n = p1 1 ⋅ p2 2 ⋅ ... ⋅ pk k , then
(
φ (n ) = φ p1α ⋅ p2 α ⋅ ...⋅ pk α = φ p1α φ p2 α ⋅ ... ⋅ φ pk α =
1 2 k
) ( )( ) ( ) 1 2 k
(
= p1 1 − p1
α α 1 −1
)(p 2
α2
− p2
α 2 −1
)⋅ ...⋅ (p − p ) =
k
αk
k
α k −1
= p1
α 1 −1
p2
α 2 −1
⋅ ...⋅ pk
α k −1
( p1 − 1)( p2 − 1) ⋅ ...⋅ ( pk − 1) =
1 1 1
= n 1 − 1 − ⋅ ...⋅ 1 − . (8.7.3)
p1 p2 pk
1
(a 2 k +1
) (
− 1 = (a − 1) a 2 k + a 2 k −1 + ... + a + 1 , k ≥ 1 )
35
Example 8.6
Compute phi-function for integers 13, 25, 10, 100, 1000.
Solutions
1) 13 is prime, therefore from formula (8.7.1)
φ (13) = 13 − 1 = 12 ;
2) 25 = 52 , then from formula (8.7.2)
( )
φ (25 ) = φ 5 2 = 5 2 − 5 = 5(5 − 1) = 20 ;
3) 10 = 2⋅5, then from formula (8.7.3)
φ (10 ) = φ (2 ⋅ 5 ) = φ (2 )φ (5 ) = (2 − 1)(5 − 1) = 4 , they are 1, 3, 7, 9;
4) 100 = 22⋅52, then from formula (8.7.3)
φ (100 ) = φ ( 22 ⋅ 52 ) = φ ( 22 ) φ ( 52 ) = ( 22 − 2 )( 52 − 5 ) =
= 2 ⋅ 5 ⋅ ( 2 − 1)( 5 − 1) = 10 ⋅ 4 = 40 ;
5) 1000 = 23⋅53, then from formula (8.7.3)
φ (1000 ) = φ ( 23 ⋅ 53 ) = φ ( 23 ) φ ( 53 ) = ( 23 − 22 )( 53 − 52 ) =
= 22 ⋅ 52 ⋅ ( 2 − 1)( 5 − 1) = 100 ⋅ 4 = 400 .
Definition 8.2
τ (1) , σ (1) , and φ (1) are defined to be 1.
Definition 8.3
We say that function f is multiplicative if
f ( m×n ) =f ( m ) ×f ( n ) for all relatively prime positive integers m,
and n, when f(1) = 1.
Theorem 8.1
Functions τ (n ) , σ (n ) , and φ (n ) are multiplicative.
36
PROBLEMS FOR UNIT 8
8.1
a. Find the exponents of the highest powers of primes a and
b, occurring in the prime factorization of an integer n!
a = 3, b = 5, a = 2, b = 13, a = 2, b = 11,
1. ! 6. 11.
N = 337! N = 271! N = 745!
a = 2, b = 7, a = 5, b = 13, a = 5, b = 11,
2. 7. 12.
N = 234! N = 234! N = 652!
a = 2, b = 11, a = 3, b = 5, a = 7, b = 11,
3. 8. 13.
N = 381! N = 931! N = 734!
a = 3, b = 11, a = 2, b = 7, a = 3, b = 7,
4. 9. 14.
N = 534! N = 491! N = 439!
a = 5, b = 7, a = 3, b = 11,
5. 10.
N = 625! N = 834!
b Calculate how many zeros the factorial of a number n!
ends with (the number of trailing zeros)
15. N = 356! 21. N = 534! 27. N = 399!
37
8.2
Compute τ (n ) , σ (n ) , and φ (n ) for an integer n. The prime
α α αk
factorization of n > 1 is n = p1 1 ⋅ p2 2 ⋅ ... ⋅ pk
1. a = 2 ⋅ 3 ⋅ 13 ⋅ 17 2. a = 3 ⋅ 5 ⋅ 11 ⋅ 13 3. a = 3 ⋅ 7 ⋅ 17 ⋅ 19
8 3 5 3 7 3
4. a = 5 ⋅ 7 ⋅ 19 5. a = 2 ⋅ 3 ⋅ 5 ⋅ 29 6. a = 2 ⋅ 3 ⋅ 5 ⋅ 17
4 2 9 7 2 6 5
7. a = 2 ⋅ 3 ⋅ 5 ⋅ 31 8. a = 3 ⋅ 7 ⋅ 37 ⋅ 41 9. a = 5 ⋅ 7 ⋅ 29
3 4 3 5 2 2 3
38
9. MODULAR ARITHMETIC
39
In number theory the devisor 7 is called modulus, and all
numbers of one class are called congruent modulo 7. We say that
141 is congruent to 15 modulo 7 because these numbers are in the
same class 7q + 1. We denote this fact as: 141 ≡ 15 ( mod 7 ) .
Numbers of different classes are not congruent modulo 7.
233 is not congruent to 25 modulo 7 because 233 belongs to the class
7q + 2 and 25 belongs to the class 7q + 4. We denote this fact as
233 ≡/ 25 ( mod 7 ) .
Generalizing the consideration, we can make a conclusion.
For every integer m called modulus, we can consider the set of
m remainders {0, 1, 2, …, ri, …, m-1}. Each remainder ri of this set
forms a corresponding number class. This class is denoted as
m×q+ri , q∈Z, ri < m. All numbers from the class m×q+ri are
congruent to each other modulo m. This fact is denoted as
∀a ,b ∈ mq + ri ⇒ a ≡ b(mod m ) . Another notation is a = b + mq .
Definition 9.1.1
The relationship a ≡ b ( mod m ) is called congruence modulo m.
Numbers from different classes are not congruent modulo m.
This fact is denoted as
∀a ∈ mq + ri & ∀b ∈ mt + r j , i ≠ j , a ≡/ b(mod m ) .
Definition 9.1.2
Each number of the class is called residue with respect to other
numbers from the same class.
Definition 9.1.3
A system that includes one residue from each class is called
a complete residue system modulo m. In particular, {0, 1, . . . ,
m−1} is the set of the least nonnegative residue modulo m.
For example, the set of numbers {7, 15, 142, 234, 144, 26, 13}
forms a complete residue system modulo 7, because the residue of
each classes belongs to it. The set of the least nonnegative residue
modulo 6 is the set {0, 1, 2, 3, 4, 5, 6}.
40
Each residue of the class m × q is congruent to 0 modulo m
mq ≡ 0(mod m ), ∀q ∈ Z . If we add/ subtract a residue of this class to
(from) any side of an arbitrary congruence modulo m, then the
congruence will not be altered.
For example, let us consider a congruence modulo 7. We have:
41 ≡ 6 (mod 7 ), 41 ≡ 6 − 7 (mod 7 ) ⇒ 41 ≡ −1(mod 7 ) .
Really, 41 = 7⋅5 + 6, 7⋅5∈7⋅q, then 7 ⋅ 5 ≡ 0(mod 7 ) and
41 ≡ 6 (mod 7 ) . On the other hand,
41 = 7⋅6 – 1, 7⋅6∈7⋅q, then 7 ⋅ 6 ≡ 0(mod 7 ) and 41 ≡ −1(mod 7 ) .
Thus, 6 ≡ 6 − 7 = −1(mod 7 ) .
This example shows that we can consider a negative residue as
well as a nonnegative one.
Lemma 9.1.1
For any a, b >0 and positive m, the following statement holds.
If a ≡ b(mod m ) , then a ≡ b − m(mod m ) and a − m ≡ b(mod m ) .
Let us consider the complete system of the least nonnegative
residue modulo m. This system can be separated into two subsystems
as specified out below.
m−1
1. First, if m is odd, then the residues 0, 1, 2, …, will
2
m −1 m −1
remain the same, and from the residues + 1, + 2 …,
2 2
m − 1 we will subtract modulo m. As a result, we will obtain the
m −1
system of the residues {0, ± 1, ± 2, ..., ± }.
2
m
2. Secondly, if m is even, then the residues 0, 1, 2, …, will
2
m m −1
not be altered, and from the residues + 1, + 2 …, m − 1 we
2 2
41
will subtract modulus m. Thus, we will obtain the system of residues
m m
{− + 1,..., − 2, − 1, 0,1, 2,..., } .
2 2
Definition 9.1.4
The complete system of the least nonnegative residues modulo m
can be split into two subsystems. There are m residues in both
subsystems. Each subsystem is called the least absolute residue
system modulo m.
Example 9.1.1
Construct the least absolute residue system: 1) modulo 7;
2) modulo 8.
Solution
1) The least nonnegative residues modulo 7 are {0,1, 2,3, 4,5,6} .
7 −1
= 3 , so the least absolute residue system modulo 7 is
2
{0,1, 2,3, 4 − 7,5 − 7,6 − 7} =(0, ±1, ±2, ±3} or {−3, −2, −1,0,1, 2,3} ;
2) The least nonnegative residues modulo 8 are {0,1, 2,3, 4,5,6,7} .
8
= 4 , so the least absolute residue system modulo 8 is
2
{0,1, 2,3, 4,5 − 8,6 − 8,7 − 8} = {−3, −2, −1,0,1, 2,3, 4} .
42
2. Symmetry property a ≡ b ( mod m ) ⇒ b ≡ a ( mod m )
This property signifies that both numbers have the same
remainder in division by m.
For example: 24 ≡ 38 ( mod 7 ) ⇒ 38 ≡ 24 ( mod 7 ) . Indeed,
24 = 3 ⋅ 7 + 3 and 38 = 5 ⋅ 7 + 3 . So, both numbers have the same
remainder 3 in division by 7.
3. Transitivity property
If a ≡ b(mod m) and b ≡ c ( mod m ) , then a ≡ c(mod m ) .
For transitivity, assume that a leaves the same remainder as b on
division by m, and that b leaves the same remainder as c. The all
three leave the same remainder as each other, and in particular a
leaves the same remainder as c.
For example: 24 ≡ 38 ( mod 7 ) , 38 ≡ 150 ( mod 7 ) ⇒ 24 ≡ 150 ( mod 7 ) .
The all three have the same remainder of 3 on division by 7.
Actually, 24 = 3 ⋅ 7 + 3, 38 = 5 ⋅ 7 + 3, 150 = 21 ⋅ 7 + 3 .
Theorem 9.1.2
For any a, b∈Z and positive m>1, m∈Z, a ≡ b(mod m) iff
m | (a − b ) .
Proof
Clearly if m | (a − b ) , then
a − b = mq ⇒ a = b + mq ⇒ a ≡ b(mod m ) .
On the other hand,
a ≡ b(mod m) ⇒ a = b + mt ⇒ a − b = mt ⇒ m | (a − b ) .
So, the difference of any two numbers from the same class
belongs to class 0,
a − b ≡ 0(mod m ) .
Theorem 9.1.3
If a ≡ b(mod m) and c ≡ d (mod m) , then
43
1) a + c ≡ b + d (mod m) and a − c ≡ b − d (mod m) – algebraic
addition.
Consequence: a + c ≡ b(mod m) ⇒ a ≡ b − c(mod m) ;
2) ac ≡ bd (mod m ) – multiplication;
3) a n ≡ b n (mod m) for all n ≥ 1 – powering;
4) ∀k ∈ Z ka ≡ kb(mod m ) – multiplication by number;
5) ∀a, b, a1 , b1 , k ∈ Z , gcd ( m, k ) = 1,
a = k ⋅ a1 , b = k ⋅ b1 : a ≡ b ( mod m ) ⇒ a1 ≡ b1 ( mod m ) ;
6) If ai ≡ bi (mod m ), i = 1,n and x ≡ y (mod m ), then
n n
integer coefficients.
Proof
1) a ≡ b(mod m) implies that a = m ⋅ t + b , t ∈ Z ; c ≡ d (mod m)
means that c = m ⋅ q + d , q ∈ Z .
The addition of both equations produces
a + c = m ⋅ t + b + m ⋅ q + d = m ⋅ (t + q ) + b + d ;
t + q = s ∈ Z ; m ⋅ s ≡ 0(mod m ) ⇒ a + c ≡ b + d (mod m ) .
Similarly, if we add two congruences such that a + c ≡ b(mod m ) ,
and − c ≡ −c(mod m ) , then we will get
a ≡ b − c(mod m ) .
2) a ≡ b(mod m) means that a = m ⋅ t + b , t ∈ Z ; c ≡ d (mod m)
signifies that c = m ⋅ q + d , q ∈ Z . Product of both equations yields
a ⋅ c = ( mt + b )( mq + d ) = mtmq + mtd + bmq + bd =
= m ( mtq + td + bq ) + bd ;
mtq + td + bq = s ∈ Z; ms ≡ 0(modm ) ⇒ ac ≡ bd (mod m ) .
3) a n ≡ b n (mod m) is got by successive multiplication of
congruences by themselves. Hence, property (3) is indeed true.
44
4) a ≡ b(mod m) ⇔ a = b + mq , we multiply the last expression
by k:
ka = kb + mkq, kq = q1 ∈ Z ⇒ ka = kb + mq1 ⇒ ka ≡ kb(mod m) .
5) a = k ⋅ a1 , b = k ⋅ b1 : a ≡ b ( mod m ) ⇒
⇒ ka1 ≡ kb1 ( mod m ) or ka1 = kb1 + mq . According to Integration
property in Theorem 1.2, we can write k | mq . Since gcd (m ,k ) = 1 , it
follows that k | q , q = kq1 . So, we have ka1 = kb1 + mkq1 . Finally, by
dividing the last expression by k, we will get
a1 = b1 + mq1 ⇒ a1 ≡ b1 (mod m ) .
6) Let us consider a congruence
n
a n x n + a n−1 x n−1 + ... + a1 x + a0 = ∑ a n−i x n−i ≡ 0 (mod m ) .
i =0
( ).
n
= ∑ bn −i y n −i + Сn-i1 y n −i −1mt + ... + Сn-i n-i-1 y ( mt ) + ( mt )
n − i −1 n −i
i =0
By denoting
q = С n-i y n−i −1t + ... + С n-i ym n−i −2 t n−i −1 + m n−i −1t n−i ∈ Z , we have
1 n -i -1
∑ bn−i ( y + mt )
n −i
i =0 i =0 i =0 i =0
45
n n
= ∑ bn−i y n−i + m∑ bn−i q .
i =0 i =0
n
By introducing q1 = ∑ bn−i q ∈ Z , we get
i =0
n n n n
n n
As a result, we deduce ∑ an−i x n−i ≡ ∑ bn−i y n−i (mod m ) .
i =0 i =0
Examples 9.1.2
Take two congruences 3 ≡ 52(mod 7 ) and 5 ≡ 40(mod 7 ) .
1) The sum of 3 ≡ 52(mod 7 ) and 5 ≡ 40(mod 7 ) is 8 ≡ 92(mod 7 ) .
The obtained congruence is true because 8 ≡ 1(mod 7 ) and
92 ≡ 1(mod 7 ) . The difference between them is − 2 ≡ 12(mod 7 ) .
Such congruence is correct, because − 2 ≡ 5(mod 7 ) and
12 ≡ 5(mod 7 ) .
2) The product of given congruences is 15 ≡ 2080(mod 7 ) . One can
see that 15 ≡ 1(mod 7 ) and 2080 = 7 ⋅ 297 + 1 ⇒ 2080 ≡ 1(mod 7 ) .
Hence, this congruence is correct.
3) Raise the first congruence to the second power:
( 3 ≡ 52 ( mod 7 ) ) ⇒ 32 ≡ 522 ( mod 7 ) ⇒ 9 ≡ 2704 ( mod 7 ) ;
2
46
and 520 leave the same remainder 2 when divided by 7; hence
3 ⋅10 ≡ 52 ⋅10 ( mod 7 ) is true.
5) Take the congruence 5 ≡ 40(mod 7 ) . Both integers of this
congruence are divided by 5. The greatest common divisor of 5 and 7
is 1. Divide the congruence by 5: 5/5=1; 40/5=8. The congruence
1 ≡ 8(mod 7 ) is correct.
6) Find the remainder of the division 1348 26 by 13 without
calculator.
Solution
To solve this problem means to find the least positive residue of
the residue class modulo 13 with the representative 1348 26
1348 = 13 ⋅ 103 + 9 ⇒ 1348 ≡ 9(mod 13 ); 9 < 13; gcd (9 ,13) = 1 . The
integer 9 is the least positive residue for the integer 1348 modulo 13.
Then using property (6), we can write 1348 26 ≡ 9 26 (mod 13) .
Similarly, we will reduce the integer 9 26 taking into account
property (6).
( )
9 24 = 9 2
13
= 8113 = (13 ⋅ 6 + 3) ≡ 313 (mod 13) ;
13
47
For example, we have
48
(gcd(a,m)=1), then
a ϕ(m ) ≡ 1(mod m ) .
≡1( mod13)
50
By introducing new variable x = 3y , we obtain that
348 ≡ 3 y (mod 21) .
128
51
1. 143 50 ≡ x1 (mod 17 ) .
Th 9.3.1
gcd (143,17 ) = 1; 17 is prime ⇒ 14316 ≡ 1( mod17 ) ,
( )
50 = 16 ⋅ 3 + 2 ⇒ 143 50 = 14316 ⋅ 143 2 ≡ 143 2 (mod 17 ) ,
3
≡1( mod 17 )
52
PROBLEMS FOR UNIT 9
9.1. Find the remainder from the division
1. 2. 3. 4.
6617 by 7 2100+3100 by 5 11802 by 1000 172001 by 1000
5. 6. 7. 8.
192402 by 100 17852 by 11 19671968 by 11 383175 by 45
29. 30.
11203 by 100 7332 by 100
53
10. LINEAR CONGRUENCES WITH ONE UNKNOWN
54
If d | a, d | m ⇒ d | b , then the congruence’s terms can be
written as follows:
a = a1d , b = b1d , m = m1d , (a1 , m1 ) = (b1 , m1 ) = 1 .
Hence, according to a property of congruences, such congruence
can be divided by d . Finally, we get
a1 x ≡ b1 (mod m1 ) .
From the above, it has a unique solution x ≡ x1 (mod m1 ) or
x = m1t + x1 . On the other hand, if we consider the complete system
of incongruent residues to modulus m = dm1 , then we will be able to
see that there will be solutions in the interval [0, m] as follows:
x1 , x1 + m1 , x1 + 2m1 ,..., x1 + (d − 1)m1 .
Here, the total number of solutions is d . The solutions are
incongruent modulo m and, consequently, each of them forms their
own class of residues.
Conclusion
In the case condition (a, m ) = d > 1 holds, then the congruence
will possess at least one solution if d | b . There will be exactly d
solutions ( d classes of solutions). The first of them could be
obtained from the given congruence divided by d , the rest are
calculated as follows:
x2 = x1 + m1 ,..., xd = x1 + (d − 1)m1 .
A linear congruence can be solved by several methods.
55
of congruence, we can simplify it. Here, both 25 and 15 have
common multiplier 5 that is coprime to modulo 17. Hence, by
applying the properties of congruence, we can divide equation by 5:
3x ≡ 5(mod 17 ) . The number 5 corresponds to the least absolute
residue – 12, which is multiple of 3. Finely, we cancel off equation
3x ≡ −12(mod 17 ) by 3, this yields: x ≡ − 4 ( mod17 ) . Thus, the
congruence has a unique solution from the least absolute residue
system modulo 17 or from the least nonnegative residue system
modulo 17: x = −4 + 17 = 13 .
b) Solve the congruence 10 x ≡ 35 ( mod 55) .
Solution
We get (10,55) = 5 > 1, 5 | 35 .
Hence, the congruence has just five solutions.
Then cancellation by d = 5 produces
2 x ≡ 7 ( mod11) .
Taking into account ( 2,11) = 1 , we can make a conclusion that
such congruence possesses a unique solution
2 x ≡ 7 + 11( mod11) ⇒ 2 x ≡ 18 ( mod11) ⇒ x ≡ 9 ( mod11) .
In the same way, the given congruence 10 x ≡ 35 ( mod 55) will
have five solutions of the obtained above form as follows:
x0 ≡ 9 ( mod 55 ) , x1 ≡ 9 + 11⋅1 = 18 ( mod 55 ) ,
x2 ≡ 9 + 11⋅ 2 = 31( mod 55 ) ,
x3 ≡ 9 + 11⋅ 3 = 42 ( mod 55) , x4 ≡ 9 + 11⋅ 4 = 53 ( mod 55 ) .
If we again add extra modulus 11, then we will get
x5 ≡ 9 + 5 ⋅11 = 64 ≡ 9 ( mod 55 ) .
Thus solutions x0 , x1 , x 2 , x3 , x4 are incongruent modulo 55 and
x5 ≡ x0 ( mod 55) .
56
Finely, we have obtained five incongruent classes that are
solutions of given congruence. In a general form, solution may be
written as follows:
x ≡ 9 + 11t ( mod 55 ) , t = [ 0,..., d − 1] = [ 0,..., 4] .
c) Solve the congruence 10 x ≡ 33 ( mod 55 ) .
Solution
We obtain that (10,55 ) = 5 > 1, but 33 is not multiple of 5, thus
the congruence has no solutions.
57
Thus the solution of the congruence will be
x ≡ (− 1) Pn−1b(mod m ) .
n
Example
Solve the congruence 256 x ≡ 179(mod 337 ) .
Solution
We have
(256,337 ) = 1 .
Therefore, the congruence possesses a unique solution. Let us
337
expand fraction into continued one as follows:
256
337 81 256 13
= 1+ , q1 = 1; = 3 + , q2 = 3;
256 256 81 81
81 3 13 1
= 6 + , q3 = 6; = 4 + , q4 = 4;
13 13 3 3
3
= 3, q5 = 3 .
1
Form the table.
і 0 1 2 3 4 5
qi 1 3 6 4 3
Pi 1 1 4 25 104 337
Qi 0 1 3 19 79 256
58
10.2. MULTIPLICATIVE INVERSE
Definition 10.2.1
If a′ is a solution of the congruence ax ≡ 1(mod m ) , then a′ is
called a (multiplicative) inverse of a modulo m , and we say that
a is invertible modulo m . We shall denote a′ = a −1 .
Since we know methods of solutions of linear congruences
involving one unknown, we may find an answer to the question:
Does there exist any element from the complete residue system
modulo m having multiplicative inverse?
First, let us consider the congruence
ax ≡ 1(mod m ) .
As the right side of the congruence equals 1 then, according to a
condition of the solution’s existence, we deduce (a, m ) = 1 . If values
of a were elements from the least nonnegative system modulo m –
such system is the base for all class of numbers – then, obviously, the
congruence could be nonsolvable. For example, m = 15, a = 5 .
Hence, from the system under consideration it is necessary to throw
away all multiples of modulus. So, we will get the reduced residue
system containing ϕ(m ) elements. Finally, for any element from the
reduced residue system modulo m the inverse of a will be a
solution of the congruence ax ≡ 1(mod m ) :
x ≡ a ϕ(m )−1 (mod m ) .
Therefore, if the modulus m is composite, then the inverse
element exists just for the reduced residue system modulo m. Thus,
for an arbitrary a from mentioned above class the inverse is defined
by formula as follows:
a −1 ≡ a ϕ(m )−1 (mod m ) .
However, if the modulus is a prime number p then the reduced
residue system modulo p will coincide with the complete residue
59
system.
We have come to a conclusion that for any element from the
complete residue system modulo p the inverse exists and is a
unique:
a −1 ≡ a p −2 (mod p ) .
Using continued fractions, it will be easy to find the inverse as
follows:
a −1 = (− 1) Pn −1 .
n −1
Example
Obtain the multiplicative inverse for number a = 131 modulo
m = 437 .
Solution
a 437
Let us consider the fraction = . We are going to expand
m 131
the fraction via chain of partial quotients. This produces
437 44 131 43 44 1
=3 , q1 = 3; = 2 , q2 = 2; = 1 , q3 = 1;
131 131 44 44 43 43
43
= 43, q4 = 43 .
1
437
Thus = [3, 2,1, 43] .
131
Then we build a table of convergents.
і 0 1 2 3 4
qi 3 2 1 43
Pi 1 3 7 10 437 m
Qi 0 1 2 3 131 a
Using their properties, one can write the following:
P4 ⋅ Q3 − P3 ⋅ Q4 = (− 1) or 437 ⋅ 3 − 10 ⋅131 = 1 .
4
≡0 ( mod 437 )
60
( −10 ) ⋅131 ≡ 1( mod 437 ) .
Finely, we have 131−1 ≡ −10(mod 437 ) or
131 ≡ 427(mod 437 ) .
−1
Answer
The multiplicative inverse of a = 131 modulo m = 437 equals
a = −10 (in the absolute least residue system) and corresponds to
−1
Definition 10.3.1
A solution of the system of congruences with one unknown is
an integer α that satisfies all congruences simultaneously.
First, we simplify this system. Since (ai , mi ) = 1, i = 1, k , then
there exists the inverse ai −1 for ai such that
ai : ai ⋅ ai ≡ 1(mod mi ) . Further, multiplying every system’s
−1 −1
i =1
Here all terms, starting from the second one, are divided by m1 ,
since m1 is a factor of M i , i = 2 ,k . Therefore, all of them are
62
congruent to 0 modulo m1 . As stated above, M 1M 1 ≡ 1(mod m1 )
−1
63
This yields the reduced system as follows:
x ≡ 8 ( mod13) ,
x ≡ 2 ( mod 5 ) ,
x ≡ 1( mod 3) .
According to the Chinese remainder theorem, a solution to such
system exists, and it is a unique.
STEP 2. Let us consider the first congruence x ≡ 8 ( mod13) . We
can rewrite it via such equality:
x = 8 + 13t1 . (*)
Since x is a solution for every congruences, we substitute it into
the second congruence and deduce value for unknown t1 :
8 + 13t1 = 2 ( mod 5 ) ⇒ 13t1 ≡ −6 ( mod 5 ) ⇒
⇒ 3t1 ≡ −6 + 5 ⋅ 3 ( mod 5 ) ⇒ 3t1 ≡ 9 ( mod 5) .
Taking into account that ( 3,5 ) = 1 , we divide both parts of the
congruence by 3:
t1 ≡ 3 ( mod 5 ) , this yields t1 = 3 + 5t 2 .
Then we substitute t1 into formula (*); this produces
x = 8 + 13(3 + 5t 2 ) = 8 + 39 + 13 ⋅ 5t 2 = 47 + 13 ⋅ 5t 2 ,
x ≡ 47 ( mod13 ⋅ 5) .
We get
x = 47 + 13 ⋅ 5t 2 . (**)
STEP 3. Further, we substitute the obtained above expression for
x into the third congruence:
47 + 13 ⋅ 5t2 ≡ 1( mod 3) ⇒ 65t2 ≡ −46 ( mod 3) ⇒
⇒ −t2 ≡ −1( mod 3) ⇒ t2 ≡ 1( mod 3) ⇒ t2 = 1 + 3t3 .
If we replace t 2 by its expression in (**), we obtain
64
x = 47 + 13 ⋅ 5(1 + 3t 3 ) = 47 + 65 + 13 ⋅ 5 ⋅ 3t 3 = 112 + 13 ⋅ 5 ⋅ 3t 3 .
Thus we have
x ≡ 112 ( mod13 ⋅ 5 ⋅ 3) or x ≡ 112 ( mod195 ) .
Answer
x ≡ 112 ( mod195 ) .
Solution check
2 ⋅112 = 224 = 13 ⋅17 + 3 ⇒ 2 ⋅112 ≡ 3 ( mod13) ,
4 ⋅112 = 448 ≡ 3 ( mod 5) ,
112 = 3 ⋅ 37 + 1 ⇒ 112 ≡ 1( mod 3) .
Solution is correct.
Remark
1. If in the system (1) there is a congruence ai x ≡ bi (mod mi )
possessing properties (ai , mi ) = d > 1, d | bi , then, by dividing it by
ai b m
d , we get an expression x ≡ i mod i and, further, we will
d d d
substitute the obtained congruence into the system.
If in the new deduced system moduli are still pairwise coprimes,
then, according to the Chinese remainder theorem, such system
possesses a unique solution. But in this case an i -th congruence has
just d solutions: x ≡ ci + t j i (mod mi ), t j = 0, (d − 1) . Therefore, it
m
d
is necessary to consider d systems, having an appropriate solution of
congruence in the system’s i-th position.
2. A system of two equations
x ≡ c1 ( mod m1 ) ,
x ≡ c2 ( mod m2 )
is solvable iff two conditions hold (m1 , m2 ) = d > 1 and d | c2 − c1 .
Otherwise, the system has no solutions. In the case conditions are
65
met and a solution exists, then it will be found by modulo gcd of m1
and m2 .
3. If a system contains more than two congruences ( k > 2 ) with
modules having gcd greater than 1, then we must check its solution
step-by-step. When at least one of obtained congruences is
nonsolvable, then such system is inconsistent at all. If the solution
exists, then it will be congruent modulo gcd of all moduli.
1. 2. 3. 4. 5. 6.
a = 142, a = 137, a = 95, a = 37, a = 37, a = 113,
m = 439 m = 932 m = 308 m = 107 m = 217 m = 311
7. 8. 9. 10. 11. 12.
a = 221, a = 41, a = 31, a = 93, a = 23, a = 137,
m = 367 m = 101 m = 142 m = 133 m = 691 m = 323
13. 14. 15. 16. 17. 18.
a = 97, a = 101, a = 103, a = 91, a = 137, a = 59,
m = 323 m = 931 m = 1031 m = 323 m = 837 m = 311
19. 20. 21. 22. 23. 24.
a = 97, a = 113, a = 89, a = 47, a = 67, a = 64,
m = 433 m = 923 m = 323 m = 311 m = 691 m = 531
25. 26. 27. 28. 29. 30.
a = 64, a = 71, a = 83, a = 93, a = 128, a = 29,
m = 743 m = 531 m = 323 m = 531 m = 1025 m = 531
66
Problem 2
Solve the system of congruences, simplifying it first.
913 x ≡ 132(mod 17 ),
1. 138 x ≡ 245(mod 19 ),
457 x ≡ 623(mod 13).
913 x ≡ 132(mod 23),
2. 138 x ≡ 245(mod 11),
457 x ≡ 623(mod 17 ).
913 x ≡ 132(mod 29 ),
3. 138 x ≡ 245(mod 17 ),
457 x ≡ 623(mod 23).
253 x ≡ 429(mod 17 ),
4. 338 x ≡ 545(mod 19 ),
579 x ≡ 741(mod 13).
253 x ≡ 429(mod 31),
5. 338 x ≡ 545(mod 23),
579 x ≡ 741(mod 19 ).
253 x ≡ 429(mod 37 ),
6. 338 x ≡ 545(mod 29 ),
579 x ≡ 741(mod 23).
353 x ≡ 529(mod 17 ),
7. 138 x ≡ 945(mod 19 ),
279 x ≡ 241(mod 13).
67
353 x ≡ 529(mod 31),
8. 137 x ≡ 945(mod 23),
279 x ≡ 241(mod 17 ).
353 x ≡ 529(mod 37 ),
9. 137 x ≡ 945(mod 17 ) ,
279 x ≡ 241(mod 23 ).
347 x ≡ 519(mod 17 ),
10. 438 x ≡ 345(mod 29 ),
271x ≡ 541(mod 37 ).
347 x ≡ 519(mod 31),
11. 438 x ≡ 327 (mod 23),
271x ≡ 541(mod 19 ).
347 x ≡ 519(mod 37 ),
12. 438 x ≡ 327 (mod 17 ),
271x ≡ 541(mod 23).
547 x ≡ 219(mod 17 ),
13. 639 x ≡ 175(mod 29 ),
371x ≡ 341(mod 37 ).
547 x ≡ 219(mod 31),
14. 638 x ≡ 145(mod 23),
371x ≡ 341(mod 19 ).
547 x ≡ 219(mod 37 ),
15. 638 x ≡ 145(mod 17 ),
371x ≡ 341(mod 23).
68
747 x ≡ 319(mod 17 ),
16. 838 x ≡ 195(mod 29 ),
571x ≡ 241(mod 37 ).
747 x ≡ 319(mod 31),
17. 838 x ≡ 195(mod 23),
571x ≡ 241(mod 19 ).
747 x ≡ 319(mod 37 ),
18. 838 x ≡ 195(mod 17 ),
571x ≡ 241(mod 23 ).
437 x ≡ 719(mod 17 ),
19. 925 x ≡ 395(mod 29 ),
771x ≡ 225(mod 37 ).
437 x ≡ 719(mod 31),
20. 925 x ≡ 395(mod 23),
771x ≡ 225(mod 41).
437 x ≡ 719(mod 37 ),
21. 925 x ≡ 395(mod 17 ),
771x ≡ 225(mod 23).
333 x ≡ 579(mod 17 ),
22. 1025 x ≡ 495(mod 29 ),
797 x ≡ 245(mod 37 ).
333 x ≡ 579(mod 31),
23. 1025 x ≡ 495(mod 23),
797 x ≡ 245(mod 41).
69
337 x ≡ 525(mod 37 ),
24. 1025 x ≡ 495(mod 17 ),
797 x ≡ 245(mod 23).
733 x ≡ 571(mod 17 ),
25. 625 x ≡ 405(mod 29 ),
707 x ≡ 295(mod 37 ).
733 x ≡ 571(mod 31),
26. 625 x ≡ 405(mod 23),
707 x ≡ 295(mod 19 ).
733 x ≡ 571(mod 37 ),
27. 625 x ≡ 405(mod 17 ),
707 x ≡ 295(mod 23).
398 x ≡ 171(mod 17 ),
28. 925 x ≡ 605(mod 29 ),
507 x ≡ 395(mod 37 ).
398 x ≡ 171(mod 31),
29. 925 x ≡ 605(mod 19 ),
507 x ≡ 395(mod 11).
398 x ≡ 171(mod 11),
30. 925 x ≡ 605(mod 13),
507 x ≡ 395(mod 41).
70
REFERENCES
1. Clark W. Edwin. Elementary Number Themory / W. Edwin
Clark. – University of South Florida, 2002. – Dec.
2. Stein W. Elementary Number Theory / W. Stein. – Harvard
University, 2004 – Sept.
3. Sato Naoki. Number Theory – Naoki Sato [Електронний
ресурс]. – Режим доступу : [email protected].
4. Collins Darren C. Сontinued Fraction / Darren C. Collins //
MIT Undegraduate Journal of Mathematics.
71
Навчальне видання
(Англомовний курс)
Видавець і виготовлювач
Сумський державний університет,
вул. Римського-Корсакова, 2, м. Суми, 40007
Свідоцтво суб’єкта видавничої справи ДК № 3062 від 17.12.2007.