 | MathUtilsIsMillerRabinPrime Method |
Namespace: Orthogonal.Common.BasicAssembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2024-04-29 08:29 GMT+10
Syntaxpublic static bool IsMillerRabinPrime(
BigInteger n,
int smallPrimeWitnessCount,
int randomWitnessCount
)
Parameters
- n BigInteger
- The number to test for probable primality using the Miller-Rabin algorithm.
- smallPrimeWitnessCount Int32
- The number of sequential small primes to use as witnesses.
- randomWitnessCount Int32
- The number of random numbers to use as witnesses.
Return Value
BooleanTrue if the value is prime with a certainty according to the number of witnesses.
Remarks
The choices of witness numbers has not been optimised. There are research results available that indicate
which witness numbers are optimal for different test ranges. This method just walks through sequential small
primes and completely random ones, which is amateurish, but still quite effective.
See Also