Largest prime factor iterative implementation