Problem 1

Updated solution to solve problem in the general case.
Problem 3

Updated solution now allows non-terminating prime generator.