public void TestPrimeNumbers()
        {
            PrimeNumber pn = new PrimeNumber();

            int[] tab = pn.FindAllPrimesEratosthenes(120);
            Assert.AreEqual(113, tab[29]); //Check du dernier prime
        }
Esempio n. 2
0
        static void DoPrimeNumber()
        {
            Console.Write("Calculate prime numbers until : ");
            int number = int.Parse(Console.ReadLine());

            PrimeNumber pn = new PrimeNumber();

            WarningMessage();
            var watch  = Stopwatch.StartNew();
            var result = pn.FindAllPrimesEratosthenes(number);

            watch.Stop();
            var elapsedMs = watch.ElapsedMilliseconds;

            Console.WriteLine($"\n Elapsed time : {elapsedMs} ms\n Number of occurences : {result.Count()}\n-------------------------------------------------\n ");
            Console.WriteLine("\nPress any key to continue...");
            Console.ReadKey();
        }