CSCI 5454 - Algorithms - Spring 2015

Problem Set #2

Due: 1pm, Feb 18th, 2015



1. Suppose you wanted to determine if a decimal number is divisible by 101. 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 22015$. 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 integer $N$ stored in memory in binary, and I want to print it. What is the running time to print $N$ if
(a) I output $N$ in hexadecimal?
(b) I output $N$ in binary?
(c) I output $N$ in unary?