MCS-177, Intro. to Computer Science I, Fall2008
Homework Assignment 4
Due: Monday, Oct. 13
- Do exercise 4.11 on pages 99-100.
- Do exercise 4.14 on pages 101-102.
- Do exercise 4.15 on pages 103-104.
- Do exercise 4.16 on page 103.
- 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*.
MCS 177 homepage