CSCI 3104 - Algorithms - Fall 2013

Problem Set #2

Due: 11am, Sep 17th, 2013



1. Suppose you wanted to determine if a decimal number is divisible by 99. Give a quick method for doing this. (Hint: convert the number to base-100 by grouping pairs of digits together.) Justify your answer.

2. Text problem 1.12. Use only paper. Show your work.

3. Text problem 1.13. Use only paper. Show your work.

4. One of the largest naturally-occurring integer constants we know of is $M$=808017424794512875886459904961710757005754368000000000. This is the size of an object of mathematics that is just there (humans didn't invent it).
Just for fun, compute $M^M \bmod 2013$. Use a computer for this one; include source code with your solution.

5. Text problem 1.18. Show your work.

6. Suppose I have an $n$-bit positive number $N$ and I want to print it. What is the running time to print $N$ if
(a) I output $N$ in decimal?
(b) I output $N$ in binary?
(c) I output $N$ in unary?