Math/CS 467 (Lesieutre) Homework 2 September 9, 2020 Submission instructions: Upload your solutions, minus the code, to Gradescope, like you did last week. Email your code to me as an attachment at
[email protected], including the string HW2 in the subject line so I can filter them. Problem 1. Both prime numbers and perfect squares get more and more uncommon among larger and larger numbers. But just how uncommon are they? a) Roughly how many perfect squares are there less than or equal to N? p 2 For a positivep integer k, notice that k is less than N if and only if k ≤ N. So there are about N possibilities for k. b) Are there likely to be more prime numbers or perfect squares less than 10100? Give an estimate of the number of each. p There are about 1010 = 1050 perfect squares. According to the prime number theorem, there are about 10100 10100 π(10100) ≈ = = 1098 · log 10 = 2:3 · 1098: log(10100) 100 log 10 That’s a lot more primes than squares. (Note that the “log” in the prime number theorem is the natural log. If you use log10, you won’t get the right answer.) Problem 2. Compute g = gcd(1661; 231). Find integers a and b so that 1661a + 231b = g. (You can do this by hand or on the computer; either submit the code or show your work.) We do this using the Euclidean algorithm. At each step, we keep track of how to write ri as a combination of a and b.