Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
13
5
19
11
7
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
1 / 31
17
13
5
19
11
Outline
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Congruences
Course readings
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
2 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
3 / 31
17
13
5
19
11
Divisibility relation
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Definition 2
The binary relation | Z Z given by
a|b (c Z)(b = ac),
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
4 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Proposition 1
Let a, b, c Z. Then:
1
0 divides only 0;
2
3
Congruences
4
Eulers totient
function
Course readings
6
7
8
9
a divides 0 and a;
1 divides a;
a|b iff a| b;
if a|b and b|c, then a|c;
if a|b + c and a|b, then a|c;
if a|b, then ac|bc. Conversely, if c 6= 0 and ac|bc, then a|b;
if a|b and a|c, then a|b + c, for any , Z;
if a|b and b 6= 0, then |a| |b|. Moreover, if a is a proper
divisor of b, then 1 < |a| < |b|.
Spring 2014
5 / 31
17
13
5
19
11
Prime numbers
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
Definition 3
A natural number n 2 is called prime if the only positive factors
of n are 1 and n. A natural number n 2 that is not a prime is
called composite.
The greatest
common divisor
Definition 4
Congruences
Eulers totient
function
Course readings
Spring 2014
6 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Theorem 6
Let a1 , . . . , am Z, where m
Then, (a1 , . . . , am ) = 1 iff there
P2.
m
are 1 , . . . , m Z such that i=1 i ai = 1.
Corollary 7
Spring 2014
7 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Example 9
4 = 22 , 9 = 32 , 12 = 22 3, 36 = 22 32 .
105 = 3 5 7.
Spring 2014
8 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Theorem 10
There are infinitely many primes.
Theorem 11 (The Prime Number Theorem)
Let (n) = |{p|p is a prime and p n}|. Then,
Congruences
Eulers totient
function
lim
Course readings
(n)
= 1.
n
ln n
We write
(n)
and say that (n) and
Prof.Dr. F.L. Tiplea (UAIC)
n
ln n
n
are asymptotically equivalent.
ln n
Spring 2014
9 / 31
17
13
5
19
11
Values of (n)
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
101
4
102
25
103
168
104
1229
105
9592
106
78496
107
664579
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
(10100 ) (1099 )
1099
10100
100 ln 10 99 ln 10
!
1099 1
1
ln 10 10 99
>
0.39 1098
4 1097
Spring 2014
10 / 31
17
13
5
19
11
Large numbers
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
11 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
17
13
Eulers totient
function
Course readings
19
11
7
23
Spring 2014
12 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
Definition 12
Let a1 , . . . , am Z, not all zero, where m 2. The greatest
common divisor of these numbers, denoted gcd(a1 , . . . , am ) or
(a1 , . . . , am ), is the largest integer d such that d|ai , for all i.
The greatest
common divisor
Example 13
Congruences
Eulers totient
function
(2, 5, 7) = 1.
Course readings
(9, 3, 15) = 3.
Proposition 2
Let a1 , . . . , am Z, not all zero, where m 2. Then:
1
2
3
(0, a1 , . . . , am ) = (a1 , . . . , am );
(0, a1 ) = |a1 |, provided that a1 6= 0;
(a1 , a2 ) = (a2 , a1 mod a2 ), provided that a2 6= 0.
Spring 2014
13 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Theorem 14
Let a1 , . . . , am Z, not all zero, where m 2. Then,
(a1 , . . . , am ) = 1 a1 + + m am
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
for some 1 , . . . , m Z.
Corollary 15
Eulers totient
function
Course readings
Spring 2014
14 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Definition 17
Let a1 , . . . , am Z, where m 2. The least common multiple of
these numbers, denoted lcm(a1 , . . . , am ) or [a1 , . . . , am ], is
0, if at least one of these numbers is 0;
the smallest integer b > 0 such that ai |b, for all i, otherwise.
Congruences
Eulers totient
function
Course readings
Example 18
[0, a] = 0, for any a.
[4, 6, 2] = 12.
Theorem 19
Let a, b N, not both zero. Then, ab = (a, b)[a, b].
Prof.Dr. F.L. Tiplea (UAIC)
Spring 2014
15 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
r1
r0
rn2
rn1
Congruences
Eulers totient
function
Course readings
=
=
r0 q1 + r1 ,
r1 q2 + r2 ,
0 < r1 < r0
0 < r2 < r1
=
=
rn1 qn + rn ,
rn qn+1 + rn+1 ,
where r1 = a s i r0 = b. Then,
(a, b) = (r1 , r0 ) = (r0 , r1 ) = = (rn , 0) = rn
Spring 2014
16 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
17 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
1.
2.
3.
n.
n + 1.
a
b
r1
rn2
rn1
=
=
=
bq1 + r1
r1 q2 + r2
r2 q3 + r3
=
=
rn1 qn + rn
rn qn+1
Va
Vb
Vr1
Vr2
Vr3
=
=
=
=
=
(1, 0)
(0, 1)
Va q1 Vb
Vb q2 Vr1
Vr1 q3 Vr2
Vrn
Vrn2 qn Vrn1
Spring 2014
18 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
19 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
20 / 31
17
13
5
19
11
Congruences
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Definition 21
Let a, b, m Z. We say that a is congruent to b modulo m,
denoted a m b or a b mod m, if m|(a b).
Divisibility. Prime
numbers
The greatest
common divisor
Example 22
Congruences
Eulers totient
function
Course readings
6 0 mod 2.
7 1 mod 2.
3 6 2 mod 2.
11 1 mod 4 and 11 1 mod 4.
Remark 2
If m 6= 0, then a b mod m iff a mod m = b mod m.
Prof.Dr. F.L. Tiplea (UAIC)
Spring 2014
21 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Proposition 3
Let a, b, c, d, m, m Z and f : Z Z be a polynomial function
with integer coefficients. Then:
1
m is an equivalence relation on Z;
2
if a m b s i c m d, then a + c m b + d, a c m b d,
ac m bd, and f (a) m f (b);
Congruences
Eulers totient
function
Course readings
4
if ac mc bc and c 6= 0, then a m b;
if a mm b, then a m b and a m b;
Spring 2014
22 / 31
17
13
5
19
11
Zm
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Example 23
Z1 = {[0]1 }, Z2 = {[0]2 , [1]2 }, Z3 = {[0]3 , [1]3 , [2]3 }.
Remark 3
We usually write Zm = {0, 1, . . . , m 1} instead of
Zm = {[0]m , . . . , [m 1]m }, for any m 1.
Prof.Dr. F.L. Tiplea (UAIC)
Spring 2014
23 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
(unary operation)
Congruences
Eulers totient
function
Course readings
Spring 2014
24 / 31
17
13
5
19
11
Inverses modulo m
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
25 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Proposition 4
a Zm has a multiplicative inverse modulo m iff (a, m) = 1.
The multiplicative inverse of a, when it exists, is unique and it is
denoted by a1 .
Zm = {a Zm |(a, m) = 1} is called the group of units of Zm or the
group of units modulo m.
Eulers totient
function
Course readings
Example 24
Z1 = {0}.
Z26 has 12 elements:
11 = 1, 31 = 9, 51 = 21,
71 = 15, 111 = 19, 171 = 23,
251 = 25.
Prof.Dr. F.L. Tiplea (UAIC)
Spring 2014
26 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
27 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
(m) = |Zm |,
Divisibility. Prime
numbers
for any m 1. That is, (m) is the number of positive integers less
than or equal to m and co-prime to m.
The greatest
common divisor
Congruences
Theorem 25
Eulers totient
function
Course readings
(1) = 1;
Spring 2014
28 / 31
17
13
5
19
11
23
Algebraic
Foundations of
Computer Science
(AFCS)
Example 26
Prof.Dr. F.L.
Tiplea
(5) = 4.
Divisibility. Prime
numbers
The greatest
common divisor
(245) = (5 72 ) = 168.
Congruences
Eulers totient
function
Course readings
Remark 4
it is easy to compute (n) if the prime decomposition of n is
known;
it is hard to compute the prime decomposition of large
numbers (512-bit numbers (about 155 decimals) or larger);
it is hard to compute (n) if n is large and the prime
decomposition of n is not known.
Spring 2014
29 / 31
17
13
5
19
11
Eulers theorem
23
Algebraic
Foundations of
Computer Science
(AFCS)
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
1
Course readings
2
Example 29
13594 1 mod 5 and 3168 1 mod 245.
Spring 2014
30 / 31
17
13
5
19
11
Course readings
23
Algebraic
Foundations of
Computer Science
(AFCS)
F.L. Tiplea:
Prof.Dr. F.L.
Tiplea
Divisibility. Prime
numbers
The greatest
common divisor
Congruences
Eulers totient
function
Course readings
Spring 2014
31 / 31