public void Primes() { var expected = 15485863; var actual = PrimeHelper.Primes().Skip(1000000 - 1).First(); Assert.Equal(expected, actual); }
public void PrimesRepeatability() { var primes = PrimeHelper.Primes().Take(20).ToArray(); var p2 = PrimeHelper.Primes().Take(20).ToArray(); for (var i = 0; i < p2.Length; i++) { Assert.Equal(primes[i], p2[i]); } }
public void PrimesMax() { var last = 0L; var count = 100000000L; try { foreach (var prime in PrimeHelper.Primes(count)) { last = prime; count++; } } catch { }; Assert.Equal(2147483647, last); Assert.Equal(105097565, count); }