| primefactors | R Documentation |
These functions find prime numbers, factorise a composite number into its prime factors, determine whether a number is prime, and find the least common multiple or greatest common divisor of two numbers.
primefactors(n, method=c("C", "interpreted"))
divisors(n)
is.prime(n)
relatively.prime(n, m)
least.common.multiple(n,m)
greatest.common.divisor(n,m)
primesbelow(nmax)
n, m |
Integers to be factorized. |
nmax |
Integer. Upper limit on prime numbers to be found. |
method |
Character string indicating the choice of algorithm. (Developer use only.) |
is.prime(n) returns TRUE if n is a prime number,
and FALSE otherwise.
primefactors(n) factorises the integer n
into its prime number factors, and returns an integer vector
containing these factors. Some factors may be repeated.
divisors(n) finds all the integers which divide
the integer n, and returns them as a sorted vector of integers
(beginning with 1 and ending with n).
relatively.prime(n, m) returns TRUE if the integers
n and m are relatively prime, that is, if they have no
common factors.
least.common.multiple and greatest.common.divisor
return the least common multiple or greatest common divisor of two
integers n and m.
primesbelow(nmax) returns an integer vector containing all the
prime numbers less than or equal to nmax.
is.prime and relatively.prime return a logical value.
least.common.multiple and greatest.common.divisor
return a single integer.
primefactors and primesbelow
return an integer vector.
.
is.prime(17)
is.prime(399137)
relatively.prime(2, 3)
primefactors(24) ## Note repeated factors
primefactors(713291035)
divisors(24)
greatest.common.divisor(60, 100)
least.common.multiple(10, 15)
primesbelow(20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.