コード例 #1
0
        public long Run()
        {
            var maximum = 1000000 - 1;
            var primes  = EratosthenesPrimes.GetArray(maximum);

            return(Enumerable.Range(2, maximum - 1)
                   .AsParallel()
                   .Where(n => !primes [n - 1])
                   .Where(p => p.GetCyrcles().All(c => !primes [c - 1]))
                   .Count());
        }
コード例 #2
0
 public long Run()
 {
     return(EratosthenesPrimes.Get(2000000 - 1)
            .Sum());
 }