Returns a vector containing the prime factors of n.

factors(n)

Arguments

n

nonnegative integer

Details

Computes the prime factors of n in ascending order, each one as often as its multiplicity requires, such that n == prod(factors(n)).

The corresponding Matlab function is called `factor', but because factors have a special meaning in R and the factor() function in R could not (or should not) be shadowed, the number theoretic function has been renamed here.

Value

Vector containing the prime factors of n.

See also

Examples