1. Find the smallest distance that can be measured with a (unmarked) meter stick and an (unmarked) yard stick. 1 meter = 39.37 inches. 1 3600 3937 3600 10 337 3600 3370 1 230 337 230 2 107 230 214 6 16 107 96 1 11 16 11 2 5 11 10 5 1 5 5 0 1 10 1 2 6 1 2 5 1 1 11 12 35 222 257 736 3937 0 1 10 11 32 203 235 673 3600 So -736 36.00 + 673 39.37 = 0.01 So lay out 673 of the meter sticks and come back with 736 or the yard sticks and the difference will be 0.01 inches. 2. Given n = 11663 and r = 7 encode the message: I A M S I C K 9 1 13 19 9 3 11 9 -> Mod[ 9^7, 11663] = 1139 1 -> Mod[ 1^7, 11663] = 1 13 -> Mod[13^7, 11663] = 1577 19 -> Mod[19^7, 11663] = 7756 9 -> Mod[ 9^7, 11663] = 1139 3 -> Mod[ 3^7, 11663] = 2187 11 -> Mod[11^7, 11663] = 9961 3. Break the code and decipher the message. 7133 8088 9475 8088 1577 8147 The whole security of the RSA code is that factoring is difficult. If we can factor 11663 the code is broken. 11663 = 107*109. We have to find the inverse of r = 7 mod (p-1)(q-1) = 11448 We know 7 has an inverse mod 11448 because GCD(7,11448) = 1. We find the inverse using the Euclidean Algorithm. 1635 7 11448 11445 ----- 2 3 7 6 --- 3 1 3 3 --- 0 1635 2 3 1 1635 3271 11448 0 1 2 7 3271 7 - 2 11448 = 1 And 3271*7 = 22897 = 1 mod 11448 The private key to crack the code is 3271. f[x_] := Mod[x^3271,11663] Just to check we try the encryption of I AM SICK f[{1139,1,1577,7756,1139,2187,9961}] = {9, 1, 13, 19, 9, 3, 11} I A M S I C K So it seems to work. To break the code f[{7133,8088, 9475,8088,1577,8147}] = {7, 15, 8, 15, 13, 5} G O H O M E