Integer Math.Previous Prime Method
Returns the first prime number preceding the given number.
Definition
Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
The next prime number, if there is one, or -1 if not.
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
public static int PreviousPrime(
int n
)
Parameters
- n Int32
- A 32-bit integer.
Return Value
Int32The next prime number, if there is one, or -1 if not.