COMPUTER PROBLEMS: DAY 9 (1) The following program computes numbers a, b such that gcd(m, n) = am + bn: def gcdlc(m,n): # Returns the GCD of m and n and solves: return lcomb(m,n,1,0,0,1) # am + bn = GCD - returns GCD,a,b (2) (3) (4) (5) (6) (7) def lcomb(m,n,c,d,e,f): # Works for the module gcdlc if m==0: return (n,e,f) (q,r) = divmod(n,m) return lcomb(r,m,e-c*q,f-d*q,c,d) Try it out with a few numbers to convince yourself that it works. The code is available under the link GCD so you don’t have to retype it. Use gcdlc to find the the inverses of 117 mod 103, 222 mod 17947 and 1234567 mod 1812647. My date of birth was encoded using the function 1234567 ∗ x mod 1812647. If f (x) = 1201707, what is my date of birth x? Write a program that computes the inverse of a mod b. Check that it works for 117 mod 103 and for 222 mod 17947. What happens for 123 mod 309? Solve 65657657x + 21344345y = 35. Write a program that computes the Euler φ-function of a number. Check the primality of 6729666661892275969920776111392403188817419947431061112285631059 2958996608328034853959426423978406631799362404503567631824578953 1296909516217213498095053711772524666022581387760188338650782777 9116439308493645997507875151037556959270506772855047639570532178 664545403459314173331215951100599922480503073 and 9220939163271223506915656118129351944723693985717774310902508038 1459932656036036841193375482690040300847019381210643195328564705 1165929947785667825727076600220604523671480307136132801582623709 9070081923483340037574706572019917706633406585955636245547080346 105167946722881762548740609683540535733810711 by using the Miller-Rabin primality test. Code to run the test is available under the Miller-Rabin link. To test the number p, you will run the command RabinMillerWitness(n,p), where n is a randomly chosen number between 1 and p. If the command returns True, this indicates that the number p is definitely composite. If False is returned, p might be prime. If a number is 1 COMPUTER PROBLEMS: DAY 9 2 composite, each run of the test with a randomly chosen n has at least a 3/4 chance of detecting its compositeness. How many times do we need to run the test with randomly chosen n to ensure that there is a less than 10−6 chance that our number is composite? (8) Use the Miller-Rabin primality test to show that 62053846878403210970658094587707319882485843910616405367733268157 53765809499940537294085357169199711147920569824675476745035392116 06731194467510475029979751442820291010376594186219112647828938696 64094777783075378078336570929211130686256738627608375490961668321 91043170169004686248759932455390221689577333661469039508432104879 87737245141240558041162299137306658860984984351998042383930612874 24721075610224970354879262725006660820248111497109825090573261993 92672791611670074369788799939006497029232856760143426084185148021 03343576787020181133534346834627270559474882283043533983093455162 29526898635814903 is composite. Try to compute φ for this number. When you get stuck, ask for help. (9) Inside the Miller-Rabin code is a function that generates large prime numbers. (Specifically, these are industrial primes: numbers that have an extremely high probability of being prime.) Try generating some large primes and using these to run the RSA algorithm.