Function Math Arithmetic Class

NthPrime

"Nth Number Prime" Return the Nth number in the prime number sequence 2, 3, 5, 7, 11, etc.

Signature (Visual Basic / VBA)

Public Function NthPrime( _
    ByVal vNumber As Variant _
    ) As Variant

Code Example

    NthPrime(0) = 1
    NthPrime(1) = 2
    NthPrime(2) = 3
    NthPrime(3) = 5
    NthPrime(4) = 7
    NthPrime(5) = 11

Parameters

Parameter Description
vNumber Function returns the prime number at this position within the list of all prime numbers. Function returns Null if vNumber is Null or cannot be fixed up to a number.