Vous êtes sur la page 1sur 6

CSCI467AssignmentTwo

JasonDetchevery
Due:February11,2008

200410029

1. 4.17,FourthEdition

a. Euclideanalgorithm:GCD(2152,764)

A
B
Remainder
2152
764
624
764
624
140
624
140
64
140
64
12
64
12
4
12
4
0

Theremainderbecomes0,makingthelastnonzeroremainder,4=GCD(2152,764)

SteinsAlgorithm:

Step1: LetA1=2152,B1=764,C1=1
Step2:A1andB1arebotheven,thereforeA2=2152/2=1076,B2=764/2=382,C2=2
Step3: A2andB2arebotheven,thereforeA3=1076/2=538,B3=382/2=191,C3=4
Step4:A3isevenandB3isodd,thereforeA4=269,B4=191,C4=4
Step5:A4isoddandB4isodd,thereforeA5=|269191|=78,B5=Min(191,269)=191,C5=4
Step6:A5isevenandB5isodd,thereforeA6=78/2=39,B6=191,C6=4
Step7:A6isoddandB6isodd,thereforeA7=|39191|=152,B7=Min(191,39)=39,C7=4
Step8:A7isevenandB7isodd,thereforeA8=152/2=76,B8=39,C8=4
Step9:A8isevenandB8isodd,thereforeA9=76/2=38,B9=39,C9=4
Step10:A9isevenandB9isodd,thereforeA10=38/2=19,B10=39,C9=4
Step11:A10isoddandB10isodd,thereforeA11=|1939|=20,B11=Min(19,39)=19,C11=4
Step12:A11isevenandB11isodd,thereforeA12=20/2=10,B12=19,C12=4
Step13:A12isevenandB12isodd,thereforeA13=10/2=5,B13=19,C13=4
Step14:A13isoddandB13isodd,thereforeA14=|519|=14,B14=Min(5,19)=5,C14=4
Step15:A14iseven,B14isodd,thereforeA15=14/2=7,B15=5,C15=4
Step16:A15isoddandB15isodd,thereforeA16=|75|=2,B16=Min(5,7)=5,C16=4
Step17:A16isevenandB16isodd,thereforeA17=2/2=1,B17=5,C17=4
Step18:A17isoddandB17isodd,thereforeA18=|15|=4,B18=Min(1,5)=1,C18=4
Step19:A18isevenandB18isodd,thereforeA19=4/2,B19=1,C19=4
Step20:A19isevenandB19isodd,thereforeA20=2,B19=1,C20=4
Step21:A20isevenandB20isodd,thereforeA21=2/2=1,B19=1,C21=4
Step22:A21isequaltoB21thereforeGCD(2152,764)=A21*C21=1*4=4

b. Despiteneedingmoresteps(inthiscase),theadvantageofSteinsAlgorithmovertheEuclidean
Algorithmisthatitdoesntrequireandintegerdivisions,insteadrelyingonlyonmultiplication
anddivisionby2whichcanbeimplementedfasterwithsimplebitshiftswhichalongwith
subtractionimprovesovertheintegerdivision/modoperation.

2. 4.19,FourthEdition

a. Multiplicativeinverseof1234mod4321viaExtendedGCD:

Q
A1
A2
A3
B1
B2
B3

1
0
4321
0
1
1234
3
0
1
1234
1
3
619
1
1
3
619
1
4
615
1
1
4
615
2
7
4
153
2
7
4
307
1075
3
1
307
1075
3
309
1082
1

MultiplicativeInverseof1234mod4321=1082

(1082*1234)mod4321=(1335188)mod4321=

4321*(308)=1330868and4321*(309)=1335189

So309isthegreatestmultiplelessthan1330868,so4321*309=1335189and

(1335188)(1335189)=1,showingitsamultiplicativeinverse.

TokeepthemultiplicativeinverseconfinedtothesetGF(4321),wecandoclockworkarithmetic

saying43211082=3239.Notethat3239*1234=3996926mod4321=1,making3239the

multiplicativeinverseof1234inGF(4321).

b. Multiplicativeinverseof24140mod40902viaExtendedGCD:

Q
A1
A2
A3
B1
B2
B3

1
0
40902
0
1
24140
1
0
1
24140
1
1
16762
1
1
1
16762
1
2
7378
2
1
2
7378
3
5
2006
3
3
5
2006
10
17
1360
1
10
17
1360
13
22
646
2
13
22
646
36
61
68
9
36
61
68
337
571
34
2
337
571
34
710
1203
0

SinceB3becomes0,accordingthetotheExtendedGCDalgorithm,thereisnomultiplicative24140in
GF(40902).40902isntprime,sonotallnumbersnecessaryhavemultiplicativeinverses.

c. Multiplicativeinverseof550mod1769viaExtendedGCD:

3
4
1
1
1
1
1
4

A1
1
0
1
4
5
9
14
23
37

A2
0
1
3
13
16
29
45
74
119

A3
1769
550
119
74
45
29
16
13
3

B1
0
1
4
5
9
14
23
37
171

B2
1
3
13
16
29
45
74
119
550

B3
550
119
74
45
29
16
13
3
1

B3becomes1,endingthealgorithm,givingusamultiplicativeinverseof550mod1769=550.

Note:550*550=302500mod1769=1

3. 4.23,FourthEdition

a. (7x+2)(x2+5)

7x+2
2
x +5
x2+7x3=9x2+7x+7inZ10

b. (6x2+x+3)x(5x2+2)

=30x4+12x2+5x3+2x+15x2+6

=30x4+5x3+27x2+2x+6

=(30mod10)x4+5x3+(27mod10)x2+2x+6

=0x4+5x3+7x2+2x+6

=5x3+7x2+2x+6inZ10

4. 4.25,FourthEdition

a. GCD(x3+x+1,x2+x+1)overGF(2)

1) x3+x+1MODx2+x+1=

_x_+1_____

x2+x+1)x3+x+1

(x3+x2+x_)

x2+1

x2+x+1

2) GCD(x3+x+1,x2+x+1)=GCD(x2+x+1,x)

_x_+1__
x)x2+x+1
(x2______)

x+1

x___

Therefore,GCD(x3+x+1,x2+x+1)=1

b. GCD(x3+x+1,x2+1)overGF(3)

1. x3+x+1MODx2+1)

_x_
x2+1)x3+x+1
(x3+x_)
1

Therefore,GCD(x3+x+1,x2+1)=1
c. GCD(x5+x4+x3x2x+1,x3+x2+x+1)overGF(3)

1. x5+x4+x3x2x+1MODx3+x2+x+1

_x2_______________
x3+x2+x+1)x5+x4+x3x2x+1
(x5+x4+x3+x2_____)

x2x+1

2. GCD(x5+x4+x3x2x+1,x3+x2+x+1)=GCD(x3+x2+x+1,x2x+1)

x3+x2+x+1MODx+1

_x_+2___

x2x+1)x3+x2+x+1

(x3x2+x)

2x2+1

(2x22x+2)

2x+2

3. GCD(x3+x2+x+1,x2x+1)=GCD(x2x+1,2x+2)

_x+x
2x+2)x2x+1
(2x2+2x)
2x2+1
(2x2+2x)

x+1

_2___
4. x+1)2x+2

2x+2_

Therefore,GCD(x5+x4+x3x2x+1,x3+x2+x+1)=x+1
d. GCD(x5+88x4+73x3+83x2+51x+67,x3+97x2+40x+38)inGF(101)

1. x5+88x4+73x3+83x2+51x+67MODx3+97x2+40x+38

x2_+92x+98______________________
2
x +97x +40x+38)x5+88x4+73x3+83x2+51x+67

(x5+97x4+40x3+38x2)

92x4+33x3+45x2+51x+67

(92x4+36x3+44x2+62x )

98x3+x2+90x+67

(98x3+12x2+82x+88)

90x2+8x+80
3

2. GCD(x5+88x4+73x3+83x2+51x+67,x3+97x2+40x+38)=
GCD(x3+97x2+40x+38,90x282x+80)


_55x+22
90x2+8x+80)x3+97x2+40x+38

(x3+36x2+57x)

61x2+84x+38

(61x2+75x+43)

9x+96

Note:x3/90x2=(1/90)x=901x.Multiplicativeinverseof90(901)inGF(101)is55.

3. GCD(x3+97x2+40x+38,90x282x+80)=
GCD(90x2+8x+80,9x+96)

_10x_+85
9x+96)90x2+8x+80
(90x2+51x)
58x+80

(58x+80)
0

Remainderis0,thus
GCD(x5+88x4+73x3+83x2+51x+67,x3+97x2+40x+38)inGF(101)=9x+96

5. 4.27,FourthEdition

Q
A1(x)
A2(x)
A3(x)
B1(x)
B2(x)
B3(x)

1
0
x4+x+1
0
1
x3+x+1
x
0
1
x3+x+1
1
x
x2+1
x
1
x
x2 +1
x
1+x2
1

ViatheExtendedEuclidianAlgorithm,weseethatthemultiplicativeinverseofx3+x+1inGF(24),with
m(x)=x4+x+1is1+x2

Indeed:(x2+1)*(x3+x+1)=x5+x3+x2+x3+x+1=x5+2x3+x2+x+1=x5+x2+x+1

_x_________

x4+x+1)x5+x2+x+1

(x5+x2+x)

6. f(x)=10011110=x7+x4+x3+x2+x
g(x)=00100110=x5+x2+x
m(x)=100011010=x8+x4+x3+x

f(x)*g(x)=x5(f(x))+x2(f(x))+x(f(x))

x5*f(x)=01010100
1. x*f(x)=x*(10011110)=00111100
(+)x2*f(x)=01001100

(+)00011010

00100110
00011000

(+)x*f(x)=00100110
00111110
2. x2*f(x)=01001100
3. x3*f(x)=10011000

4. x4*f(x)=00110000
Thus,f(x)*g(x)modm(x)is00111110or:
(+)00011010

5 4 3 2
00101010
x +x +x +x +x
5
5. x *f(x)=01010100

Vous aimerez peut-être aussi