Beispiel #1
0
 public bool IsPrime(BigInteger b)
 {
     if (b.IsSquare())
     {
         return(false);
     }
     if (b < long.MaxValue)
     {
         return(IsPrime((long)b));
     }
     if (!MillerRabin.MillerRabinPass(2, b))
     {
         return(false);
     }
     return(IsLucasPseudoprime(b));
 }
Beispiel #2
0
 public bool IsPrime(long l)
 {
     if (l < int.MaxValue)
     {
         return(IsPrime((int)l));
     }
     if (l.IsSquare())
     {
         return(false);
     }
     if (!MillerRabin.MillerRabinPass(2, l))
     {
         return(false);
     }
     return(IsLucasPseudoprime(l));
 }