Rdocumentation
powered by
Learn R Programming
spuRs (version 2.0.0)
prime: Function to assess whether or not an integer is prime.
Description
An inefficient, brute-force algorithm to assess whether or not an integer is prime.
Usage
prime(n)
Arguments
n
The integer.
Value
The function returns a logical object that is TRUE if the integer is prime.
Details
The function assumes that
n
is a positive integer.
References
Jones, O.D., R. Maillardet, and A.P. Robinson. 2009. An Introduction to Scientific Programming and Simulation, Using R. Chapman And Hall/CRC.
See Also
primesieve
Examples
Run this code
prime(
10
)
prime(
7
)
Run the code above in your browser using
DataLab