 There is no need to test all values of for applying the method.In principle, it suffices to test only prime divisors.This needs to have a table of prime numbers that may be generated for example with the sieve of Eratosthenes.