Click or drag to resize

isPrimeisProbablyPrime Method (Int64, Int32, RandomGenerator)

Performs statistic trials to check whether the number is prime.

Namespace:  NumberStone
Assembly:  WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntax
C#
public static bool isProbablyPrime(
	this long x,
	int iterations = 64,
	RandomGenerator generator = null
)

Parameters

x
Type: SystemInt64
The number to check.
iterations (Optional)
Type: SystemInt32
The number of statistic trials to run.
generator (Optional)
Type: WhetStone.RandomRandomGenerator
The RandomGenerator to get the trial seeds from. will use the GlobalRandomGenerator.

Return Value

Type: Boolean
Whether the number is probably prime.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Int64. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

means that x is definitely not prime, means the number is prime to (1-0.5^iterations) certainty.

See Also