# 1 1 0 1 1 0 this is the plaintext chapter 3

• Lecture Slides
• 181
• 94% (18) 17 out of 18 people found this document helpful

This preview shows page 67 - 71 out of 181 pages.

1 , 1 , 0 , 1 , 1 , 0 This is the plaintext. Chapter 3 - Mathematica Problem 1. In[89]:= GCD 8765 , 23485 Out[89]= 5 Problem 2. (a) In[90]:= ExtendedGCD 65537 , 3511 Out[90]= 1 , 1405 , 26226 The gcd is 1, and x -1405, y 26226. Part (b) In[91]:= 17 1405 Out[91]= 23885 In[92]:= 17 26226 Out[92]= 445842 Therefore, x -23885, y 26226 is one solution. Problem 3. In[93]:= PowerMod 3 , 1234567 , 100000 Out[93]= 40587 Problem 4. In[94]:= Solve 314 x 271 , Modulus 11111 , x , Mode Modular Out[94]= Modulus 11111 , x 10298 The answer is 10298. Problem 5. Note that In[95]:= GCD 216 , 606 Out[95]= 6 Therefore there are 6 solutions. In[96]:= Solve 216 x 66 , Modulus 606 , x , Mode Modular Out[96]= Modulus 606 , x 48 , Modulus 606 , x 149 , Modulus 606 , x 250 , Modulus 606 , x 351 , Modulus 606 , x 452 , Modulus 606 , x 553 Problem 6. In[97]:= ChineseRemainderTheorem 17 , 18 , 19 , 101 , 201 , 301 Out[97]= 61122 Problem 7. 63
In[98]:= PowerMod 2 , 390 , 391 Out[98]= 285 In[99]:= EulerPhi 391 Out[99]= 352 In[100]:= PowerMod 2 , 352 , 391 Out[100]= 1 Therefore, j 352 works. Problem 8. Pick a random x,say x 123. Now compute y via the Chinese Remainder Theorem as follows: In[101]:= ChineseRemainderTheorem 123 , 123 , 84047 , 65497 Out[101]= 5495329171 Call this y. The square of y will be congruent to 123ˆ2 mod each of the primes, therefore mod their product. In[102]:= PowerMod % , 2 , 84047 65497 Out[102]= 15129 In[103]:= PowerMod 123 , 2 , 84047 65487 Out[103]= 15129 Therefore xˆ2 yˆ2 mod 84047*65497. Problem 9. In[104]:= FactorInteger 65537 1 Out[104]= 2 , 16 Therefore 2 is the only prime factor of p-1. The method of Exercise 10 says that we need to raise 3 to the (p-1)/2 power: In[105]:= PowerMod 3 , 65536 / 2 , 65537 Out[105]= 65536 Since this is not 1, Exercise 10 tells us that 3 is a primitive root for 65537. Problem 10. (a) We follow the procedure from pages 384-385. In[106]:= Inverse 1 , 2 , 4 , 1 , 5 , 25 , 1 , 14 , 196 Out[106]= 35 18 , 28 27 , 5 54 , 19 36 , 16 27 , 7 108 , 1 36 , 1 27 , 1 108 Multiply by 108: In[107]:= % 108 Out[107]= 210 , 112 , 10 , 57 , 64 , 7 , 3 , 4 , 1 Multiply by 108ˆ{-1} mod 101: In[108]:= Mod PowerMod 108 , 1 , 101 % , 101 Out[108]= 30 , 85 , 88 , 64 , 38 , 100 , 87 , 86 , 29 This is the inverse mod 101. Part (b). There is no inverse mod p exactly when p divides the determinant: 64
In[109]:= Det 1 , 2 , 4 , 1 , 5 , 25 , 1 , 14 , 196 Out[109]= 324 In[110]:= FactorInteger 324 Out[110]= 2 , 2 , 3 , 4 Therefore, the matrix is not invertible mod 2 and mod 3. Problem 11. Since p 34807 is 3 mod 4, we can raise to the (p 1)/4 power: In[111]:= PowerMod 26055 , 34807 1 / 4 , 34807 Out[111]= 33573 The other square root is In[112]:= Mod 33573 , 34807 Out[112]= 1234 Problem 12. First, factor the modulus: In[113]:= FactorInteger 2325781 Out[113]= 523 , 1 , 4447 , 1 Both primes are 3 mod 4,so we find square roots by raising to the (p 1)/4 power: In[114]:= PowerMod 1522756 , 523 1 / 4 , 523 Out[114]= 335 In[115]:= PowerMod 1522756 , 4447 1 / 4 , 4447 Out[115]= 1234 Now recombine using the Chinese Remainder Theorem: In[116]:= ChineseRemainderTheorem 335 , 1234 , 523 , 4447 Out[116]= 437040 In[117]:= ChineseRemainderTheorem 335 , 1234 , 523 , 4447 Out[117]= 1234 In[118]:= ChineseRemainderTheorem 335 , 1234 , 523 , 4447 Out[118]= 2324547 In[119]:= ChineseRemainderTheorem 335 , 1234 , 523 , 4447 Out[119]= 1888741 These are the four square roots. Problem 13. In[120]:= PowerMod 48382 , 83987 1 / 4 , 83987 Out[120]= 60555 In[121]:= PowerMod 60555 , 2 , 83987 Out[121]= 35605 This is -48382 mod 83987: In[122]:= Mod 48382 , 83987 Out[122]= 35605 65
Therefore, we found the square root of -48382 mod 83987, rather than the square root of 48382. This is because 48382 does not have a square root mod 83987. Chapter 6 - Mathematica Note: There are two commands that can be used to change text to numbers: num1 and txt2num1. They are the same function. Similarly, both alph1 and num2txt1 change numbers back to text and are the same function.