0% found this document useful (0 votes)
532 views73 pages

Number Theory

The document contains lecture notes on elementary number theory for students studying informatics and applied mathematics. It covers topics such as divisibility, prime numbers, greatest common divisors, modular arithmetic, and linear congruences. The notes are approved by the Department of Applied and Computational Mathematics at Sumy State University in Ukraine for the course "Elementary Number Theory".

Uploaded by

Pawan Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
532 views73 pages

Number Theory

The document contains lecture notes on elementary number theory for students studying informatics and applied mathematics. It covers topics such as divisibility, prime numbers, greatest common divisors, modular arithmetic, and linear congruences. The notes are approved by the Department of Applied and Computational Mathematics at Sumy State University in Ukraine for the course "Elementary Number Theory".

Uploaded by

Pawan Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 73

MINISTRY OF EDUCATION AND SCIENCE OF UKRAINE

SUMY STATE UNIVERSITY

"ELEMENTARY NUMBER THEORY"


lecture notes with tests
for students of specialties
"Informatics" and "Applied Mathematics"

Sumy
Sumy State University
2016
MINISTRY OF EDUCATION AND SCIENCE OF UKRAINE
SUMY STATE UNIVERSITY

"ELEMENTARY NUMBER THEORY"


lecture notes with tests
for students of specialties
"Informatics" and "Applied Mathematics"

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.

Department of Applied and Computational Mathematics


CONTENT
P.
1. DIVISIBILITY....................................................................................... 4
Problems for Unit 1 ............................................................................. 8
2. PRIME NUMBERS................................................................................ 9
3. DIVISION ............................................................................................. 10
Problems for Unit 3 ........................................................................... 15
4. GREATEST COMMON DIVISOR (GCD) ....................................... 16
5. THE EUCLIDEAN ALGORITHM .................................................... 18
6. LOWEST (LEAST) COMMON MULTIPLE (LCM) ...................... 21
Problems for Unit 6 ........................................................................... 22
7. CONTINUED FRACTIONS ............................................................... 24
Problems for Unit 7 ........................................................................... 31
8. ARITHMETIC FUNCTIONS ............................................................. 32
Problems for Unit 8 ........................................................................... 37
9. MODULAR ARITHMETIC................................................................ 39
9.1. CLASSES OF CONGRUENCE .............................................................. 39
9.2. PROPERTIES OF CONGRUENCES THAT CHANGE MODULUS ............ 47
9.3. FERMAT'S LITTLE THEOREM AND EULER'S THEOREM ON THE
EXISTENCE OF THE UNIT ELEMENT MODULO m .................................. 48
Problems for Unit 9 ........................................................................... 53
10. LINEAR CONGRUENCES WITH ONE UNKNOWN .................. 54
10.1. CONGRUENCES OF THE FIRST ORDER. SOLVING CONGRUENCES .. 54
10.1.1. Application of Congruence’s Properties................................ 55
10.1.2. Application of Convergents.................................................... 57
10.2. MULTIPLICATIVE INVERSE ............................................................ 59
10.3. SYSTEM OF LINEAR CONGRUENCES WITH ONE UNKNOWN .......... 61
Problems for Unit 10 ......................................................................... 66
REFERENCES ......................................................................................... 71

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

By combining the first and last terms of expression, we obtain


( )
the number N as a summand: 10 N 1 = a0 10 5 − 1 + N = 99999 a0 + N .
Further, taking into account that

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!

And finally, for the second case, we obtain


7
( m − 1) m ( m + 1) = ( m − 1) m ( m + 1) ∈ Z ⇒
3! 6
⇒ 6| ( m − 1) m ( m + 1) ⇒ 30 | 5 ( m − 1) m ( m + 1) .
This completes the proof.

PROBLEMS FOR UNIT 1


Problem 1.1
Find all positive integers d such that d divides both n2 + 1 and
(n + 1)2 + 1 for some integer n.
Problem 1.2
N is a six-digit number. N = a5 a4 a3 a2 a1 a0 , 0 ≤ ai ≤ 9 , a0 = 5 . If
we rearrange last digit a0=5 to the first place, we will get N 1 = 4 N .
Find this number N.
Problem 1.3
Prove that
1. 6 | n(n + 1)(2n + 1) .
(
2. 30 | mn m 4 − n 4 . )
Problem 1.4
Prove that
2 n | (n + 1)(n + 2 ) ⋅ ...⋅ (n + n )
Problem 1.5
Prove that the last digit of number N = 2 2 + 1 is 7.
n

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

N = an ... a8 a7 a6 a5 a4 a3 a2 a1a0 , N 2 = a2 a1a0 − a5 a4 a3 + a8 a7 a6 − ...


+ − +

If N2 is divisible by 7, then N is divisible by 7 too.


Example 3.2
Check if the number N=23 161 320 is divisible by 7.
Solution
N2=320 – 161 + 23 = 182. 182:7=26. So, N=23 161 320 is
divided by 7. We have 23 161 320:7 = 3 308 760.
5. Criteria for divisibility of N by 11
N = 10 n an + 10 n−1 an−1 + ... + 10 3 a3 + 10 2 a2 + 10 a1 + a0 .
Consider the remainders of the division of ten’s powers by 11.
10: 10=0⋅11+10 = 1⋅11 – 1, the remainder is 10 or -1
102: 100=9⋅11+1, the remainder is 1
103: 1000=90⋅11+10=91⋅11 - 1, the remainder is 10 or -1
104: 10000=901⋅11+1, the remainder is 1
N = an ...a5 a4 a3 a2 a1 a0 , N 2 = a0 − a1 + a2 − a3 + ...
+ − + − +

If N2 is divisible by 11, then N will be divisible by 11 too.


Example 3.3
Check if the numbers N=23 161 320 and N=1 186 680 are
divisible by 11.

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, we see 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.
8. Criteria for divisibility of N by d = 10k – 1 (19, 29, 59,…)
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.

PROBLEMS FOR UNIT 3


3.1. Check that a is divisible by m
m=35 m=39 m=55
1. a=351645 6. a =437931 11. a =747615
2. a=236215 7. a =294177 12. a =502205
3. a =590835 8. a =735813 13. a =1256145
4. a =236810 9. a =294918 14. a =503470
5. a =564655 10. a =703209 15. a =1200485
m=31 m=91 m=29
16. a =238173 21. a =1559649 26. a =394197
17. a =159991 22. a =1047683 27. a =264799
18. a =400179 23. a =2620527 28. a =662331
19. a =160394 24. a =1050322 29. a =265466
20. a =382447 25. a =2504411 30. a =632983

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.

5. THE EUCLIDEAN ALGORITHM


We can efficiently compute the greatest common divisor of two
numbers.
First we simplify the problem. Since gcd(a, b) = gcd(|a|, |b|)
(and gcd(0, 0) = 0), we just need to obtain a method for computing
the gcd(a, b) of nonnegative a and b. And, since gcd(a, b) =
= gcd(b, a), we will consider the case a > b > 0.
Lemma 5.1
If a > 0, then gcd(a, 0) = a.
Lemma 5.2
If a > 0, then gcd(a, a) = a.
Lemma 5.3
Let a > b > 0. If a = bq + r, then gcd(a, b) = gcd(b, r).
Proof.
If we show that the two sets of common divisors C(a, b) and
C(b, r) are equal, then this will suffice to prove the whole lemma,
because there will be the same greatest element in both sets. Recall,
the sets are equal iff they possess the same elements. Let us prove the
last statement.
First, suppose that there exist d ∈ C(a, b) such that d | a and d | b.
Let us note that r = a – bq.⋅Therefore, according to Theorem 1.1(10),
we make a conclusion that d | r. Thus, d | b and d | r, and so d belongs
to C(b, r).
We have shown that any element of C(a, b) is an element of
C(b, r), so it implies

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 )

PROBLEMS FOR UNIT 6


6.1. Compute gcd ( a,b ) with Euclidean algorithm and lcm ( a,b )
with Lemma 6.1

1. a = 1232, 2. a = 1 329, 3. a = 1 359,


b = 1672 b = 2 136 b = 8 211
4. a = 5 427, 5. a = 5 894, 6. a =12 606,
b = 32 877 b = 3 437 b = 6494
7. a =29 719, 8. a =162 891, 9. a =469 459,
b = 76 501 b = 32 176 b = 579 203
10. a =738 089, 11. a =179 370 199, 12. a =3 327 449,
b = 3 082 607 b = 4 345 121 b = 6 314 153
13. a =12 870, 14. a =41 382, 15. a =3 640,
b = 7 650 b = 103 818 b = 14 300
16. a =24 700, 17. a =7 650, 18. a =56 595,
b = 33 250 b = 25 245 b = 82 467
19. a =35 574, 20. a =25 245, 21. a =10 140,
b = 192 423 b = 129 591 b = 92 274
22. a =36 372, 23. a =46 550, 24. a =1 403,
b = 147 220 b = 37 730 b = 1 058
25. a =213 239, 26. a =138 285, 27. a =72 348,
b = 512 525 b = 356 405 b = 5 632
28. a =354 295, 29. a =24 789, 30. a =32 893,
b = 543 440 b = 35 286 b = 72 568

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

1. If n is even, then aQn−1 − bPn−1 = 1, a ⋅ Qn−1 + b ⋅ ( − Pn−1 ) = 1 .


We have got a solution to the Diophantine equation:
x = Qn−1 , y = − Pn−1 .
2. If n is odd, then aQn−1 − bPn−1 = −1, or − a ⋅ Qn−1 + b ⋅ Pn−1 = 1 .
Therefore, we have obtained a solution to the Diophantine
equation: x = −Qn−1 , y = Pn−1 .

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

Verify property 7.1


151
Number ≈ 11.615 is between δ1 = 11 and δ 2 = 12 closer to
13
δ 2 = 12 , because 11.615 − 11 = 0.615 > 11.615 − 12 = 0.385 .
151
Number ≈ 11.615 is between δ 2 = 12 and δ 3 = 11.5 closer
13
to δ 3 = 11.5 , because |11.615 − 12 | = 0.385 > |11.615 − 11.5 |= 0.115 .
151
Number ≈ 11.615 is between δ 3 = 11.5 and δ 4 = 11.667
13
closer to δ 4 = 11.667 , because
|11.615 − 11.5 | = 0.115 > |11.615 − 11.667 | = 0.052 .
151
Number ≈ 11.615 is between δ 4 = 11.667 and δ 5 = 11.6
13
closer to δ 5 = 11.6 , because
|11.615 − 11.667 | = 0.052 > |11.615 − 11.6 | = 0.015 .
151
Number ≈ 11.615 is between δ 4 = 11.667 and δ 5 = 11.6
13
closer to δ 5 = 11.6 , because
|11.615 − 11.667 | = 0.052 > |11.615 − 11.6 | = 0.015 .
151 153
Number ≈ 11.615 is equal to the last convergent δ 6 = .
13 13
Now, we can solve the Diophantine equation 151x + 13 y = 1
using property 7.2.
P6Q5 − Q6 P5 = ( −1) or a ⋅ 5 − b ⋅ 58 = 1 or a ⋅ 5 + b ⋅ ( −58 ) = 1 .
6

30
The solution to equation is x = 5, y = −58 .

PROBLEMS FOR UNIT 7


a
7.1. The rational number is represented via the chain of partial
b
a
quotients. Compute all convergents for the number , find a and b
b
from the table of convergents and solve a Diophantine equation
ax + by = 1 .

= [2 ,1,3 ,4 ,1,2] = [2 ,1,1,6 ,8 ] = [0 ,3,1,2 ,7 ,1]


a a a
1. b 2. b 3. b

= [1,1,2 ,4 ,5] = [0 ,3 ,4 ,3,2 ,3] = [3,1,1,1,5]


a a a
4. b 5. b 6. b

= [2 ,1,3 ,4 ,2 ,9 ] = [13 ,1,4 ,2 ,5] = [0 ,4 ,1,3 ,2 ,5]


a a a
7. b 8. b 9. b

= [22 ,3 ,1,4 ,7 ] = [2 ,1,30 ,2 ,3]


a a
= [1,24,3,4 ,5]
a
10. b 11. b 12. b

= [1,25 ,1,2 ,3,1,1] = [11,2 ,3,5 ,1,1] = [31,5 ,2 ,3,1,5]


a a a
13. b 14. b 15. b

= [1,25 ,1,2 ,3,1,1] = [2,8 ,1,2,3,1,2]


a a
= [1,13 ,1,2 ,5 ,1,1]
a
16. b 17. b 18. b

= [2 ,7 ,2,1,1,1,4] = [3 ,7 ,2 ,5 ,1,1,2] = [2 ,41,2 ,3,1]


a a a
19. b 20. b 21. b

= [2 ,17 ,1,5 ,1] = [3 ,19 ,1,1,3] = [2 ,1,1,3,5 ,1,1]


a a a
22. b 23. b 24. b
= [2 ,11,3 ,19 ,1,1,3]
a
= [5 ,9 ,3 ,11,1,1,2] = [21,1,3 ,7 ,1,1,3]
a a
25. b 26. b 27. b

= [2 ,23,1,2 ,3,1,2] = [3 ,29 ,1,1,2 ,2]


a
= [1,47 ,1,1,2 ,1,2]
a a
28. b 29. b 30. b

31
8. ARITHMETIC FUNCTIONS

In this section we shall consider several important arithmetic


functions.
8.1. The floor function (The integer part function)
Every real number x can be written uniquely as x = n + α , where
n ∈ Z and 0 ≤ α < 1 . We call n the integer part or the floor of x and
denote it by [x] or x  ; and α is called the fractional part of x and is
denoted by {x}. Thus, for x ∈ R, [x] is the greatest integer not
exceeding x.
The fractional part of x is commonly thought of as the part after
the decimal point, but this notion is correct only for positive x.
We define the fractional part by
{x} = x – [x] for x ∈ R.
Example 8.1
Find integer and fractional parts for numbers 123.45; 0.83;
-0.01; -10.56.
Solution
1. [123.45] = 123; {123.45} = 123.45 – [123.45] = 123.45 –
– 123 = 0.45.
2. [0.83] = 0; {0.83} = 0.83 - [0.83] = 0.83 – 0 = 0.83.
3. [–0.01] = –1; {–0.01} = –0.01 – [–0.01] = –0.01 – (–1) = 0.9.
4. [–10.56] = –11; {–10.56} = –10.56 – [–10.56] = –10.56 –
– (–11) = 0.44.
An integer part function is used for prime factorization of n!
We can find the highest power of prime p occurring in the prime
decomposition of an integer a by this function.
Example 8.2
Find the exponent of the highest power of prime 2 in the prime
decomposition of the integer 13!

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

Hence, the exponent of the highest power of a prime p


occurring in the prime decomposition of an integer n! is given by
n  n   n 
α =   +   + ... +  , p k ≤ n, p k +1 > n .
 p   p 2   p k 

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!

16. N = 428! 22. N = 749! 28. N = 923!

17. N = 295! 23. N = 957! 29. N = 847!

18. N = 345! 24. N = 367! 30. N = 537!

19. N = 650! 25. N = 841!

20. N = 728! 26. N = 791!

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

10. a = 2 ⋅ 3 ⋅ 7 ⋅ 59 11. a = 5 ⋅ 7 ⋅ 13 ⋅ 43 12. a = 3 ⋅ 7 ⋅ 17 ⋅ 23


3 7 2 5 2 3 6

13. a = 2 ⋅ 5 ⋅ 31 ⋅ 43 14. a = 2 ⋅ 7 ⋅ 23 ⋅ 53 15. a = 3 ⋅ 11 ⋅ 19 ⋅ 23


5 2 8 2 8 2

16. a = 5 ⋅ 7 ⋅ 19 ⋅ 41 17. a = 2 5 ⋅ 7 ⋅ 61 18. a = 2 ⋅ 7 ⋅ 11 ⋅ 37


4 3 5 2 6 2 2

19. a = 3 ⋅ 5 ⋅ 11 ⋅ 23 20. a = 3 ⋅ 7 ⋅ 11 ⋅ 79 21. a = 3 ⋅ 5 ⋅ 7 ⋅ 71


2 2 2 5 2 2 7 2

22. a = 2 ⋅ 3 ⋅ 5 ⋅ 41 23. a = 2 ⋅ 3 ⋅ 5 ⋅ 41 24. a = 2 ⋅ 5 ⋅ 101


6 4 3 6 4 3 6 3

25. a = 3 ⋅ 5 ⋅103 26. a = 2 ⋅ 3 ⋅ 7 ⋅ 97 27. a = 3 ⋅ 7 ⋅ 101


7 2 7 2 2 3 2

28. a = 2 ⋅ 3 ⋅ 7 ⋅ 71 29. a = 2 ⋅ 3 ⋅ 11 ⋅ 41 30. a = 2 ⋅ 3 ⋅ 5 ⋅ 53


5 4 2 9 4 2 9 4 3

38
9. MODULAR ARITHMETIC

9.1. CLASSES OF CONGRUENCE


Let us consider the example of distribution of the set of integers
into a finite number of classes with some relationships among these
numbers.
Let us take the number p = 7 . This number has 7 different
remainders – 0, 1, 2, 3, 4, 5, 6, and there are not any other remainders
of the division of any integers by 7. So, we can form a table of the
distribution of integers into the classes corresponding to such seven
remainders.
Table 9.1 – The distribution of integers into classes by remainders
from division by 7
Remainders→
0 1 2 3 4 5 6
Quotient ↓
1 7 7+1=8 7+2=9 7+3=10 7+4=11 7+5=12 7+6=13
2 14 15 16 17 18 19 20
3 21 22 23 24 25 26 27
… … … … … … … …
20 140 141 142 143 144 145 146
… … … … … … … …
33 231 232 233 234 235 236 237
… … … … … … … …
q 7q 7q+1 7q+2 7q+3 7q+4 7q+5 7q+6
… … … … … … … …
This table has 7 columns with integers and infinite numbers of
rows because infinite set of integers is distributed into 7 classes.
All numbers from class 0 have common property such that they
are divided by 7. We can denote this class as 7q. All numbers of
class 1 have the remainder r=1 from division by 7 and we denote this
class as 7q+1. We denote classes 2, 3, 4, 5, 6 as 7q + 2, 7q + 3, 7q +
+4, 7q + 5, 7q + 6 respectively.

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

Properties of congruences modulo m


Theorem 9.1.1
For any integers a, b, c, and m > 0 the following properties hold:
1. Reflexivity property a ≡ a ( mod m )
This property means that any integer can be uniquely represented
as a = m ⋅ q + r , 0 ≤ r < m for arbitrary positive divisor m
(Theorem 3.1).

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

∑ an−i x n−i ≡ ∑ bn−i y n−i (mod m )


i =0 i =0
for all polynomials with

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

Taking into account that ai ≡ bi ( mod m ) , i = 1, n and x ≡ y ( mod m ) ,


or ai = bi + mqi ; x = y + mt , we obtain
n n n n

∑a n −i x n−i = ∑ ( bn−i + mqn-i )x n−i = ∑ bn−i x n−i + m ∑ qn-1 ≡


i =0 i =0 i =0 i =0
n
≡ ∑ bn −i x n −i ( mod m ) .
i =0

Further, the right side of obtained congruence can be rewritten as


follows:
n n
x n−i = ∑ bn−i ( y+mt )
n −i
∑b
i =0
n −i
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 n−i + mq ) = ∑ bn−i y n−i + ∑ bn−i mq =


n n n n

∑ 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

∑ bn−i x n−i =∑ bn−i y n−i + m∑ bn−iq = ∑ bn−i y n−i + mq1 ≡


i =0 i =0 i =0 i =0
n
≡ ∑ bn −i y n −i ( mod m ) .
i =0

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

9 ≡ 2 ( mod 7 ) ; 2704 = 7 ⋅ 386 + 2 ⇒ 2704 ≡ 2 ( mod 7 ) .


So, if 3 ≡ 52 ( mod 7 ) is true, then 32 ≡ 522 ( mod 7 ) is indeed true.
4) Multiply through the congruence 3 ≡ 52 ( mod 7 ) by 10. We obtain
30 ≡ 520 ( mod 7 ) ; 30 = 7 ⋅ 4 + 2 ; 520 = 7 ⋅ 74 + 2 . Both numbers 30

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

313 = 312 ⋅ 3 = ( 34 ) ⋅ 3 = 813 ⋅ 3 ≡ 33 ⋅ 3 ( mod13) ;


3

33 ⋅ 3 = 27 ⋅ 3 = (13 ⋅ 2 + 1) ⋅ 3 ≡ 3 ( mod13) ; 3 < 13 .


Thus we have obtained that the remainder of the division 1348 26
by 13 is 3.

9.2. PROPERTIES OF CONGRUENCES THAT CHANGE MODULUS


Theorem 9.2.1
If a ≡ b(mod m) , then
1) for ∀a ,b ,a1 ,b1 ,m ,m1 , k ∈ Z , a = k ⋅ a1 , b = k ⋅ b1 , m = k ⋅ m1 : the
following congruence holds:
 a   b  m
  ≡   mod  or a1 ≡ b1 (mod m1 ) .
 k   k  k

47
For example, we have

155 ≡ 85(mod 35 ); = 7 ⇒ 31 ≡ 17 (mod 7 ) ;


155 85 35
= 31; = 17 ;
5 5 5
2) ∀k ∈ Z ka ≡ kb(mod km ) – multiplication by number.
For example, multiply the congruence 31 ≡ −2(mod 11) by 5.
We obtain 155 ≡ −10(mod 55 ) . This congruence holds because both
integers belong to the same residue class modulo 55 with the least
positive residue 45;
3) ∀d ≥ 1, d ∈ Z : if d | m and d | a ⇒
⇒ d | b ( if d | m and d | b ⇒ d | a ) .
For example, x ≡ 93(mod 144 ); gcd (93,144 ) = 3 ⇒ 3 | x ;
4) if a ≡ b ( mod m1 ) , and a ≡ b ( mod m2 ) , and......, and
a ≡ b ( mod mk ) ⇔ then a ≡ b ( mod Lcm ( m1 , m2 ,..., mk ) ) . Moreover,
if gcd ( m1 , m2 ,..., mk ) = 1 , then a ≡ b(mod m1m2 ...mk ) .
For example,
a) Suppose x ≡ 3 ( mod 5 ) , x ≡ 3 ( mod11) , x ≡ 3 ( mod 7 ) , we get
x ≡ 3 ( mod 5 ⋅11⋅ 7 ) .
b) Assume that x ≡ 3 ( mod 5 ) , x ≡ 3 ( mod 35 ) , x ≡ 3 ( mod 21) ,
lcm ( 5,35, 21) = 105 , then x ≡ 3 ( mod105) .

9.3. FERMAT'S LITTLE THEOREM AND EULER'S THEOREM ON THE


EXISTENCE OF THE UNIT ELEMENT MODULO m
Theorem 9.3.1. (Fermat’s little theorem) If p is a prime and a is a
coprime to p (gcd(a,p)=1), then
(
p| ap − a . )
This is the same as
a p−1 ≡ 1(mod p ) .
Theorem 9.3.2. (Euler’s theorem) If m > 0 and a is a coprime to m

48
(gcd(a,m)=1), then
a ϕ(m ) ≡ 1(mod m ) .

Example 9.3.1. Check, if 167 10 ≡ 1(mod 11)


Solution
Consider the following congruence:
167 ≡ 2(mod 11) ⇒ gcd (167 ,11) = 1 .
Hence, with Fermat’s little theorem 9.3.1,
167 10 ≡ 2 10 (mod 11) ,
( )
2 10 = 2 5
2
= 32 2 ≡ (32 − 3 ⋅ 11) = (− 1) = 1(mod 11) .
2 2

Then 167 10 ≡ 1(mod 11) and Fermat’s little theorem holds.

Example 9.3.2. Find the remainder from the division of 23 1443


by 13.
Solution
We have
≡ x(mod 13 ); 23 ≡ −3(mod 13 ) ⇒ 23 1443 ≡ (− 3 ) (mod 13 ) .
1443 1443
23
Taking into account that gcd(3,13)=1, then with Fermat’s little
theorem we can write (− 3 ) ≡ 1(mod 13 ) .
12

Further, raising the congruence to the 120th power, we get


((− 3) ) ≡ 1120 (mod 13) ⇒ (− 3)
12 120
≡ 1(mod 13) .
1440

Obviously, 1443 = 1440+3, so we have


( −3 ) = ( −3) = ( −3 ) ( −3 ) ≡ ( −3) ≡ −27 ≡
1443 1440 + 3 1440 3 3

≡1( mod13)

≡ −27 + 3 ⋅13 ≡ 12 ( mod13) .


Hence, the remainder from the division 23 1443 by 13 is equal 12.
Example 9.3.3. Find the last three digits of the integer 13 1599 .
Solution
Let us rephrase this problem as follows: find the remainder
from the division of 13 1599 by 1000.
49
A solution to the problem will be the congruence:
13 ≡ x(mod 1000 ) .
1599

Obviously, gcd (13,1000 ) = 1 . As 1000 is composite, then


1000 = 2 3 ⋅ 5 3 . Hence, Euler’s theorem is correct for this number:
13ϕ (1000 ) ≡ 1(mod 1000 ) ,
ϕ (1000 ) = ϕ (2 3 ⋅ 5 3 ) = (2 3 − 2 2 )(5 3 − 5 2 ) = 4 ⋅ 100 = 400 .
We have 13 400 ≡ 1(1000 ) – Euler’s theorem.
The exponent 1599 is not divisible by 400, but 1600 = 400 ⋅ 4 .
Multiplying the congruence by 13, we obtain
13 1600
≡ 13 x(mod 1000 ) . Using property (3) in Theorem 9.1.10, we
(
can write down that 131600 = 13 400 ≡ 1(mod 1000 ) . So, )4

13 x ≡ 1(mod 1000 ) . Then, taking into account property (1) in


Theorem 9.1, we add the modulus 1000 to the right side of the
congruence:
13 x ≡ 1001(mod 1000 ); 1001 = 13 ⋅77 ; gsd (13,1000 ) = 1 .
Finally, we divide the last congruence by 13 using the property
(5) in Theorem 9.1:
x ≡ 77 (mod 1000 ) .
The answer for the task is that the remainder from the
division of 13 1599 by 1000 equals 77, and the last three digits of
the integer 13 1599 are 077.
Example 9.3.4. Find the remainder from the division of 348 128
by 21.
Solution
Let us write the congruence for the solution of this task:
348 128 ≡ x(mod 21) .
It should be noted that gcd(348,21) = 3. Then, according to the
property (3) in Theorem 9.2.1, we can conclude that 3 | x .

50
By introducing new variable x = 3y , we obtain that
348 ≡ 3 y (mod 21) .
128

Let us divide the congruence by 3 using the property (1) in


Theorem 9.2.1:
348128 = 348127 ⋅ 348 ≡ 3 y ( mod 21) ⇒ 348127 ⋅116 ≡ y ( mod 7 ) ,
348 = 73 + 5; 116 = 7 ⋅16 + 4 ⇒ 348 ≡ 5 ( mod 7 ) ,
prop (6)
116 ≡ 4 ( mod 7 ) ⇒ ( 5) ⋅ 4 ≡ y ( mod 7 ) .
127

Obviously, gcd (5 ,7 ) = 1 , then, according to Fermat’s little


theorem, we get 5 6 ≡ 1(mod 7 ) .
127 = 6 ⋅ 21 + 1 ⇒ 5 127 = 5 6⋅21+1 = 5 6 ( ) 21
⋅5.
Since 56 ≡ 1(mod 7 ) ⇒ 5 6 ( ) 21
≡ 1(mod 7 ) (the property (3) in
5127 ⋅ 4 = ( 56 ) ⋅ 5 ⋅ 4 ≡ 20 ( mod 7 ) ,
21
Theorem 9.1.10), and
20 ≡ 6 ( mod 7 ) ⇒ y ≡ 6 ( mod 7 ) .
Finally, using back substitution for x = 3 y , we obtain
y ≡ 6 (mod 7 ) ⇒ x ≡ 3 ⋅ 6 (mod 21) .
The answer for the task is that the remainder from the
division of 348 128 by 21 equals 18.
Example 9.3.5. Find the remainder from the division of
143 50 + 343 50 by 17.
Solution
Let us write the congruence for the solution of the given task:
143 + 343 50 ≡ x(mod 17 ) .
50

First, according to property (1) in Theorem 9.1.3, we see that


stated above problem splits into two congruences:
143 50 ≡ x1 (mod 17 ); 343 50 ≡ x2 (mod 17 ) .
Obviously, x = x1 + x2 .
So, we shall solve each problem separately and then find the sum
of the solutions. Let us start with the first one. We have

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 )

143 = 17 ⋅ 8 + 7 ⇒ 143 ≡ 7 ( mod17 ) ⇒ 1432 ≡ 7 2 ( mod17 ) ,


7 2 = 49 = 17 ⋅ 2 + 15 = 17 ⋅ 3 − 2 ⇒ 7 2 ≡ −2(mod 17 ) .
Thus x1 ≡ −2(mod 17 ) is a solution to the first congruence.
2. Now, we will consider the second congruence. We get
343 50 ≡ x2 (mod 17 ) .
Th 9.3.1
gcd ( 343,17 ) = 1; 17 is prime ⇒ 34316 ≡ 1( mod17 ) ,
50 = 16 ⋅ 3 + 2 ⇒ 34150 = 34316 ( ) 3
⋅ 343 2 ≡ 343 2 (mod 17 ) ,
≡1( mod 17 )

343 = 17 ⋅ 20 + 3 ⇒ 343 ≡ 3 ( mod17 ) ⇒ 3432 ≡ 32 ( mod17 ) ,


32 = 9 < 17 .
Thus we have obtained x2 ≡ 9(mod 17 ) .
3. Finally, the total solution to the given problem is
x = x1 + x2 ≡ −2 + 9 = 7 (mod 17 ) .
The answer for the task is that the remainder from the
division of 143 50 + 343 50 by 17 equals 7.

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

9. 10. 11. 12.


109345 by 14 439291 by 60 293275 by 48 6617 by 7

13. 14. 15. 16.


11753 by 11 570+750 by 12 580+7100 by 13 550+13100 by 18

17. 15. 16. 20.


111841 by 7 580+7100 by 13 550+13100 by 18 122751 by 10

21. 22. 23. 24.


343741 by 26 1782741 by 22 111201 by 1000 71199 by 1000

25. 26. 27. 28.


3157 by 100 1778 by 100 1979 by 100 7114 by 100

29. 30.
11203 by 100 7332 by 100

53
10. LINEAR CONGRUENCES WITH ONE UNKNOWN

10.1. CONGRUENCES OF THE FIRST ORDER. SOLVING


CONGRUENCES
Definition 10.1.1
An expression of the form
ax + b ≡ 0(mod m ) or ax ≡ b(mod m )
is called a congruence of the first order or a linear congruence with
one unknown.
Definition 10.1.2
A solution of the first order congruence modulo m is a class
of numbers x1 + mt , t ∈ Z such that substitution of each residue
into the congruence yields the equivalent congruence
b ≡ b ( mod m ) .
As a rule, the number x1 belongs to the least absolute residue
system modulo n or the least nonnegative residue system modulo n.
To study existence of solutions of such congruence, we shall
consider several situations:
First, we introduce case (a, m ) = 1 .
If x ranges over a complete residue system modulo m , then the
number ax also takes on values from such system with the precision
to a sequence order. Thus, there exists only one x congruent to b .
Conclusion
If condition (a, m ) = 1 takes place, then the congruence
ax ≡ b(mod m ) has a unique solution.
Secondly, let us consider the congruence ax ≡ b(mod m ) and
assume that (a, m ) = d > 1 :
ax ≡ b(mod m ) ⇒ ax = b + mt .

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.

10.1.1. APPLICATION OF CONGRUENCE’S PROPERTIES


Examples
а) Solve the congruence: 15 x ≡ 25(mod 17 ) .
Solution
First, let us consider gcd of 15 and 17. Since (15,17 ) = 1 , then
the congruence possesses a unique solution. Further, using properties

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.

10.1.2. APPLICATION OF CONVERGENTS


Consider the case ax ≡ b(mod m ) , (a, m ) = 1 .
Let us expand the given below ratio into continued fraction
m 1
= q1` + .
a q2 + ...
1
+
qn
We shall get a set of partial quotients q1 , q2 ,..., qn . According to a
Pi
well-known scheme, we will built continued fractions: δi = . Let
Qi
us consider the last two terms from the set:
Pn−1 Pn m
δ n−1 = , δn = = .
Qn−1 Qn a
It follows from properties of continued fractions that
PnQn−1 − Qn Pn−1 = (− 1) . Hence, mQn−1 − aPn−1 = (− 1) . Since Qn−1 is
n n

an integer, we may suppose that mQn−1 is a modular period which


can be truncated. This leads to aPn−1 = (− 1) mod(m ) . Multiplying
n −1

both parts of the expression by number (− 1) b , we obtain


n

a(− 1) bPn−1 ≡ b(mod m ) .


n −1

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

It follows from the obtained above data that


n = 5, Pn −1 = P4 = 104, b = 179 ⇒
104 ⋅179 81
⇒ x = ( −1) 104 ⋅179 ( mod 337 ) ; = 55 +
4
.
337 337
Thus the solution is x ≡ 81(mod 337 ) .

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 )

Therefore, we come to a conclusion that

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

a −1 = 427 in the least nonnegative residue system.

10.3. SYSTEM OF LINEAR CONGRUENCES WITH ONE UNKNOWN


Consider a system of congruences involving one unknown with
respect to different modulus
 a1 x ≡ b1 ( mod m1 ) , ( a1 , m1 ) = 1,

 a2 x ≡ b2 ( mod m2 ) , ( a2 , m2 ) = 1,
 (1)
 … … … … … … …
ak x ≡ bk ( mod mk ) , ( ak , mk ) = 1.

Let us assume that m1 , m2 ,..., mk are pairwise prime numbers such
that (mi , m j ) = 1, i = 1, k ; j = 1, k ; i ≠ j .

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

equation by its own inverse, we obtain the equivalent system


 x ≡ c1 ( mod m1 ) ,
 x ≡ c2 ( mod m2 ) ,
… … … … (2)

 x ≡ ck ( mod mk ) .
61
Thus, if we solve the system (2), then we will thereby know the
solution to the system (1).
To answer the questions about the existence and structure of the
solution of the system (2), we introduce the Chinese remainder
theorem:
Let m1 , m2 ,..., mk be pairwise coprime positive integers and let
c1 , c2 ,..., ck be integers satisfying the inequalities
0 ≤ ci ≤ mi − 1, i = 1, k . Then, there exists a unique integer α such
that ci will be the remainder on dividing α by mi , i. e.,
α ≡ ci (mod mi ) .
Proof
We shall prove the theorem by constructing a number α . Denote
by M the gcd of all moduli. Since they are pairwise coprime, then
M = m1m2 ...mk . Further, we build a system of numbers as follows:
M m1m2 ...mi ...mk
Mi = = = m1m2 ...mi−1mi+1...mk , i = 1, k .
mi mi
Being pairwise coprime with mi , each M i has an inverse
mod(mi ) .
−1 ϕ ( mi )−1
Mi ≡ Mi
k
Let us construct the integer α = ∑ M i M i ci .
−1

i =1

It is obvious that the solution to the system (2) is a residue class


that satisfies a congruence
x ≡ α(mod M ) .
Indeed, let us substitute α to the first congruence of the system
(2):
M 1M 1 c1 + M 2 M 2 c2 + ... + M k M k ck ≡ c1 (mod m1 ) .
−1 −1 −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

and, consequently, (M 1 , m1 ) = 1 . Finally, there will remain only


equivalent congruence c1 ≡ c1 (mod m1 ) .
In the second equation, the only term incongruent to 0 modulo
−1
m2 is M 2 M 2 c2 . Thus, α is the solution for the second congruence,
etc.
Clearly, the solution, according to its structure, satisfies every
congruence in the system.
Conclusion
The solution to the system (2) exists and it is a class of
integers x = α + Mt , t ∈ Z .
Consider an example for the solution of the system with several
congruences.
Example
Solve a system of congruences
743 x ≡ 16 ( mod13) ,

 59 x ≡ 128 ( mod 5 ) ,
 136 x ≡ 82 ( mod 3) .
Solution
There is the system of three congruences modulo prime numbers.
STEP 1. Let us simplify the system. We substitute the least
residues of appropriate moduli for numbers in each of congruences.
2 x ≡ 3 ( mod13) ,

 4 x ≡ 3 ( mod 5 ) ,
 x ≡ 1( mod 3) .
We bring the system to the type (2):
 2 x ≡ 3 + 13 ( mod13) ⇒ 2 x ≡ 16 ( mod13) ⇒ x ≡ 8 ( mod13) ,
 ( 2,13)=1
4 x ≡ 3 + 5 ( mod 5 ) ⇒ 4 x ≡ 8 ( mod 5) ( 4,5
⇒ x ≡ 2 ( mod 5) ,
)=1
 x ≡ 1 mod 3 .
 ( )

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.

PROBLEMS FOR UNIT 10


Problem 1
Obtain inverse for a modulo m .

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
Навчальне видання

Елементи теорії чисел


Конспект лекцій та контрольні завдання
для студентів напрямів підготовки
6.04030101 „Прикладна математика”
та 6.040302 „Інформатика”
усіх форм навчання

(Англомовний курс)

Відповідальний за випуск Л. А. Фильштинський


Редактор С. В. Чечоткіна
Комп’ютерне верстання Ю. В. Шрамко

Формат 60×84/16. Ум. друк. арк. 4,19. Обл.-вид. арк. 4,78.

Видавець і виготовлювач
Сумський державний університет,
вул. Римського-Корсакова, 2, м. Суми, 40007
Свідоцтво суб’єкта видавничої справи ДК № 3062 від 17.12.2007.

You might also like