Various improvements; added gcd and totient; fixed bug in is_prime and nth_prime dealing with negatives