Final solution for problem 5
Final solution for problem 6 and 7. Prime check function.