previousPrime | R Documentation |
Find the next prime below n
.
previousPrime(n)
n |
natural number. |
previousPrime
finds the next prime number smaller than n
,
while nextPrime
finds the next prime number below n
.
In general the previousn prime will occur in the interval
[n-1,n-log(n)]
.
In double precision arithmetic integers are represented exactly only up to 2^53 - 1, therefore this is the maximal allowed value.
Integer.
Primes
, isPrime
p <- previousPrime(1e+6) # 999983 isPrime(p) # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.