solution based on python version, keeping track of primes
actually test for primeness of factors