示例#1
0
        public long recursiveSolve(long number, long lastPrimeFactor)
        {
            PrimeTester tester = new PrimeTester();

            for (long i = lastPrimeFactor; i <= Math.Floor(Math.Sqrt(number)); i++)
            {
                if (number % i == 0 && tester.isPrime(i))
                {
                    return(recursiveSolve(number / i, i));
                }
            }
            //if no prime factors
            return(number);
        }
        public long solve()
        {
            PrimeTester tester      = new PrimeTester();
            long        candidate   = 0;
            int         primesFound = 0;

            while (primesFound < 10001)
            {
                candidate++;

                if (tester.isPrime(candidate))
                {
                    primesFound++;
                }
            }
            return(candidate);
        }