IntegerMath.PreviousPrime Method

Returns the first prime number preceding the given number.

Definition

Namespace: Numerics.NET
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
C#
public static int PreviousPrime(
	int n
)

Parameters

n  Int32
A 32-bit integer.

Return Value

Int32
The next prime number, if there is one, or -1 if not.

See Also