COMPUTER PROBLEMS: DAY 4 (1) Write a code to compute ab mod e via repeated squaring. (Or check that the code below works for various examples and try and understand how it works) Example: >>> modpower(2,100,101) 1 Code: def modpower(b,e,m): """modpower(b,e,m) = b^e mod m""" P = 1 S = b while e > 0: r = e%2 e = e/2 if r == 1: P = P*S % m S = S*S % m return P (2) What is 1431354254365645765686989879879797987 mod 7987987908098? (can you do it without the code?) (3) Write a program that computes the Euler phi function of a number n. You might start by doing this naively (counting all integers from 1 to n − 1 that are relatively prime to n) and then in a more sophisticated way by using the prime factorization of n. The formula for computing φ(n) in terms of prime factorization is available on Wikipedia. Compute φ for n = 1800 and n = 10403. (4) Use Fermat’s little theorem to check if 89809099 is prime. How about 75307568412715349903? How about 19605263919318560687? How about 493498225289812782346659016472943960812136641010 4686716378205258797050794163803176579697937348881157? Can you factor the ones that are not prime? 1