major changes to the primes()/primes2() and kgv() functions