Add code for problem 3, a helper math library and a primality test function