예제 #1
0
파일: Primes.cs 프로젝트: yrinleung/ntaste
 public static List <int> primeFactors(int n)
 {
     if (n < 2)
     {
         throw new ArgumentException();
     }
     return(SmallPrimes.trialDivision(n));
 }
예제 #2
0
파일: Primes.cs 프로젝트: yrinleung/ntaste
 public static bool isPrime(int n)
 {
     if (n < 2)
     {
         return(false);
     }
     foreach (int num in SmallPrimes.PRIMES)
     {
         if (0 == (n % num))
         {
             return(n == num);
         }
     }
     return(SmallPrimes.millerRabinPrimeTest(n));
 }