Problem 4's algorithm is incorrect.
Here is a solution [url removed, login to view]~amir/m10a_ans.pdf.
Rewrite it and also add an example and correctness.
Problem 2's has typos and some variables are not in the right place. For example you should call the BinaryExponentiation on (10,b,n-1) not (a,b,n).
Proof read it.
Finally, the local search, you already know what's wrong with it.