Exemple #1
0
        public long Solve()
        {
            GenPrimes prime_library = new GenPrimes();

            bool[] primes = prime_library.GetPrimes(this.maxValue);
            long   result = 0;

            for (long i = 0; i < this.maxValue; i++)
            {
                if (primes[i] == false)
                {
                    result += i;
                }
            }
            return(result);
        }
Exemple #2
0
        public long Solve()
        {
            GenPrimes prime_library = new GenPrimes();

            bool[] primes = prime_library.GetPrimes(1000000);
            int    result = 0;

            for (int i = 0; i < 1000000; i++)
            {
                if (primes[i] == false)
                {
                    result += 1;
                    if (result == nthPrime)
                    {
                        return(i);
                    }
                }
            }
            return(0);
        }