isPrime: Is Prime?

View source: R/isPrime.R

isPrimeR Documentation

Is Prime?

Description

Determine if a number is a prime number

Usage

isPrime(x, div_v = T, print_v = T)

Arguments

x

number to test

div_v

boolean determining if divisors should be output or not.

print_v

boolean determining if answer should be printed to console

Value

list. 1st element - boolean of if x is prime or not. 2nd element - vector of divisors, if specified

Examples

test_v <- c(2, 10, 17, 567, 5678)
sapply(test_v, isPrime)
sapply(test_v, function(x) isPrime(x, print_v = F, div_v = F))

weshorton/wrh.rUtils documentation built on Oct. 28, 2024, 7:24 a.m.