This functions checks whether a number is, or numbers in a vector are prime numbers.

is_prime(x)

Arguments

x

An integer, or a vector of integers.

Value

TRUE for each prime number in x, FALSE otherwise.

Examples

is_prime(89)
#> [1] TRUE
is_prime(15)
#> [1] FALSE
is_prime(c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10))
#>  [1]  TRUE  TRUE  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE