Return the next prime number, say \(p\), with \(p > n\).
Usage
nextprime(n)
Arguments
n
Integer
Value
A (probably) prime number
Details
This function uses probabilistic algorithm to identify
primes. For practical purposes, it is adequate, the chance
of a composite passing will be extremely small.
# NOT RUN {nextprime(14)
## still very fast:(p <- nextprime(1e7))
## to be really sure { isprime() gives "probably prime" } :stopifnot(identical(p, factorize(p)))
# }