Learn R Programming

primes (version 1.6.0)

nth_prime: Get the n-th Prime from the Sequence of Primes.

Description

Get the n-th prime, \(p_n\), in the sequence of primes.

Usage

nth_prime(x)

Value

An integer vector.

Arguments

x

an integer vector.

Author

Paul Egeler, MS

Examples

Run this code
nth_prime(5)
## [1] 11

nth_prime(c(1:3, 7))
## [1]  2  3  5 17

Run the code above in your browser using DataLab