The prime_factors
function is used to calculate the prime factors of
a positive integer greater than 1.
prime_factors(x, unique = TRUE)
x | The number that you want the prime factors of. |
---|---|
unique | Logical. Should the function return all prime factors
(where |
A numeric vector either with the repeated prime factorization of the input or just the unique prime factors of the input.
Returns NULL
for a value of 1, and generates an error for
values less than 1.
prime_factors(100, unique = FALSE)#> [1] 2 2 5 5prime_factors(100)#> [1] 2 5