advertisement

Summer 2008 COT 3100 Homework #2 Given: 5/29/08 Due: 6/6/08 (in recitation) 6) Prove that p is irrational, where p is any prime number. 7) When dividing integer a by integer b, we write a = bq + r, where q and r are integers such that 0 ≤ r < b. Prove that if a > b, then a > 2r. 8) Use the Euclidean Algorithm to determine the GCD of 1365 and 286. 9) Use the Extended Euclidean Algorithm to find integers x and y that satisfy the following equation: 1365x + 286y = gcd(1365, 286). 10) Prove that the equation 323x + 204y = 1000000 has no integer solutions for x and y. Optional Programming Homework If you do this question, you don't have to do questions 8, 9 and 10. Write a program that solves equations of the form Ax + By = C, where A, B and C are given positive integers. Your program should output all non-negative integer solutions for x and y. If there are no solutions, then output a single line saying so. Note: This program has a practical application in that a common problem people must solve is of the following type: Each object of type one costs A dollars and each object of type two costs B dollars. I must spend exactly C dollars. What are my different options for satisfying these constraints? Sample Run A Please enter A, B and C. 6 8 100 Here are all the solutions: x = 2 y = 11 x = 6 y = 8 x = 10 y = 5 x = 14 y = 2 Sample Run B Please enter A, B and C. 12 17 100 This equation has no solutions.