using System.Collections.Generic;
public static void Main()
uint nthPrime = GetNthPrime(num);
Console.WriteLine($"{num} th prime number is {nthPrime}");
private static uint GetNthPrime(int num = 10001)
IList<uint> primes = new List<uint>() { 2 };
for ( uint n = 3 ; primes.Count <= num - 1 ; n += 2 )
foreach ( int p in primes )
private static bool[] SieveOfEratosthenes(int num)
bool[] primeCheck = new bool[num + 1];
for ( int n = 0 ; n < num ; n++ )
for ( int n = 2 ; n * n <= num ; n++ )
if ( primeCheck[n] == true )
for ( int p = n * n ; p <= num ; p += n )