Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

isprime

MATLAB isprime function


Description

Array elements that are prime numbers.

Usage

isprime(x)

Arguments

x

numeric vector or matrix containing nonnegative integer values

Value

Returns an array (or vector) the same size as x containing logical 1 (true) for the elements of x which are prime, and logical 0 (false) otherwise.

Author(s)

See Also

Examples

x <- c(2, 3, 0, 6, 10)
ans  <- isprime(x)	## 1, 1, 0, 0, 0
as.logical(ans)         ## true, true, false, false, false

matlab

MATLAB emulation package

v1.0.2
Artistic-2.0
Authors
P. Roebuck
Initial release
2014-06-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.