Beispiel #1
0
        public override double Solve(double variable)
        {
            double        i            = 2;
            List <double> primeFactors = new List <double> {
            };

            while (primeFactors.Count < variable)
            {
                if (Problem3.IsPrimeFactor(i, primeFactors))
                {
                    primeFactors.Add(i);
                }

                i++;
            }

            return(primeFactors.Last());
        }
Beispiel #2
0
        private static List <double> FindEvenDivisors(double max)
        {
            List <double> primeFactors = new List <double> {
            };

            for (double i = 2; i <= max; i++)
            {
                if (Problem3.IsPrimeFactor(i, primeFactors))
                {
                    primeFactors.Add(i);
                }
                else
                {
                    List <double> nPrimeFactors = FindPrimeFactors(i, primeFactors);
                    primeFactors = AddMissingFactors(nPrimeFactors, primeFactors);
                }
            }

            return(primeFactors);
        }