public void Solution() { int idPrime = 1; //Id of prime number in sequence of prime numbers long prevNumber = number; //Variable reciving value of _number to each iterration while (!number.IsPrime()) { number = number % PrimeNumbers.GetElementAt(idPrime) == 0 ? number / PrimeNumbers.GetElementAt(idPrime) : number; idPrime++; if (prevNumber != number) { prevNumber = number; idPrime = 1; } } largestFactor = number; }
public void Solution() { primeNumber = PrimeNumbers.GetElementAt(index); }