Updated primes.py

Optimized primeFactors