Beispiel #1
0
        private long GetLargestPrimeFactorFromEvenNumber(long number)
        {
            while (SharedMathOperations.IsEvenNumber(number))
            {
                number = number / 2;
            }

            return(number);
        }
Beispiel #2
0
 public long GetLargestPrimeFactorFromNumber(long number)
 {
     if (SharedMathOperations.IsEvenNumber(number))
     {
         return(GetLargestPrimeFactorFromEvenNumber(number));
     }
     else
     {
         return(GetLargestPrimeFactorFromOddNumber(number));
     }
 }
 public int SumEvenNumbersFromAListOfNumbers(List <int> numbers)
 {
     return(numbers.Where(number => SharedMathOperations.IsEvenNumber(number)).Sum());
 }