Homework Assignment 4
MCS 177: Computer Science I, Fall 2009
Due: Wednesday, October 21, at the beginning of class
- #4.2(a) on page 92
- #4.4 on page 94
- #4.11 on pages 99-100
- #4.15 on page 102
- Suppose n, m are integers which have no common factors. The
index of n mod m is the
smallest integer power i such that i>0 and n^i mod m = 1.
For example the index of 2 mod 7 is 3, since 2^1 mod 7 = 2, 2^2
mod 7 = 4, and 2^3 mod 7 = 8 mod 7 = 1. Write a procedure
that, given positive integers, n and m, will find the index of n
mod m. Be sure to use mod*.