예제 #1
0
        public static int GetIth(int i)
        {
            threadQueue.Wait();
            if (i >= primes.Count)
            {
                CalcUntilIthPrime(i + 1);
            }
            int p = primes[i];

            threadQueue.Next();
            return(p);
        }
예제 #2
0
 void GenPrime()
 {
     tq.Wait();
     while (Exponent * Exponent > primes.Last())
     {
         SquareSieve();
     }
     tq.Next();
 }