Function to assess whether or not an integer is prime.
An inefficient, brute-force algorithm to assess whether or not an integer is prime.
prime(n)
n
: The integer.The function assumes that n
is a positive integer.
The function returns a logical object that is TRUE if the integer is prime.
Jones, O.D., R. Maillardet, and A.P. Robinson. 2009. An Introduction to Scientific Programming and Simulation, Using R. Chapman And Hall/CRC.
primesieve
prime(10) prime(7)
Useful links