private static void Main(string[] args) { const double targetNumber = 600851475143; var sieveOfEratosthenes = new SieveOfEratosthenes((long) Math.Sqrt(targetNumber)); foreach (long l in sieveOfEratosthenes.Primes().Reverse().Where(l => targetNumber%l == 0)) { Console.WriteLine(l); break; } Console.ReadLine(); }
static void Main(string[] args) { long elementAt = new SieveOfEratosthenes(500000).Primes().ElementAt(10000); Console.WriteLine(elementAt); Console.ReadLine(); }