22. Counting the number of primes {VeryLargeIntegers} | R Documentation |
The function primescount
returns the number of primes found up to a given bound. The implemented algorithm uses the Miller-Rabin Primality Test to determine whether a number is prime or not. The number of iterations is configurable, to set the desired accuracy.
primescount(n, iter = 10, bar = TRUE) ## Default S3 method: primescount(n, iter = 10, bar = TRUE) ## S3 method for class 'numeric' primescount(n, iter = 10, bar = TRUE) ## S3 method for class 'vli' primescount(n, iter = 10, bar = TRUE)
n |
upper bound of the interval in which we want to count the number of primes; object of class vli or 32 bits integer |
iter |
number of iterations for each number being tested; numeric |
bar |
to choose if display or not a progress bar; boolean |
Javier Leiva Cuadrado
## Not run: ## Counting primes up to 200 primescount(n = 200, iter = 10, bar = TRUE) ## Computing the approximation of pi(x) pi(200) ## Showing the numbers by using the Solovay-Strassen test primes(n = 200, iter = 10, test = "SS", bar = TRUE) ## End(Not run)