Public Function NextPrime( _ ByVal vX As Variant _ ) As Variant
NextPrime(-6) = -5 NextPrime(-5) = -3 NextPrime(-3) = -2 NextPrime(-2) = 2 NextPrime(-1) = 2 NextPrime(1) = 2 NextPrime(2) = 3 NextPrime(3) = 5 NextPrime(5) = 7 NextPrime(7) = 11See also:
NextPrimeSample Subroutine PreviousPrime Function NthPrime Function IsPrime FunctionvX: The number whose next-larger prime number is returned. Function returns Null if vX is Null or cannot be fixed up to a number.
Special handling:
If -5 <= X < -3 Then Return -3. If -3 <= X < -2 Then Return -2. If -2 <= X < 2 Then Return 2. If 2 <= X < 3 Then Return 3.
Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.