<<

Modular : Exercises

1. Compute the following using the method of successive squaring: (a) 250 (mod 101) (b) 350 (mod 101) (c) 550 (mod 101).

2. Using an example from this lecture, compute 450 (mod 101) with no effort. How did you do it?

3. Explain how we could have predicted the answer to problem 1(a) with no effort.

4. Compute the following using the method of successive squaring: 50 58 44 (a) (3) in Z/101Z (b) (3) in Z/61Z (c)(4) in Z/51Z. 5000 5. Compute (78) in Z/79Z, and explain why this calculation is so very trivial. 4999 What is (78) in Z/79Z? 60 6. Fermat’s Little Theorem says that (3) = 1 in Z/61Z. Use this fact to 58 compute (3) in Z/61Z (see problem 4(b) above) without using successive squaring, but by computing the inverse of (3)2 instead, for instance by the Euclidean . Explain why this works.

7. We may see later on that the set of all a ∈ Z/mZ such that gcd(a, m) = 1 is a group. Let ϕ(m) be the number of elements in this group, which is often × × denoted by (Z/mZ) . It turns out that for each a ∈ (Z/mZ) , some power × of a must be equal to 1. The order of any a in the group (Z/mZ) is by definition the smallest positive integer e such that (a)e = 1. × (a) Compute the orders of all the elements of (Z/11Z) . × (b) Compute the orders of all the elements of (Z/17Z) . × 8. Continuation of the previous exercise. An element a ∈ (Z/mZ) is called a generator or primitive root modulo m if the order of a is the same as ϕ(m) = × × × |(Z/mZ) |. What are the generators of (a) (Z/11Z) , (b) (Z/17Z) . 9. Continuation of the previous exercise. Prove that if a is a generator of the × × e group (Z/mZ) then as sets (Z/mZ) = {(a) : 0 ≤ e ≤ ϕ(m)}. 10. Refer to exercise 7 for the definition of ϕ(m). The function ϕ is known as Euler’s phi-function.

(a) Prove that ϕ(p) = p − 1 for any prime p. (b) Find and prove a formula for ϕ(pq) where p, q are distinct primes. (c) Find a formula for ϕ(p2) where p is a prime. Can you generalize it to ϕ(pr) for any r?

1 11. Modify the Python code that converts a given input n to binary so that it accepts two inputs b, n and returns the base-b expansion of n. (Assume that b < 10.)

12. Write a Python program that accepts as input the number b and a string of base-b digits and returns the decimal equivalent. Assume that b < 10.

2