CS4390/5390 Fall 2013 Shirley Moore, Instructor Homework 1 Due Thursday, Sept 12 Name _____________________________________________ 1. Given an undirected graph G, a Hamiltonian cycle is a cycle that visits each vertex exactly once, except for the starting and ending vertex, which is the same. A Hamiltonian path is a path that visits each vertex exactly once. Consider the following two decision problems: HamCyc : Given a graph G = (V,E) with at least three vertices, does G contain a Hamiltonian cycle? HamPath: Given a graph G = (V,E) with at least two vertices, does G contain a Hamiltonian path? a. Prove that HamPath is reducible in polynomial time to HamCyc. (Hint: Given a graph G for the HamPath problem, construct a graph H by adding an extra vertex w to G and connecting w with each vertex in G. Claim: G has a Hamiltonian path if and only if H has a Hamiltonian cycle). b. Prove that HamCyc is reducible in polynomial time to HamPath. (Hint: Given a graph G for the HamCyc problem, let m be the number of edges in G and number the edges e1, e2, … em. Construct graphs H1, H2, …, Hm as follows: For each Hi, start with G and let v and w be the endpoints of edge ei. Add new vertices v’ and w’ of degree 1 that connect to v and w, respectively. Claim: G has a Hamiltonian cycle if and only if at least one Hi has a Hamiltonian path). 2. Please explain why it follows from X = x (mod b) and Y = y (mod b) that XY = xy (mod b). (Hint: You may want to use that X = x (mod b) means that X = b*i + x for some integer i). 3. Use the result of problem 2 to find the modular product below by hand but doing as little work as possible. Please show all of your work and explain your steps. 8 * 16 * 173* 7015 * 51 * 1431 * 40 * 701 (mod 9) 4. Find 320984 (mod 7) by hand but by doing as little work as possible. Please show all of your work and explain your steps. 5. You can use Fermat's little theorem to show that a number is NOT prime. For example, try the choices a=13674 and p=21581. What is ap-1 (mod p) ? Is p prime? Explain your answer. Can you show similarly that 452861 and 8462427 are not prime?