using System; using System.Diagnostics; using System.Numerics; namespace Projekt2 { class Program { static void Main(string[] args) { BigInteger[] liczba = new BigInteger[8] {100913,1009139, 10091401, 100914061, 1009140611, 10091406133, 100914061337, 1009140613399}; /*for(int i = 6; i < liczba.Length ; i++) { Stopwatch stoper = new Stopwatch(); stoper.Start(); IsPrime(liczba[i]); stoper.Stop(); Console.WriteLine("CZAS: "+stoper.ElapsedMilliseconds); stoper.Reset(); }*/ Console.WriteLine(); for(int i = 0; i < liczba.Length; i++) { IsPrime2(liczba[i]); } } static bool IsPrime(BigInteger Num) { if (Num < 2) return false; else if (Num < 4) return true; else if (Num % 2 == 0) return false; else for (BigInteger u = 3; u < Num / 2; u += 2) if (Num % u == 0) return false; return true; } static bool IsPrime2(BigInteger Num) { if (Num < 2) return false; else if (Num < 4) return true; else if (Num % 2 == 0) return false; else for (BigInteger u = 3; u*u <= Num; u += 2) if (Num % u == 0) return false; return true; } } }