https://github.com/cran/pracma
Raw File
Tip revision: 392ae21a013fb3f518e8f9eb8efb458a55a2eca2 authored by HwB on 09 April 2011, 00:00:00 UTC
version 0.3-0
Tip revision: 392ae21
primes.Rd
\name{primes}
\alias{primes}
\title{Prime Numbers}
\description{
  Generate a list of prime numbers less or equal \code{n}.
}
\usage{
  primes(n)
}
\arguments{
  \item{n}{nonnegative integer greater than 1.}
}
\details{
  The list of prime numbers up to \code{n} is generated using the "sieve of
  Erasthostenes". This approach is reasonably fast, but may require a lot of
  main memory when \code{n} is large.

  In double precision arithmetic integers are represented exactly only up to
  2^53 - 1, therefore this is the maximal allowed value.
}
\value{
  vector of integers representing prime numbers
}
\author{
  hwb \email{hwborchers@googlemail.com}
}
\seealso{
  \code{\link{isprime}, \link{ifactor}}
}
\examples{
  primes(1000)
  \dontrun{
  length(primes(1e6))  # there are 78498 prime numbers less than 1,000,000.}
}
\keyword{ math }
back to top