<-- Previous || Up || Next -->

Is Prime Function
Math Arithmetic Class

Public Function IsPrime( _
    ByVal vNumber As Variant _
    ) As Boolean

"Is Number Prime"
Return true if a number is prime; return False otherwise.

Examples:
    IsPrime(0) = False
    IsPrime(1) = False
    IsPrime(2) = True
    IsPrime(3) = True
    IsPrime(4) = False
    IsPrime(5) = True
    IsPrime(4.76) = True ' #7
    IsPrime(-5) = True ' #8
See also:
    NthPrime Function
    NextPrime Function
    PreviousPrime Function
vNumber: The number which is tested to see if it is prime. Function returns Null if vNumber is Null or cannot be fixed up to a number.
Warning: The floating-point part of vNumber (if any) is ignored as in example #7.
Note: Function uses the absolute value of the number to determine if it is prime as in example #8.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.