Changed method of finding largest prime factor