hw2 by ashrafp

VIEWS: 7 PAGES: 1

									                  CSCI 3710: Discrete Structures
           Assignment 2: Algorithms and Number Theory
                                      Due Feb. 27

Written Exercises:
1. Exercise 2.2.10 in the textbook.
   You can either use the definition of O in the textbook (using c and k) or the limit
   definition I covered in class, but give an actual proof of some sort instead of just an a
   hand-waving argument.

2. Exercise 2.2.24 in the textbook, parts a) and b).

3. Exercise 2.4.4 in the textbook.

4. Exercise 2.4.6 in the textbook.

5. Exercise 2.4.40 in the textbook.

6. Exercise 2.6.8 in the textbook.
   Use the Euclidean algorithm, and show your work.

7. Exercise 2.6.18 in the textbook.
   Show your work.


Programming Exercise: Generating Pseudorandom Numbers

The linear congruential method is often used to generate random numbers, based on
some modulus m, some multiplier a, and some increment c.

You are to write a program (in either C, C++, Visual Basic, or Java) that:
   1. Prompts the user for values of modulus m, multiplier a, increment c, and seed x0.
   2. Uses the linear congruential method to compute and print out the first m numbers
       in the sequence.

For example:

Enter M: 9
Enter A: 7
Enter C: 4
Enter seed: 3
Numbers generated:
7 8 6 1 2 0 4 5 3

Turn in (on diskette or through email) an electronic copy of the source code for your
program.

								
To top