primes: Finding All Primes Up to a Given Bound

View source: R/primes.R

19. Finding all primesR Documentation

Finding All Primes Up to a Given Bound

Description

The function primes displays a vector with all prime numbers up to a given bound. Computation can be made by using different probabilistic primality tests at the user's choice (Fermat Test, Miller-Rabin Test or Solovay-Strassen Test). The number of iterations is also configurable, to set the desired accuracy.

Usage

primes(n, test = "MR", iter = 10, bar = TRUE)

## Default S3 method:
primes(n, test = "MR", iter = 10, bar = TRUE)

## S3 method for class 'numeric'
primes(n, test = "MR", iter = 10, bar = TRUE)

## S3 method for class 'vli'
primes(n, test = "MR", iter = 10, bar = TRUE)

Arguments

n

upper bound of the interval in which look for primes; object of class vli or 32 bits

test

chosen test for each number: "F" for the Fermat Test, "SS" for the Solovay-Strassen Test or "MR" (by default) for the Miller-Rabin Test; character

iter

number of iterations for each number being tested; numeric

bar

to choose if display or not a progress bar; boolean

Value

vector of objects of class "noquote"

Author(s)

Javier Leiva Cuadrado

Examples

primes(n = 600, iter = 10, test = "MR", bar = TRUE)

VeryLargeIntegers documentation built on May 31, 2023, 7:06 p.m.