19. Finding all primes {VeryLargeIntegers} | R Documentation |
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.
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)
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 |
vector of objects of class "noquote"
Javier Leiva Cuadrado
primes(n = 600, iter = 10, test = "MR", bar = TRUE)