
CS160, Fall 2009: Homework 4 (theory)
Due: October 1,2
1. Integer division
What are the quotient and remainder when:
(a) 44 is divided by 8?
(b) -129 is divided by 19?
(c) -1 is divided by 3
Note that we are using the mathematical definition, rather than the Java implementation.
2. Decide whether each of these integers is congruent to 5 modulo 17:
80, 103, -29, -122.
3. Cryptography
Encrypt the message “HELLO WORLD” by translating the letters into numbers, applying the encryp-
tion function given, and then translating the numbers back into letters.
(a) f(p) = (p+3) mod 26
(b) f(p) = (p+7) mod 26
4. Primes
Determine whether each of these integers is prime:
19, 27, 93, 101, 107
5. Find the prime factorization of each of these integers:
39, 81, 101, 143, 289.
6. Which positive integers less than 24 are relatively prime to 24?
7. GCDs and LCMs
What are the greatest common divisors of these pairs of integers:
(a) 22·33·56,25·33·52
(b) 2 ·3·5·7·11 ·13,39·11 ·1714
(c) 22·7,53·13
(d) 17,1717
(e) 2 ·3·5·7,2·3·5·7
8. What is the least common multiple of each pair in the previous question?
9. Find gcd(1000,625) and lcm(1000,625) and verify that gcd(1000,625) ·lcm(1000,625) = 1000 ·625
10. If the product of two integers is 27·38·52·711 and their greatest common divisor is 23·34·5, what is
their least common multiple?
11. Base Conversions Convert these integers from decimal notation to binary notation:
(a) 221
(b) 505