Added helper function findPrimeFactors(n) and replaced for-loops with
list comprehensions; genPrimes generates primes up the sqrt of n, as there
can be no factor that is greater than the sqrt of a number.