prime function

Function to assess whether or not an integer is prime.

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)

Arguments

  • n: The integer.

Details

The function assumes that n is a positive integer.

Returns

The function returns a logical object that is TRUE if the integer is prime.

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

prime(10) prime(7)
  • Maintainer: Andrew Robinson
  • License: GPL-3
  • Last published: 2018-05-21

Useful links