public void GetNthPrimeNumber_10001_13() { var expected = 104743; var actual = P007.GetNthPrimeNumber(10001); Assert.AreEqual(expected, actual); }
public void GetNthPrimeNumber_6_13() { var expected = 13; var actual = P007.GetNthPrimeNumber(6); Assert.AreEqual(expected, actual); }
/* * Problem 10: Summation of primes * The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. * Find the sum of all the primes below two million. */ public static long Solve() { long sum = 5; for (long i = 4; i < 2000000; i++) { if (P007.IsPrime(i)) { sum += i; } } return(sum); }