gcd and prime factors, explain versions using writerT