예제 #1
0
        public long Solve()
        {
            var sum = 0L;
            var primes = new Prime(Limit / 2).PrimeList;

            var count = primes.Count();

            for (var i = 0; i < count; i++)
            {
                if (primes[i] * primes[i] > Limit)
                {
                    break;
                }

                for (var j = i + 1; j < count; j++)
                {
                    if (primes[i] * primes[j] > Limit)
                    {
                        continue;
                    }

                    sum += this.MaxSumLimit(primes[i], primes[j], Limit);
                }
            }

            return sum;
        }