private static int GreatestCommonDivisorAlgorithm(out long ticksSpentOnCalculations,
                                                          GreatestCommonDivisorOfTwoNumbers gcd, int firstNumber, int secondNumber, params int[] numbers)
        {
            var stopWatch = new Stopwatch();

            stopWatch.Start();

            var greatestCommonDivisor = GreatestCommonDivisorAlgorithm(gcd, firstNumber, secondNumber, numbers);

            stopWatch.Stop();
            ticksSpentOnCalculations = stopWatch.Elapsed.Ticks;

            return(greatestCommonDivisor);
        }
        private static int GreatestCommonDivisorAlgorithm(GreatestCommonDivisorOfTwoNumbers gcd, int firstNumber,
                                                          int secondNumber, params int[] numbers)
        {
            var firstSecondDivisor = gcd.Invoke(firstNumber, secondNumber);

            if (numbers.Length == 0)
            {
                return(firstSecondDivisor);
            }

            numbers[0] = gcd.Invoke(firstSecondDivisor, numbers[0]);

            for (int i = 1; i < numbers.Length; ++i)
            {
                if (numbers[i - 1] == -1)
                {
                    numbers[i - 1] = 0;
                }

                numbers[i] = gcd.Invoke(numbers[i - 1], numbers[i]);
            }

            return(numbers[numbers.Length - 1]);
        }