Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
433 views

Tutorial8 Solution

This document provides solutions to problems involving number theory concepts. It defines prime and composite integers with examples. Relatively prime integers are defined as having greatest common divisor of 1. Approximations are used to find the number of primes and composites between 100,000 and 200,000, and their ratio. The sieve of Eratosthenes method for finding primes is explained. Euler's totient function is defined as counting integers relatively prime to n. Rules are given for calculating it. Fermat's little theorem and Euler's theorem are stated in two versions each. Examples demonstrate using these theorems to solve congruences. The Chinese remainder theorem is applied to solve a simultaneous congruence. Fast exponentiation is used to

Uploaded by

MuhammadIdham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
433 views

Tutorial8 Solution

This document provides solutions to problems involving number theory concepts. It defines prime and composite integers with examples. Relatively prime integers are defined as having greatest common divisor of 1. Approximations are used to find the number of primes and composites between 100,000 and 200,000, and their ratio. The sieve of Eratosthenes method for finding primes is explained. Euler's totient function is defined as counting integers relatively prime to n. Rules are given for calculating it. Fermat's little theorem and Euler's theorem are stated in two versions each. Examples demonstrate using these theorems to solve congruences. The Chinese remainder theorem is applied to solve a simultaneous congruence. Fast exponentiation is used to

Uploaded by

MuhammadIdham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

TCD2221 CRYPTOGRAPHY AND DATA SECURITY

TUTORIAL 8
NUMBER THEORY II - SOLUTIONS
(20 points)

1. a. Distinguish between a prime and a composite integer with examples.

Solution:

A positive integer is a prime if and only if it is exactly divisible by two different
integers, 1 and itself.
Example: Prime integers in the range 1 to 10: 2, 3, 5, 7

A composite is a positive integer with more than two divisors.
Example: Composite integers in the range 1 to 10: 4, 6, 8, 9, 10

b. Define the meaning of relatively prime or coprime.

Solution:

Two positive integers, a and b, are said to be relatively prime, or coprime, if
gcd (a,b) = 1.

Properties:
Number 1 is relatively prime with any integer.
If p is a prime, then all integers 1 to (p-1) are relatively prime to p.

2. Using approximation, find

(i) The number of primes between 100,000 and 200,000.
(ii) The number of composite integers between 100,000 and 200,000.
(iii) The ratio of primes to composites in the above range.

Solution:

(i) The number of primes between 100,000 and 200,000 can be found as
(200,000) (100,000).

Using the upper and lower limits devised by Gauss and Lagrange, we have


Applying the above limits,
16385 < (200,000) < 17982
(200,000) (16385+17982)/2 = 17184
8686 < (100,000) < 9588
(100,000) (8686+9588)/2= 9137
(200,000) (100,000) 17184 9137 8047

(ii) The number of composites between 100,000 and 200,000:

100001 8047 = 91954

(iii) The ratio of primes to composites in the above range:

(8047/91954)100 % or approximately 8.75%


3. Explain the sieve of Eratosthenes and explain its application.

Solution:

Application:
The Sieve of Eratosthenes is a method to find all primes less than n.
Method:
We write down all the integers between 2 and n.
We cross out all integers divisible by 2 (except 2 itself).
We cross out all integers divisible by 3 (except 3 itself).
And so on until we have crossed out all integers divisible by all primes less than n,
The remaining integers are primes.

4. a. State the use of Eulers Totient function and the rules that can be used for
finding the function.

Solution:

Use of Eulers Totient Function:

Eulers phi-function, (n), which is sometimes called the Eulers totient function,
finds the number of integers that are both smaller than n and relatively prime to n.

Rules that can be used for finding Eulers Totient Function:




b. Using the appropriate rules, find the value of
(i) (29) (ii) Z
80
*

Solution:

(i) (29) = 29-1 = 28 (since p=29 is a prime, applying 2
nd
rule)
(ii) Z
80
* = (80) = (16 5)
= (2
4
5
1
)
=(2
4
- 2
3
) (5
1
- 5
0
) (because 2 and 5 are primes-4
th
rule)
=(16-8) (5 1)
= 8 4
Z
80
* = 32

5. State the two versions of the following theorems.

(i) Fermats little theorem
(ii) Eulers theorem


Solution:

Fermats little theorem
First version:
If p is a prime and a is an integer such that p does not divide a, then

a
p 1
1 mod p
Second version:
If p is a prime and a is an integer, then

a
p
a mod p

Eulers theorem:
First version:
If a and n are coprime

a
(n)
1 (mod n)

Second version:
Removes the condition that a and n should be coprime.
If n=pq, a<n, and k an integer, then
a
k (n) + 1
a (mod n)


6. Find the results of the following using Fermats little theorem.

(i) 15
18
mod 17 (ii) 5
15
mod 13

Solution:

(i) 15
18
mod 17 = [(15
17
mod 17) (15
1
mod 17)] mod 17

= ( 15 mod 17) (15 mod 17)] mod 17
= ( 15 mod 17) (15 mod 17)] mod 17
= (15 15 ) mod 17
= 225 mod 17
15
18
mod 17 = 4










(ii) 5
15
mod 13 = [(5
2
mod 13) (5
13
mod 13)] mod 13

= ( 25 mod 13) (5 mod 13)] mod 13
= (12 5 ) mod 13
= 60 mod 13
5
15
mod 13 = 8




7. Find the results of the following using Fermats little theorem.

(i) 15
-1
mod 17 (ii) 27
-1
mod 41



Solution:

According to Fermats little theorem, if p is a prime and a is an integer such that p does not
divide a, then

a
1
mod p = a
p 2
mod p



(i) 15
-1
mod 17 =15
17-2
mod 17 =15
15
mod 17
= [(15
8
mod 17) (15
4
mod 17) (15
2
mod 17) (15
1
mod 17)] mod 17
= [(16 16) mod 17 16 mod 17 4 mod 17 15 mod 17 ] mod 17
= (1 16 4 15) mod 17
= 960 mod 17
15
-1
mod 17 = 8



(ii) 27
-1
mod 41 = 27
41-2
mod 41 =27
39
mod 41
















27
39
mod 41 = 38





8. Find the results of the following using Eulers theorem.

(i) 12
-1
mod 77 (ii) 16
-1
mod 323

Solution:

If n and a are coprime, then

a
1
mod n = a
(n)1
mod n


(i) 12
-1
mod 77 = 12
(77)1
mod 77

(77) = (7 11) = (7) (11) =6 10 =60


12
(77)1
mod 77 = 12
60-1
mod 77= 12
59
mod 77
= (12
1
mod 7712
2
mod 7712
8
mod 7712
16
mod 7712
32
mod 77) mod 77
= (1267672367) mod 77 = 45

12
-1
mod 77 = 45

(Note: We can also use square and multiply method of fast exponentiation algorithm to
find 12
59
mod 77 = 45)

(ii) 16
-1
mod 323 = 16
(323)1
mod 323

(323) = (17 19) = (17) (19) =16 18 =288


16
(323)1
mod 323 = 16
288-1
mod 323= 16
287
mod 323
= (16
1
mod 32316
2
mod 32316
4
mod 32316
8
mod 32316
16
mod 32316
256
mod
323) mod 323
= (16256290120188290) mod 323
= 101

16
-1
mod 323= 101

(Note: We can also use square and multiply method of fast exponentiation algorithm to
find 16
287
mod 323 = 101)







9. Find the value of x using the chinese remainder theorem.
x 2 mod 7, and x 3 mod 9

Solution:

Given:

x 2 mod 7, and x 3 mod 9
Hence m
1
= 7,
m
2
= 9,
a
1
= 2,
a
2
= 3

1. Find M =m
1
m
2
. This is the common modulus.
M = 79=63
2. Find M
1
=M/m
1
, M
2
=M/m
2


M
1
= 63/7 = 9
M
2
= 63/9 = 7
3. Find the multiplicative inverse of M
1
and M
2
using the corresponding moduli (m
1
,m
2)

Call the inverses M
1
1
, and M
2
1
.
M
1
1
=9
-1
mod 7
=9
7-2
mod 7
( a
1
mod p = a
p 2
mod p if p is a prime and a is an integer such that p does not divide a
Fermats little theorem)
=9
5
mod 7
= (9
2
9
2
9
1
) mod 7
=[(81 mod 7) (81 mod 7) (9 mod 7)] mod 7
= ( 4 4 2 ) mod 7
= 32 mod 7
M
1
1
= 4

M
2
1
=7
-1
mod 9
=7
(9)1
mod 9
(a
1
mod n = a
(n)1
mod n if n and a are coprime Eulers theorem)


(9)= (3
2
) = 3
2
- 3
2-1
= 3
2
- 3
1
= 9

- 3 =6 )

=7
61
mod 9


=7
5
mod 9
= (7
2
7
2
7
1
) mod 9
=[(49 mod 9) (49 mod 9) (7 mod 9)] mod 9
= ( 4 4 7 ) mod 9 = 112 mod 9
M
2
1
= 4

4. The solution to the simultaneous equations is


x =(2 9 4 +3 7 4) mod 63 =156 mod 63 =30


Answer: x=30
This value satisfies the given two equations:
30 2 (mod 7), 30 3 (mod 9)




10. Find the results of the following using the square-and-multiply method of fast
exponentiation algorithm.

(i) 21
24
mod 8 (ii) 2001
35
mod 2000


Solution:



























(
ii) 2001
35
mod 2000

Given: a=2001, x=35=100011, n=2000

i x
i
Multiplication (Initialization: y=1) Squaring (Initialization: a=2001)
0 1 y=(2001*1)mod2000=1 a=(2001)
2
mod 2000 =1
1 1 y=(1*1)mod2000=1 a=(1)
2
mod 2000 =1
2 0 ------------------------ a=(1)
2
mod 2000 =1
3 0 ------------------------ a=(1)
2
mod 2000 =1
4 0 ------------------------ a=(1)
2
mod 2000 =1
5 1 y=(1*1)mod2000=1 ------------------------


Result: 2001
35
mod 2000=1



References:

1. Behrouz A. Forouzan, "Cryptography and Network Security",1
st
Edition,
McGraw-Hill, 2008

2. William Stallings, Cryptography and Network Security Principles and Practices,
4/E, Prentice Hall, 2006.

You might also like