Solutions to Homework 4
March 4, 2007
The following exercises are from Rosen.
2.4: 44
Since
a
≡
b
mod
m
, it follows that
m

(
a

b
). Thus, there is a
d
such that
(
a

b
) =
dm
. It follows that (
a

b
)
c
=
dmc
. Thus,
mc

(
a

b
)
c
=
ac

bc
. So
ac
≡
bc
mod
mc
.
2.4: 46
Again, since
a
≡
b
mod
m
, it follows that
m

(
a

b
). To show that gcd(
a, m
) =
gcd(
b, m
), it suﬃces to show that
CD
(
a, m
) =
CD
(
b, m
). (Recall that
CD
(
a, b
) is the
set of common divisors of
a
and
b
, and gcd(
a, b
) is the largest element of
CD
(
a, b
).) So
suppose that
c
∈
CD
(
a, m
). We want to show that
c
∈
CD
(
b, m
). Since
c
∈
CD
(
a, m
),
c

a
and
c

m
. Since
m

(
a

b
), by the transitivity of divisibility,
c

(
a

b
). Since
c

(
a

b
) and
c

a
it follows that
c

b
. Since
c

b
and
c

m
, it follows that
c
∈
CD
(
b, m
).
This shows that
CD
(
a, m
)
⊆
CD
(
b, m
). A completely symmetric argument shows that
CD
(
b, m
)
⊆
CD
(
a, m
). It follows that
CD
(
a, m
) =
CD
(
b, m
), as desired.
2.5: 20
First note that 123 = 22 mod 101 and 1001 is (1111101001)
2
(the subscript 2
means “in binary”). In the algorithm
x
is initially set to 1 and
power
is initally set to 22
(since 22 = 123 mod 101). We go through the loop in Algorithm 5 10 times, since 1001
has 10 digits when written in binary. Here are the successive values of
x
and
power
after
each iteration through the loop, as we run the algorithm:
•
x
= 22;
power
= 22
×
22 = 80 mod (101) (since
a
0
= 1 –
a
0
is the last digit in the
binary expansion of 1001)
•
x
= 22;
power
= 80
×
80 = 6400 = 37 mod (101) (since
a
1
= 0)
•
x
= 22 mod 101;
power
= 37
×
37 = 1369 = 56 mod (101) (since
a
2
= 0)
•
x
= 22
×
56 = 1232 = 20 mod 101;
power
= 56
×
56 = 3136 = 5 mod (101) (since
a
3
= 1)
•
x
= 20 mod 101;
power
= 5
×
5 = 25 mod (101) (since
a
4
= 0)
1