The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Fast Functions for Prime Numbers in R

CRAN version Number of Downloads

Authors: Os Keyes and Paul Egeler
License: MIT

Description

This R package has several utility functions for dealing with prime numbers, such as checking for primality and generating prime numbers. Additional functions include:

The package also provides an R dataset containing the first one thousand primes.

Installation

You can install the released version of primes from CRAN with:

install.packages("primes")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("ironholds/primes")

Example

This checks which of the first twenty natural numbers are prime:

library(primes)

is_prime(1:20)
## [1] FALSE  TRUE  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE FALSE  TRUE FALSE  TRUE FALSE
## [15] FALSE FALSE  TRUE FALSE  TRUE FALSE

You can also generate all the prime numbers between 101 and 199 with the following:

generate_primes(101, 199)
## [1] 101 103 107 109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.