optimized largest prime factor finder