Math 4330, Extra Credit, due 2/17
1
Dene a function f : N N by
f (n) =
3n + 1,
n/2,
if n is odd,
if n is even.
Use the notation f k to denote the composition of f with itself k times, so that f 2 (n) =
f (f (n), f 3 (n) = f (f (f (n), and so on. There is
Math 4330, Homework 7, 3/10/2014 : Due 3/24/2014
1
1. (10 points) Write a function powmod(b,e,N) which uses the method of repeated squarings to compute be mod N . A test case for this is powmod(1234, 5678, 1984) which
should return 1152. You may use Ferma
Math 4330, Homework 6, 2/24/2014 : Due 3/10/2014
1
Read 4.5.4 up to and including page 386.
1. Suppose N is an odd composite number and S = cfw_(x, y ) Z2 : x2 y 2 (mod N) .
(i) Prove that if (u, v ) is chosen randomly from S , there is at least a 50% cha
Math 4330, Homework 5, 2/19/2014 : Due 2/24/2014
1
1. Show that if u > v then (u mod v ) u/2.
2. Use the previous result to prove that in Algorithm A, Step A2 is executed no more
than 1 + 2 log2 u times. (In particular, it follows that the Euclidean Algor
Math 4330, Homework 5 Solutions
1
1. Show that if u > v then (u mod v ) u/2.
Solution: Case I: If v u/2, then since (u mod v ) < v , it follows immediately that
(u mod v ) < v u/2.
Case II: Suppose v > u/2, and write u = qv + r with q, v Z and 0 r < v . S
Math 4330, Homework 4, 2/14/2014 : Due 2/19/2014
1
Read 4.5.2 up to and including Algorithm A. Then do the following:
1. Write a function gcd(u,v) which computes and returns the gcd of two integers using
Algorithm A.
2. Determine the average number of tim
Math 4330, Homework 3, 2/5/2014
1
Read 4.3.3.C (up to the middle of page 306 Do a web search to learn a little about
complex numbers in Python (2.7). Then do the following:
1. Write a function print_comp_list(zlist) which takes as input a list zlist of co
Math 4330, Homework 3, 2/5/2014
1
Read 4.3.3.C (up to the middle of page 306 Do a web search to learn a little about
complex numbers in Python (2.7). Then do the following:
1. Write a function print_comp_list(zlist) which takes as input a list zlist of co
Math 4330, Homework 2, 1/31/2014
1
Let K be a positive integer and = exp(2i/K ).
1.
Show that each of 0 , 1 , 2 , . . . , K 1 is a K -th root of unity.
2.
Show that 0 + 1 + + K 1 = 0.
1
This document is copyright c 2014 Chris Monico, and may not be reprod
Math 4330, Homework 2, 1/31/2014
1
Let K be a positive integer and = exp(2i/K ).
1. Show that each of 0 , 1 , 2 , . . . , K 1 is a K -th root of unity.
Solution:
Let j be an integer satisfying 0 j < K , and = j . Then K = Kj = exp(2Kji/K ) =
(exp(2i)j = 1
Math 4330, Homework 1, 1/22/2014
1
1.
Without converting to base-10, add the binary numbers 101100011112 and 110101000102 .
2.
Without converting to base-10, multiply the numbers 10112 and 1102 .
3.
Convert the numbers above to base-10 and check your resu
Math 4330, Homework 1, 1/22/2014
1
1. Without converting to base-10, add the binary numbers 101100011112 and 110101000102 .
Solution:
1
1
1
1
1
1
1
10110001111
11010100010
110000110001
2. Without converting to base-10, multiply the numbers 10112 and 1102
Math 4330, Homework 8, Due 3/31/2014
1
Read 4.5.4, Primality Testing, pp. 391396.
1. Write a function isprime(n, numtests) which performs Algorithm P upto numtests
times to determine if n is (probably) prime. It should return False if one of the
tests ind