| MathUtilsIsMillerRabinPrime Method |
Namespace: Orthogonal.Common.BasicAssembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2024-04-15 18:00 GMT+10.f27da1471008deaf16b803c17e24a5955690aef1
Syntax public 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