Exemplo n.º 1
0
        public void FindMore()
        {
            List <int> candidates = new List <int>();

            for (int index = 0; index < field; ++index)
            {
                var candidate = index + Offset;

                bool found = false;

                foreach (var prime in Primes)
                {
                    if (candidate % prime == 0)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    candidates.Add(candidate);
                }
            }

            Primes.AddRange(candidates);
            Offset += field;
        }