Пример #1
0
        public void SieveFirstPrime()
        {
            var firstPrime = 2;
            var sieve      = PrimeGenerator.GetPrimeEnumeratorEratosthenes(2);

            sieve.MoveNext();
            Assert.IsTrue(sieve.Current == firstPrime);
        }
Пример #2
0
        public void SieveFirstPrimes()
        {
            var firstPrimes = new[] { 2, 3, 5, 7, 11, 13, 17, 19, 23 };
            var sieve       = PrimeGenerator.GetPrimeEnumeratorEratosthenes(24);

            sieve.MoveNext();

            foreach (var prime in firstPrimes)
            {
                Assert.IsTrue(prime == sieve.Current);
                sieve.MoveNext();
            }
        }