Download MS Word

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

List of prime numbers wikipedia , lookup

Positional notation wikipedia , lookup

Location arithmetic wikipedia , lookup

Quadratic reciprocity wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Transcript
ECE-C490 Security in Computing
Winter term 2005
Homework #5
Due in class on Tuesday, February 15th
1. Find the result of the following:
Remember – we define remainders as positive!
a. –7 mod 3; -7/3 = -2, r(-1). Subtract one from the multiplier to obtain a
remainder greater than 0: -3*3 = -9; to get –7, we need to add 2. Therefore
–7 mod 3 = +2.
b. 7 mod 3; 7/3 = 2, r +1.
c. –23 mod 5; similar to part (a). = +2.
d. 23 mod 5; 23/5 = 4, r +3.
2. If it is 12pm now, what time would it be 3733 hours from now?
Simply calculate 3733 mod 24. Since you don’t need to know what day it is, the
“leftover” number of hours once you divide by 24 is what you need to figure out
the time after 3733 hours have passed. 3733 mod 24 is 13; therefore, adding 13 to
12pm, it will be 1am.
3. Amazon.com keeps track of orders using an 11-digit ID number. 10 of these digits
are the real identification number, and the 11th digit is the mod9 check digit.
Given the two identification numbers below, which one of them is valid according
to the scheme described above, and which is not?
39539881642
39559881642
I didn’t specify whether the first or last digit is the check digit; as it turns out
(entirely by coincidence), if you use the first as the check digit, the second
number will be the valid order number; if you use the last, the first number will be
the valid order number. Either way, this problem is easily solved by taking the
entire number except the check digit and dividing it mod 9. If you don’t have a
calculator that can easily do this, you should be able to do the calculation
yourself. Taking the first number as an example:
3953988164 / 9 = 439332018.22222222222222222222222
We only care about the fractional portion of the result (the remainder), which we
multiply by 9 to obtain the integer remainder:
(0.22222222222222222222222) * 9 = 2, which as you can see is the last digit
appended to the first number, which indicates that the first number is valid. If you
do the same procedure for the second number, you’ll get a predicted check digit
of 4, but the actual check digit is 2. Therefore the second number is not valid.
4. Use the Gaussian trick to solve the following linear congruencies:
Remember – your final result must be positive!
a. 21X ≡ 1 (mod 92)
X ≡ 1/21 ≡ (1 – 92)/21 ≡ -91/21 ≡ -183/21 ≡ -275/21 ≡ -367/21 ≡ -459/21
= -153/7 ≡ -245/7 = -35
but
0 < x < 92, so x = -35 + 92 = 57.
b. 15X ≡ 2 (mod 49)
X ≡ 2/15 ≡ (2 – 49)/15 ≡ -47/15 ≡ -96/15 = -32/5 ≡ -81/5 ≡ -130/5 = -26
but
0 < x < 49, so x = -26 + 49 = 23.
5. Use Euclid’s Algorithm to solve the following linear congruencies:
a. 27X ≡ 1 (mod 8)
27x = 8y + 1
y = (27x – 1)/8
y = 3x + (3x – 1)/8z
8|(3x – 1)  x = 3
b. 18X ≡ 3 (mod 6)
There is no solution to this problem. For a solution to exist, 18 and 6
would have to be relatively prime; however, (18,6) does not equal 1.